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);
        }
        public List <Definitions.Status> ListPurchaseStatus()
        {
            DbSelectStatement clause = DbMgr.CreateSelectClause();

            clause
            .SelectDistinct()
            .SelectColumn("RecurringPurchases", "PurchaseStatusID")
            .From("RecurringPurchases");



            DbCriteria criteria = DbMgr.CreateCriteria();

            DbCommand    _cmd    = CreateDbCommand(clause);
            DbDataReader _reader = _cmd.ExecuteReader();

            while (_reader.Read())
            {
                criteria.IsEqual("Status", "StatusID", GetString(_reader, ("PurchaseStatusID")), DbCriteria.ConcatMode.OR);
            }
            _reader.Close();
            _cmd.Dispose();

            return(RepositoryMgr.StatusMgr.List(criteria));
        }
        private IList <Item> _FindFilteredCollection(bool sold, bool bought, bool inventoried, Dictionary <string, string> keywords)
        {
            DbSelectStatement clause = DbMgr.CreateSelectClause();

            clause
            .SelectAll()
            .From("Items");

            DbCriteria criteria = clause.Criteria;

            if (sold)
            {
                criteria.IsEqual("Items", "ItemIsSold", "Y");
            }
            if (bought)
            {
                criteria.IsEqual("Items", "ItemIsBought", "Y");
            }
            if (inventoried)
            {
                criteria.IsEqual("Items", "ItemIsInventoried", "Y");
            }

            foreach (string key in keywords.Keys)
            {
                criteria.Like("Items", key, keywords[key]);
            }

            BindingList <Item> _grp = new BindingList <Item>();

            Currencies.CurrencyManager cm = RepositoryMgr.CurrencyMgr;

            DbCommand    _cmd    = CreateDbCommand(clause);
            DbDataReader _reader = _cmd.ExecuteReader();

            while (_reader.Read())
            {
                Item _obj = CreateDbEntity();
                LoadFromReader(_obj, _reader);
                _grp.Add(_obj);
            }
            _reader.Close();
            _cmd.Dispose();


            return(_grp);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        public List <Status> ListPurchaseStatus()
        {
            DbCriteria criteria = DbMgr.CreateCriteria();

            criteria
            .IsEqual("Status", "StatusID", "O", DbCriteria.ConcatMode.OR)
            .IsEqual("Status", "StatusID", "C", DbCriteria.ConcatMode.OR)
            .IsEqual("Status", "StatusID", "OR", DbCriteria.ConcatMode.OR)
            .IsEqual("Status", "StatusID", "DR", DbCriteria.ConcatMode.OR)
            .IsEqual("Status", "StatusID", "Q", DbCriteria.ConcatMode.OR);
            return(List(criteria));
        }
Ejemplo n.º 8
0
        protected virtual IList <Status> _FindSaleStatusCollection()
        {
            DbCriteria criteria = DbMgr.CreateCriteria();

            criteria
            .IsEqual("Status", "StatusID", "O", DbCriteria.ConcatMode.OR)
            .IsEqual("Status", "StatusID", "C", DbCriteria.ConcatMode.OR)
            .IsEqual("Status", "StatusID", "OR", DbCriteria.ConcatMode.OR)
            .IsEqual("Status", "StatusID", "CR", DbCriteria.ConcatMode.OR)
            .IsEqual("Status", "StatusID", "Q", DbCriteria.ConcatMode.OR);
            return(List(criteria));
        }