using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.Common; using WeiSha.Common; using Song.Entities; using WeiSha.Data; using Song.ServiceInterfaces; using System.Resources; using System.Reflection; namespace Song.ServiceImpls { public partial class ProductCom : IProduct { /// /// 新增 /// /// public void FactoryAdd(ProductFactory entity) { Song.Entities.Organization org = Business.Do().OrganCurrent(); if (org != null) { entity.Org_ID = org.Org_ID; entity.Org_Name = org.Org_Name; } Gateway.Default.Save(entity); } /// /// 修改 /// /// 业务实体 public void FactorySave(ProductFactory entity) { Gateway.Default.Save(entity); } /// /// 删除,按主键ID; /// /// 实体的主键 public void FactoryDelete(int identify) { Gateway.Default.Delete(ProductFactory._.Pfact_Id == identify); } /// /// 获取单一实体对象,按主键ID; /// /// 实体的主键 /// public ProductFactory FactorySingle(int identify) { return Gateway.Default.From().Where(ProductFactory._.Pfact_Id == identify).ToFirst(); } /// /// 获取所有 /// /// /// public ProductFactory[] FactoryAll(bool? isUse) { WhereClip wc = ProductFactory._.Pfact_Id > 0; if (isUse != null) { wc.And(ProductFactory._.Pfact_IsUse == isUse); } return Gateway.Default.From().Where(wc).OrderBy(ProductFactory._.Pfact_Id.Desc).ToArray(); } /// /// 分页获取厂家信息 /// /// /// /// /// /// /// public ProductFactory[] FactoryPager(bool? isUse, string searTxt, int size, int index, out int countSum) { WhereClip wc = ProductFactory._.Pfact_Id > 0; if (isUse != null) { wc.And(ProductFactory._.Pfact_IsUse == isUse); } if (searTxt != null && searTxt.Trim() != "") { wc.And(ProductFactory._.Pfact_Name.Like("%" + searTxt + "%")); } countSum = Gateway.Default.Count(wc); return Gateway.Default.From().Where(wc).OrderBy(ProductFactory._.Pfact_Id.Desc).ToArray(size, (index - 1) * size); } } }