protected override List <object> GetDataSource() { CustomerPaymentSearchCondition cpsc = new CustomerPaymentSearchCondition(); cpsc.PaymentTypes = new List <CustomerPaymentType>(); cpsc.PaymentTypes.Add(CustomerPaymentType.Supplier); cpsc.States = new List <SheetState>(); cpsc.States.Add(SheetState.Approved); cpsc.HasRemain = true; _CustomerPayments = (new CustomerPaymentBLL(AppSettings.Current.ConnStr)).GetItems(cpsc).QueryObjects; CustomerReceivableSearchCondition crsc = new CustomerReceivableSearchCondition(); crsc.Settled = false; crsc.ReceivableTypes = new List <CustomerReceivableType>(); crsc.ReceivableTypes.Add(CustomerReceivableType.SupplierReceivable); crsc.ReceivableTypes.Add(CustomerReceivableType.SupplierOtherReceivable); _CustomerReceivables = (new CustomerReceivableBLL(AppSettings.Current.ConnStr)).GetItems(crsc).QueryObjects; CompanyBLL bll = new CompanyBLL(AppSettings.Current.ConnStr); if (SearchCondition == null) { CustomerSearchCondition con = new CustomerSearchCondition(); con.ClassID = CompanyClass.Supplier; _Customers = bll.GetItems(con).QueryObjects; } else { _Customers = bll.GetItems(SearchCondition).QueryObjects; } List <object> records = FilterData(); return(records); }
/// <summary> /// 获取所有供应商信息 /// </summary> /// <returns></returns> public QueryResultList <CompanyInfo> GetAllSuppliers() { CustomerSearchCondition con = new CustomerSearchCondition(); con.ClassID = CompanyClass.Supplier; return(GetItems(con)); }
protected override List <object> GetDataSource() { CompanyBLL bll = new CompanyBLL(AppSettings.Current.ConnStr); if (SearchCondition == null) { CustomerSearchCondition con = new CustomerSearchCondition(); con.ClassID = CompanyClass.Supplier; _Suppliers = bll.GetItems(con).QueryObjects; } else { _Suppliers = bll.GetItems(SearchCondition).QueryObjects; } List <object> records = FilterData(); return(records); }
public void Load(CustomerSearchCondition condition) { try { var lst = serviceAgent.Search(condition); if (lst != null && lst.Count > 0) { this.CustomerCollection = new ObservableCollection <Customer>(lst); } else { this.CustomerCollection.Clear(); } } catch (Exception ex) { NotifyError(ex.Message, ex); } }
public override CommandResult Delete(SupplierType info) { List <SupplierType> tps = ProviderFactory.Create <IProvider <SupplierType, string> >(RepoUri).GetItems(null).QueryObjects; if (tps != null && tps.Count > 0 && tps.Exists(item => item.Parent == info.ID)) { return(new CommandResult(ResultCode.Fail, "类别下已经有子类别,请先将所有子类别删除,再删除此类别")); } IProvider <CompanyInfo, string> sp = ProviderFactory.Create <IProvider <CompanyInfo, string> >(RepoUri); CustomerSearchCondition con = new CustomerSearchCondition() { ClassID = CompanyClass.Supplier, Category = info.ID }; if (sp.GetItems(con).QueryObjects.Count > 0) { return(new CommandResult(ResultCode.Fail, "此类别不能删除,已经有供应商归到此类别,如果确实要删除此类别,请先更改相关供应商的所属类别")); } return(ProviderFactory.Create <IProvider <SupplierType, string> >(RepoUri).Delete(info)); }
protected override List <CompanyInfo> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search) { IQueryable <CompanyInfo> ret = dc.GetTable <CompanyInfo>(); if (search is CustomerSearchCondition) { CustomerSearchCondition con = search as CustomerSearchCondition; if (!string.IsNullOrEmpty(con.CustomerID)) { ret = ret.Where(item => item.ID.Contains(con.CustomerID)); } if (con.ClassID != null) { ret = ret.Where(item => item.ClassID == con.ClassID.Value); } if (!string.IsNullOrEmpty(con.Category)) { ret = ret.Where(item => item.CategoryID == con.Category); } } List <CompanyInfo> cs = ret.ToList(); return(cs); }
public Collection <Customer> Search(CustomerSearchCondition condition) { try { using (OpenPOSDbEntities ctx = new OpenPOSDbEntities()) { ctx.ContextOptions.LazyLoadingEnabled = false; ctx.Customers.MergeOption = MergeOption.NoTracking; ctx.ContactDetails.MergeOption = MergeOption.NoTracking; var items = ctx.Customers.Include("ContactDetail").Where(x => x.Status == true); if (!string.IsNullOrEmpty(condition.Number) && !string.IsNullOrEmpty(condition.Mobile) && !string.IsNullOrEmpty(condition.Email) && !string.IsNullOrEmpty(condition.Email)) { items = items.Where(x => x.SSN.Contains(condition.Number) || x.ContactDetail.ContactName.Contains(condition.Name) || x.ContactDetail.Mobile.Contains(condition.Mobile) || x.ContactDetail.Email.Contains(condition.Email)); } else { if (!string.IsNullOrEmpty(condition.Number)) { items = items.Where(x => x.SSN.Contains(condition.Number)); } if (!string.IsNullOrEmpty(condition.Name)) { items = items.Where(x => x.ContactDetail.ContactName.Contains(condition.Name)); } if (!string.IsNullOrEmpty(condition.Mobile)) { items = items.Where(x => x.ContactDetail.Mobile.Contains(condition.Mobile)); } if (!string.IsNullOrEmpty(condition.Email)) { items = items.Where(x => x.ContactDetail.Email.Contains(condition.Email)); } } items = items.OrderBy(x => x.ContactDetail.ContactName); if (condition.PageNo > 0 && condition.PageSize > 0) { items = items.Skip((condition.PageNo - 1) * condition.PageSize).Take(condition.PageSize); } return(new Collection <Customer>(items.ToList())); } } catch (Exception ex) { LogService.Error("Error while searching customer", ex); } return(null); }