/// <summary> /// 分页查询客户信息 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <CustomerEntity> GetCustomerList(CustomerEntity 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.CusNum.IsEmpty()) { entity.And("CusNum", ECondition.Like, "%" + entity.CusNum + "%"); } if (!entity.CusName.IsEmpty()) { entity.And("CusName", ECondition.Like, "%" + entity.CusName + "%"); } if (!entity.Phone.IsEmpty()) { entity.And("Phone", ECondition.Like, "%" + entity.Phone + "%"); } if (entity.CusType > 0) { entity.And(a => a.CusType == entity.CusType); } int rowCount = 0; List <CustomerEntity> listResult = this.Customer.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; return(listResult); }
/// <summary> /// 根据客户编号获得客户信息 /// </summary> /// <param name="cusNum"></param> /// <returns></returns> public CustomerEntity GetSingleCustomer(string cusNum) { CustomerEntity entity = new CustomerEntity(); entity.IncludeAll(); entity.Where(a => a.CusNum == cusNum); entity = this.Customer.GetSingle(entity); return(entity); }
/// <summary> /// 查询所有的客户数据信息 /// </summary> /// <returns></returns> public List <CustomerEntity> GetList() { CustomerEntity entity = new CustomerEntity(); entity.IncludeAll(); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); List <CustomerEntity> listResult = this.Customer.GetList(); return(listResult); }
/// <summary> /// 分页查询客户信息 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <CustomerEntity> GetCustomerList(CustomerEntity 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 <CustomerEntity> listResult = this.Customer.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; return(listResult); }
/// <summary> /// 添加客户信息 /// </summary> /// <param name="entity"></param> /// <param name="list"></param> /// <returns></returns> public int AddCustomer(CustomerEntity entity, List <CusAddressEntity> list) { entity.IncludeAll(); int line = this.Customer.Add(entity); if (!list.IsNullOrEmpty()) { list.ForEach(a => { a.CusNum = entity.CusNum; a.IncludeAll(); }); line += this.CusAddress.Add(list); } if (line > 0) { CacheHelper.Remove(CacheKey.JOOSHOW_CUSADDRESS_CACHE); } return(line); }
/// <summary> /// 添加客户信息 /// </summary> /// <param name="entity"></param> /// <param name="list"></param> /// <returns></returns> public int AddCustomer(CustomerEntity entity, List <CusAddressEntity> list) { string Key = string.Format(CacheKey.JOOSHOW_CUSADDRESS_CACHE, this.CompanyID); entity.IncludeAll(); int line = this.Customer.Add(entity); if (!list.IsNullOrEmpty()) { list.ForEach(a => { a.CustomerSN = entity.SnNum; a.IncludeAll(); }); line += this.CusAddress.Add(list); } if (line > 0) { CacheHelper.Remove(Key); } return(line); }