/// <summary> /// 获得所有供应商信息 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <SupplierEntity> GetList(SupplierEntity entity, ref PageInfo pageInfo) { entity.IncludeAll(); entity.OrderBy(a => a.ID, EOrderBy.DESC); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete) .And(a => a.CompanyID == this.CompanyID); if (!entity.SupName.IsEmpty()) { entity.And("SupName", ECondition.Like, "%" + entity.SupName + "%"); } if (!entity.SupNum.IsEmpty()) { entity.And("SupNum", ECondition.Like, "%" + entity.SupNum + "%"); } if (entity.SupType > 0) { entity.And(a => a.SupType == entity.SupType); } if (!entity.Phone.IsEmpty()) { entity.And("Phone", ECondition.Like, "%" + entity.Phone + "%"); } int rowCount = 0; List <SupplierEntity> listResult = this.Supplier.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; return(listResult); }
/// <summary> /// 获得所有供应商信息 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <SupplierEntity> GetList(SupplierEntity entity, ref PageInfo pageInfo) { entity.IncludeAll(); entity.OrderBy(a => a.ID, EOrderBy.DESC); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); int rowCount = 0; List <SupplierEntity> listResult = this.Supplier.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; return(listResult); }
/// <summary> /// 添加供应商 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int AddSupplier(SupplierEntity entity) { entity.IsDelete = (int)EIsDelete.NotDelete; entity.CreateTime = DateTime.Now; entity.CreateUser = ""; entity.IncludeAll(); int line = this.Supplier.Add(entity); if (line > 0) { CacheHelper.Remove(CacheKey.JOOSHOW_SUPPLIER_CACHE); } return(line); }
/// <summary> /// 添加供应商 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Add(SupplierEntity entity) { string key = string.Format(CacheKey.JOOSHOW_SUPPLIER_CACHE, this.CompanyID); entity.IsDelete = (int)EIsDelete.NotDelete; entity.CreateTime = DateTime.Now; entity.SupNum = entity.SupNum.IsEmpty() ? new TNumProvider(this.CompanyID).GetSwiftNum(typeof(SupplierEntity), 5) : entity.SupNum; entity.SnNum = entity.SnNum.IsEmpty() ? ConvertHelper.NewGuid() : entity.SnNum; entity.IncludeAll(); int line = this.Supplier.Add(entity); if (line > 0) { CacheHelper.Remove(key); } return(line); }
/// <summary> /// 获得所有供应商信息 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <SupplierEntity> GetList() { //List<SupplierEntity> listResult = CacheHelper.Get(CacheKey.JOOSHOW_SUPPLIER_CACHE) as List<SupplierEntity>; //if (!listResult.IsNullOrEmpty()) //{ // return listResult; //} SupplierEntity entity = new SupplierEntity(); entity.IncludeAll(); entity.OrderBy(a => a.ID, EOrderBy.DESC); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); List <SupplierEntity> listResult = this.Supplier.GetList(entity); //if (!listResult.IsNullOrEmpty()) //{ // CacheHelper.Insert(CacheKey.JOOSHOW_SUPPLIER_CACHE, listResult); //} return(listResult); }
/// <summary> /// 获得所有供应商信息 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <SupplierEntity> GetList() { string key = string.Format(CacheKey.JOOSHOW_SUPPLIER_CACHE, this.CompanyID); List <SupplierEntity> listResult = CacheHelper.Get(key) as List <SupplierEntity>; if (!listResult.IsNullOrEmpty()) { return(listResult); } SupplierEntity entity = new SupplierEntity(); entity.IncludeAll(); entity.OrderBy(a => a.ID, EOrderBy.DESC); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete) .And(a => a.CompanyID == this.CompanyID); listResult = this.Supplier.GetList(entity); if (!listResult.IsNullOrEmpty()) { CacheHelper.Insert(key, listResult); } return(listResult); }