private IList <Sale> _FindFilteredCollection(DateTime?start, DateTime?end, Customer customer, Status invoiceStatus) { DbCriteria criteria = CreateCriteria(); criteria .IsGreaterEqual("Sales", "InvoiceDate", start) .IsLessEqual("Sales", "InvoiceDate", end); if (customer != null) { criteria.IsEqual("Customers", "CardIdentification", customer.CardIdentification); } if (invoiceStatus != null) { criteria.IsEqual("Sales", "InvoiceStatusID", invoiceStatus.StatusID); } Currencies.CurrencyManager cm = RepositoryMgr.CurrencyMgr; bool support_multi_currency = cm.SupportMultiCurrency; DbSelectStatement clause = DbMgr.CreateSelectClause(); clause .SelectAll() .From("Sales") .OrderBy("Sales", "InvoiceDate", "ASC") .Criteria.And(criteria); BindingList <Sale> sales = new BindingList <Sale>(); Dictionary <int, int> currencyIds = new Dictionary <int, int>(); DbCommand _cmd = CreateDbCommand(clause); DbDataReader _reader = _cmd.ExecuteReader(); while (_reader.Read()) { Sale _obj = CreateDbEntity(); LoadFromReader(_obj, _reader); sales.Add(_obj); } _reader.Close(); _cmd.Dispose(); return(sales); }
private IList <Sale> _FindFilteredItemSaleCollection(DateTime?start, DateTime?end, Item _item) { DbCriteria criteria = CreateCriteria(); criteria .IsGreaterEqual("Sales", "InvoiceDate", start) .IsLessEqual("Sales", "InvoiceDate", end) .IsEqual("Sales", "InvoiceType", "I"); Currencies.CurrencyManager cm = RepositoryMgr.CurrencyMgr; bool support_multi_currency = cm.SupportMultiCurrency; DbSelectStatement clause = DbMgr.CreateSelectClause(); clause .SelectAll() .From("Sales") .OrderBy("Sales", "InvoiceDate", "ASC") .Criteria.And(criteria); BindingList <Sale> sales = new BindingList <Sale>(); Dictionary <int, int> currencyIds = new Dictionary <int, int>(); DbCommand _cmd = CreateDbCommand(clause); DbDataReader _reader = _cmd.ExecuteReader(); while (_reader.Read()) { Sale _obj = CreateDbEntity(); LoadFromReader(_obj, _reader); if (_obj.IsSellingItem(_item)) { sales.Add(_obj); } } _reader.Close(); _cmd.Dispose(); return(sales); }
private IList <Purchase> _FindFilteredCollection(DateTime?start, DateTime?end, Supplier supplier, Status purchaseStatus) { DbCriteria criteria = CreateCriteria(); criteria .IsGreaterEqual("Purchases", "PurchaseDate", start) .IsLessEqual("Purchases", "PurchaseDate", end); if (supplier != null) { criteria.IsEqual("Suppliers", "CardIdentification", supplier.CardIdentification); } if (purchaseStatus != null) { criteria.IsEqual("Purchases", "PurchaseStatusID", purchaseStatus.StatusID); } DbSelectStatement clause = DbMgr.CreateSelectClause(); clause .SelectAll() .From("Purchases") .OrderBy("Purchases", "PurchaseDate", "ASC") .Criteria.And(criteria); BindingList <Purchase> purchases = new BindingList <Purchase>(); DbCommand _cmd = CreateDbCommand(clause); DbDataReader _reader = _cmd.ExecuteReader(); while (_reader.Read()) { Purchase _obj = CreateDbEntity(); LoadFromReader(_obj, _reader); purchases.Add(_obj); } _reader.Close(); _cmd.Dispose(); return(purchases); }
public List <SaleRow> ListLight(DateTime start, DateTime end, Customer customer, Status invoiceStatus, int?startIndex, int?pageSize) { DbCriteria criteria = mAccountant.SaleMgr.CreateCriteria(); criteria .IsGreaterEqual("Sales", "InvoiceDate", start) .IsLessEqual("Sales", "InvoiceDate", end); if (customer != null) { criteria.IsEqual("Customers", "CardIdentification", customer.CardIdentification); } if (invoiceStatus != null) { criteria.IsEqual("Sales", "InvoiceStatusID", invoiceStatus.StatusID); } return(mAccountant.SaleMgr.ListTableRow(criteria, startIndex, pageSize)); }
public int GetSaleCount(DateTime start, DateTime end, Customer customer, Status invoiceStatus) { DbCriteria criteria = mAccountant.SaleMgr.CreateCriteria(); criteria .IsGreaterEqual("Sales", "InvoiceDate", start) .IsLessEqual("Sales", "InvoiceDate", end); if (customer != null) { criteria.IsEqual("Customers", "CardIdentification", customer.CardIdentification); } if (invoiceStatus != null) { criteria.IsEqual("Sales", "InvoiceStatusID", invoiceStatus.StatusID); } return(mAccountant.SaleMgr.GetPageCount(criteria)); }