/// <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 Update(SupplierEntity entity) { entity.Include(a => new { a.ID, a.SupNum, a.SupName, a.SupType, a.Email, a.Phone, a.Fax, a.ContactName, a.Address, a.Description }); entity.Where(a => a.SupNum == entity.SupNum); int line = this.Supplier.Update(entity); if (line > 0) { CacheHelper.Remove(CacheKey.JOOSHOW_SUPPLIER_CACHE); } return(line); }
/// <summary> /// 删除 /// </summary> /// <param name="userCode"></param> /// <returns></returns> public int Delete(string supNum) { SupplierEntity entity = new SupplierEntity(); entity.IsDelete = (int)EIsDelete.Deleted; entity.IncludeIsDelete(true); entity.Where(a => a.SupNum == supNum); int line = this.Supplier.Update(entity); if (line > 0) { CacheHelper.Remove(CacheKey.JOOSHOW_SUPPLIER_CACHE); } return(line); }
/// <summary> /// 修改 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Update(SupplierEntity entity) { string key = string.Format(CacheKey.JOOSHOW_SUPPLIER_CACHE, this.CompanyID); entity.Include(a => new { a.SupNum, a.SupName, a.SupType, a.Email, a.Phone, a.Fax, a.ContactName, a.Address, a.Description }); entity.Where(a => a.SnNum == entity.SnNum) .And(a => a.CompanyID == entity.CompanyID); int line = this.Supplier.Update(entity); if (line > 0) { CacheHelper.Remove(key); } return(line); }
/// <summary> /// 删除 /// </summary> /// <param name="userCode"></param> /// <returns></returns> public int Delete(IEnumerable <string> list) { string key = string.Format(CacheKey.JOOSHOW_SUPPLIER_CACHE, this.CompanyID); SupplierEntity entity = new SupplierEntity(); entity.IsDelete = (int)EIsDelete.Deleted; entity.IncludeIsDelete(true); entity.Where("SnNum", ECondition.In, list.ToArray()); entity.And(a => a.CompanyID == this.CompanyID); int line = this.Supplier.Update(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); }