public ProductAdjustmentHistoryCollection GetAllProductAdjustmentHistoryDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            ProductAdjustmentHistoryCollection cols = new ProductAdjustmentHistoryCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectUsersDynamic");
                while (reader.Read())
                {
                    ProductAdjustmentHistory PAH = new ProductAdjustmentHistory();

                    PAH.ProductID        = Int32.Parse(reader["ProductID"].ToString());
                    PAH.AdjustedQuantity = Int32.Parse(reader["ProductID"].ToString());
                    PAH.Reason           = reader["Reason"].ToString();
                    PAH.ModifiedDate     = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(PAH);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductAdjustmentHistoryDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        public SalesPersonQuotaHistoryCollection GetAllSalesPersonQuotaHistorysDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            SalesPersonQuotaHistoryCollection cols = new SalesPersonQuotaHistoryCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesPersonQuotaHistorysDynamic");
                while (reader.Read())
                {
                    SalesPersonQuotaHistory SPQH = new SalesPersonQuotaHistory();
                    SPQH.SalesPersonID = Int32.Parse(reader["SalesPersonID"].ToString());
                    SPQH.QuotaDate     = DateTime.Parse(reader["QuotaDate"].ToString());
                    SPQH.SalesQuota    = Decimal.Parse(reader["SalesQuota"].ToString());
                    SPQH.ModifiedDate  = DateTime.Parse(reader["ModifiedDate"].ToString());;
                    cols.Add(SPQH);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSalesPersonQuotaHistorysDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #3
0
        public User GetUser(int userID)
        {
            IDBManager dbm  = new DBManager();
            User       user = new User();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ID", userID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectUser");
                while (reader.Read())
                {
                    user.ID         = Int32.Parse(reader["ID"].ToString());
                    user.EmployeeID = Int32.Parse(reader["EmployeeID"].ToString());
                    user.UserName   = reader["UserName"].ToString();
                    user.Password   = reader["Password"].ToString();
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetUser");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(user);
        }
Exemple #4
0
        public SalesTerritory GetSalesTerritory(int TerritoryID)
        {
            IDBManager     dbm = new DBManager();
            SalesTerritory ST  = new SalesTerritory();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@TerritoryID", TerritoryID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesTerritory");
                while (reader.Read())
                {
                    ST.TerritoryID       = Int32.Parse(reader["TerritoryID"].ToString());
                    ST.Name              = reader["Name"].ToString();
                    ST.CountryRegionCode = reader["CountryRegionCode"].ToString();
                    ST.ModifiedDate      = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetSalesTerritory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(ST);
        }
        public SalesPersonQuotaHistoryCollection GetAllSalesPersonQuotaHistorysCollection()
        {
            IDBManager dbm = new DBManager();
            SalesPersonQuotaHistoryCollection cols = new SalesPersonQuotaHistoryCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesPersonQuotaHistoryAll");
                while (reader.Read())
                {
                    SalesPersonQuotaHistory SPQH = new SalesPersonQuotaHistory();
                    SPQH.SalesPersonID = Int32.Parse(reader["SalesPersonID"].ToString());
                    SPQH.QuotaDate     = DateTime.Parse(reader["QuotaDate"].ToString());
                    SPQH.SalesQuota    = decimal.Parse(reader["SalesQuota"].ToString());
                    SPQH.ModifiedDate  = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(SPQH);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSalesPersonQuotaHistorysCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #6
0
        public AddressCollection GetAllAddressesCollection()
        {
            IDBManager        dbm  = new DBManager();
            AddressCollection cols = new AddressCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectAddressesAll");
                while (reader.Read())
                {
                    Address address = new Address();
                    address.AddressID     = Int32.Parse(reader["AddressID"].ToString());
                    address.AddressLine1  = reader["AddressLine1"].ToString();
                    address.AddressLine2  = reader["AddressLine2"].ToString();
                    address.City          = reader["City"].ToString();
                    address.StateProvince = reader["StateProvince"].ToString();
                    address.PostalCode    = reader["PostalCode"].ToString();
                    address.ModifiedDate  = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(address);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllAddressesCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #7
0
        public Address GetAddress(int addressID)
        {
            IDBManager dbm     = new DBManager();
            Address    address = new Address();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@AddressID", addressID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectAddress");
                while (reader.Read())
                {
                    address.AddressID     = Int32.Parse(reader["AddressID"].ToString());
                    address.AddressLine1  = reader["AddressLine1"].ToString();
                    address.AddressLine2  = reader["AddressLine2"].ToString();
                    address.City          = reader["City"].ToString();
                    address.StateProvince = reader["StateProvince"].ToString();
                    address.PostalCode    = reader["PostalCode"].ToString();
                    address.ModifiedDate  = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAddressByID");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(address);
        }
Exemple #8
0
        public SpecialOfferProduct GetSpecialOfferProduct(int SpecialOfferID)
        {
            IDBManager          dbm = new DBManager();
            SpecialOfferProduct SOP = new SpecialOfferProduct();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@SpecialOfferID", SpecialOfferID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSpecialOfferProduct");
                while (reader.Read())
                {
                    SOP.SpecialOfferID = Int32.Parse(reader["SpecialOfferID"].ToString());
                    SOP.ProductID      = Int32.Parse(reader["ProductID"].ToString());
                    SOP.ModifiedDate   = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetSpecialOfferProduct");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(SOP);
        }
Exemple #9
0
        public SpecialOfferProductCollection GetAllSpecialOfferProductsDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            SpecialOfferProductCollection cols = new SpecialOfferProductCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSpecialOfferProductsDynamic");
                while (reader.Read())
                {
                    SpecialOfferProduct SOP = new SpecialOfferProduct();
                    SOP.SpecialOfferID = Int32.Parse(reader["SpecialOfferID"].ToString());
                    SOP.ProductID      = Int32.Parse(reader["ProductID"].ToString());
                    SOP.ModifiedDate   = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(SOP);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSpecialOfferProductsDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        public ProductCostHistoryCollection GetAllProductCostHistorysCollection()
        {
            IDBManager dbm = new DBManager();
            ProductCostHistoryCollection cols = new ProductCostHistoryCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductCostHistoriesAll");
                while (reader.Read())
                {
                    ProductCostHistory productCostHistory = new ProductCostHistory();
                    productCostHistory.ID           = Int32.Parse(reader["ID"].ToString());
                    productCostHistory.ProductID    = Int32.Parse(reader["ProductID"].ToString());
                    productCostHistory.StartDate    = DateTime.Parse(reader["StartDate"].ToString());
                    productCostHistory.EndDate      = DateTime.Parse(reader["EndDate"].ToString());
                    productCostHistory.StandardCost = Decimal.Parse(reader["StandardCost"].ToString());
                    productCostHistory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productCostHistory);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductCostHistorysCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #11
0
        public SpecialOfferProductCollection GetAllSpecialOfferProductsCollection()
        {
            IDBManager dbm = new DBManager();
            SpecialOfferProductCollection cols = new SpecialOfferProductCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSpecialOfferProductAll");
                while (reader.Read())
                {
                    SpecialOfferProduct SOP = new SpecialOfferProduct();
                    SOP.SpecialOfferID = Int32.Parse(reader["SpecialOfferID"].ToString());
                    SOP.ProductID      = Int32.Parse(reader["ProductID"].ToString());
                    SOP.ModifiedDate   = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(SOP);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSpecialOfferProductsCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #12
0
        public SalesTerritoryHistory GetSalesTerritoryHistory(int ID)
        {
            IDBManager            dbm = new DBManager();
            SalesTerritoryHistory STH = new SalesTerritoryHistory();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ID", ID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesTerritoryHistory");
                while (reader.Read())
                {
                    STH.ID            = Int32.Parse(reader["ID"].ToString());
                    STH.SalesPersonID = Int32.Parse(reader["SalesPersonID"].ToString());
                    STH.TerritoryID   = Int32.Parse(reader["TerritoryID"].ToString());
                    STH.StartDate     = DateTime.Parse(reader["StartDate"].ToString());
                    if (reader["EndDate"] != null && reader["EndDate"].ToString() != "")
                    {
                        STH.EndDate = DateTime.Parse(reader["EndDate"].ToString());
                    }
                    STH.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetSalesTerritoryHistory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(STH);
        }
Exemple #13
0
        public SalesOrderDetail GetSalesOrderDetail(int salesOrderDetailID)
        {
            IDBManager       dbm = new DBManager();
            SalesOrderDetail SOD = new SalesOrderDetail();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@SalesOrderDetailID", salesOrderDetailID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesOrderDetail");
                while (reader.Read())
                {
                    SOD.SalesOrderID          = Int32.Parse(reader["SalesOrderID"].ToString());
                    SOD.SalesOrderDetailID    = Int32.Parse(reader["SalesOrderDetailID"].ToString());
                    SOD.CarrierTrackingNumber = reader["CarrierTrackingNumber"].ToString();
                    SOD.OrderQty          = short.Parse(reader["OrderQty"].ToString());
                    SOD.ProductID         = Int32.Parse(reader["ProductID"].ToString());
                    SOD.SpecialOfferID    = Int32.Parse(reader["SpecialOfferID"].ToString());
                    SOD.UnitPrice         = decimal.Parse(reader["UnitPrice"].ToString());
                    SOD.UnitPriceDiscount = decimal.Parse(reader["UnitPriceDiscount"].ToString());
                    SOD.LineTotal         = decimal.Parse(reader["LineTotal"].ToString());
                    SOD.ModifiedDate      = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetSalesOrderDetail");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(SOD);
        }
        public ProductAdjustmentHistoryCollection GetAllProductAdjustmentHistoryCollection(int purchaseAdjustedQuantity)
        {
            IDBManager dbm = new DBManager();
            ProductAdjustmentHistoryCollection cols = new ProductAdjustmentHistoryCollection();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ProductID", purchaseAdjustedQuantity);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductAdjustmentHistoryByAdjustedQuantity");
                while (reader.Read())
                {
                    ProductAdjustmentHistory PAH = new ProductAdjustmentHistory();
                    PAH.ProductID        = Int32.Parse(reader["ProductID"].ToString());
                    PAH.AdjustedQuantity = Int32.Parse(reader["AdjustedQuantity"].ToString());
                    PAH.Reason           = reader["Reason"].ToString();
                    PAH.ModifiedDate     = DateTime.Parse(reader["ModifiedDate"].ToString());

                    cols.Add(PAH);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "ProductAdjustmentHistoryCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #15
0
        public ProductInventoryCollection GetAllProductInventorysCollection()
        {
            IDBManager dbm = new DBManager();
            ProductInventoryCollection cols = new ProductInventoryCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductInventoriesAll");
                while (reader.Read())
                {
                    ProductInventory productInventory = new ProductInventory();
                    productInventory.ProductID    = Int32.Parse(reader["ProductID"].ToString());
                    productInventory.LocationID   = Int32.Parse(reader["LocationID"].ToString());
                    productInventory.Shelf        = reader["Shelf"].ToString();
                    productInventory.Quantity     = Int16.Parse(reader["Quantity"].ToString());
                    productInventory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productInventory);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "ProductInventoryCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #16
0
        public SalesInvoiceDetail GetSalesInvoiceDetail(int @InvoiceDetailID)
        {
            IDBManager         dbm = new DBManager();
            SalesInvoiceDetail SID = new SalesInvoiceDetail();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@InvoiceDetailID", @InvoiceDetailID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesInvoiceDetail");
                while (reader.Read())
                {
                    SID.@InvoiceDetailID  = Int32.Parse(reader["@InvoiceDetailID"].ToString());
                    SID.InvoiceID         = Int32.Parse(reader["InvoiceID"].ToString());
                    SID.Quantity          = short.Parse(reader["Quantity"].ToString());
                    SID.ProductID         = Int32.Parse(reader["ProductID"].ToString());
                    SID.SpecialOfferID    = Int32.Parse(reader[""].ToString());
                    SID.UnitPrice         = decimal.Parse(reader[""].ToString());
                    SID.UnitPriceDiscount = decimal.Parse(reader[""].ToString());
                    SID.LineTotal         = decimal.Parse(reader[""].ToString());
                    SID.ModifiedDate      = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetSalesInvoiceDetail");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(SID);
        }
Exemple #17
0
        public ProductInventoryCollection GetAllProductInventorysDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            ProductInventoryCollection cols = new ProductInventoryCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductInventoriesDynamic");
                while (reader.Read())
                {
                    ProductInventory productInventory = new ProductInventory();
                    productInventory.ProductID    = Int32.Parse(reader["ProductID"].ToString());
                    productInventory.LocationID   = Int32.Parse(reader["LocationID"].ToString());
                    productInventory.Shelf        = reader["Shelf"].ToString();
                    productInventory.Bin          = Byte.Parse(reader["Bin"].ToString());
                    productInventory.Quantity     = Int16.Parse(reader["Quantity"].ToString());
                    productInventory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productInventory);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductInventorysDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #18
0
        public PurchaseInvoiceDetailCollection GetAllPurchaseInvoiceDetailCollection()
        {
            IDBManager dbm = new DBManager();
            PurchaseInvoiceDetailCollection cols = new PurchaseInvoiceDetailCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectPurchaseInvoiceDetailsAll");
                while (reader.Read())
                {
                    PurchaseInvoiceDetail PID = new PurchaseInvoiceDetail();
                    PID.InvoiceID       = Int32.Parse(reader["InvoiceID"].ToString());
                    PID.InvoiceDetailID = Int32.Parse(reader["InvoiceDetailID"].ToString());
                    PID.ProductID       = Int32.Parse(reader["ProductID"].ToString());
                    PID.UnitPrice       = Decimal.Parse(reader["UnitPrice"].ToString());
                    PID.Quantity        = Int64.Parse(reader["Quantity"].ToString());
                    PID.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(PID);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "PurchaseInvoiceDetailCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #19
0
        public AddressCollection GetAddressesDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager        dbm  = new DBManager();
            AddressCollection cols = new AddressCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectAddressesDynamic");
                while (reader.Read())
                {
                    Address address = new Address();
                    address.AddressID     = Int32.Parse(reader["AddressID"].ToString());
                    address.AddressLine1  = reader["AddressLine1"].ToString();
                    address.AddressLine2  = reader["AddressLine2"].ToString();
                    address.City          = reader["City"].ToString();
                    address.StateProvince = reader["StateProvince"].ToString();
                    address.PostalCode    = reader["PostalCode"].ToString();
                    address.ModifiedDate  = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(address);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAddressesDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #20
0
        public PurchaseInvoiceDetail GetPurchaseInvoiceDetail(int PIDID)
        {
            IDBManager            dbm = new DBManager();
            PurchaseInvoiceDetail PID = new PurchaseInvoiceDetail();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@InvoiceDetailID", PIDID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectPurchaseInvoiceDetail");
                while (reader.Read())
                {
                    PID.InvoiceID       = Int32.Parse(reader["InvoiceID"].ToString());
                    PID.InvoiceDetailID = Int32.Parse(reader["InvoiceDetailID"].ToString());
                    PID.ProductID       = Int32.Parse(reader["ProductID"].ToString());
                    PID.UnitPrice       = Decimal.Parse(reader["UnitPrice"].ToString());
                    PID.Quantity        = Int64.Parse(reader["Quantity"].ToString());
                    PID.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetPurchaseInvoiceDetail");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(PID);
        }
Exemple #21
0
        public SalesTerritoryCollection GetAllSalesTerritorysCollection()
        {
            IDBManager dbm = new DBManager();
            SalesTerritoryCollection cols = new SalesTerritoryCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesTerritoryAll");
                while (reader.Read())
                {
                    SalesTerritory ST = new SalesTerritory();
                    ST.TerritoryID       = Int32.Parse(reader["TerritoryID"].ToString());
                    ST.Name              = reader["Name"].ToString();
                    ST.CountryRegionCode = reader["CountryRegionCode"].ToString();
                    ST.ModifiedDate      = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(ST);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSalesTerritorysCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #22
0
        public PaymentCollection GetAllPaymentCollection()
        {
            IDBManager        dbm  = new DBManager();
            PaymentCollection cols = new PaymentCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectPaymentsAll");
                while (reader.Read())
                {
                    Payment PAY = new Payment();
                    PAY.PaymentID    = Int32.Parse(reader["PaymentID"].ToString());
                    PAY.InvoiceID    = Int32.Parse(reader["InvoiceID"].ToString());
                    PAY.PaymentType  = reader["PaymentType"].ToString();
                    PAY.PaymentDate  = DateTime.Parse(reader["PaymentDate"].ToString());
                    PAY.Amount       = decimal.Parse(reader["Amount"].ToString());
                    PAY.Comments     = reader["Comments "].ToString();
                    PAY.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    PAY.CheckNumber  = reader["CheckNumber"].ToString();
                    cols.Add(PAY);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "PaymentCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #23
0
        public SalesTerritoryCollection GetAllSalesTerritorysDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            SalesTerritoryCollection cols = new SalesTerritoryCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesTerritorysDynamic");
                while (reader.Read())
                {
                    SalesTerritory ST = new SalesTerritory();
                    ST.TerritoryID       = Int32.Parse(reader["TerritoryID"].ToString());
                    ST.Name              = reader["Name"].ToString();
                    ST.CountryRegionCode = reader["CountryRegionCode"].ToString();
                    ST.ModifiedDate      = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(ST);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSalesTerritorysDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #24
0
        public Payment GetPayment(int PAYID)
        {
            IDBManager dbm = new DBManager();
            Payment    PAY = new Payment();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@PaymentID", PAYID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectPayment");
                while (reader.Read())
                {
                    PAY.PaymentID    = Int32.Parse(reader["PaymentID"].ToString());
                    PAY.InvoiceID    = Int32.Parse(reader["InvoiceID"].ToString());
                    PAY.PaymentType  = reader["PaymentType"].ToString();
                    PAY.PaymentDate  = DateTime.Parse(reader["PaymentDate"].ToString());
                    PAY.Amount       = decimal.Parse(reader["Amount"].ToString());
                    PAY.Comments     = reader["Comments "].ToString();
                    PAY.CheckNumber  = reader["CheckNumber"].ToString();
                    PAY.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetPayment");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(PAY);
        }
        public SalesPersonQuotaHistory GetSalesPersonQuotaHistory(int SalesPersonID)
        {
            IDBManager dbm = new DBManager();
            SalesPersonQuotaHistory SPQH = new SalesPersonQuotaHistory();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@SalesPersonID", SalesPersonID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesPersonQuotaHistory");
                while (reader.Read())
                {
                    SPQH.SalesPersonID = Int32.Parse(reader["SalesPersonID"].ToString());
                    SPQH.QuotaDate     = DateTime.Parse(reader["QuotaDate"].ToString());
                    SPQH.SalesQuota    = Decimal.Parse(reader["SalesQuota"].ToString());
                    SPQH.ModifiedDate  = DateTime.Parse(reader["ModifiedDate"].ToString());;
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetSalesPersonQuotaHistory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(SPQH);
        }
        public int Exists(string name)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@Name", name);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductCategoryExists");
                if (reader.Read())
                {
                    return(Int32.Parse(reader["ProductCategoryID"].ToString()));
                }
                else
                {
                    return(0);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "Exists");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
        }
Exemple #27
0
        public UserCollection GetAllUsersCollection()
        {
            IDBManager     dbm = new DBManager();
            UserCollection col = new UserCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectUsersAll");
                while (reader.Read())
                {
                    User user = new User();
                    user.ID         = Int32.Parse(reader["ID"].ToString());
                    user.EmployeeID = Int32.Parse(reader["EmployeeID"].ToString());
                    user.UserName   = reader["UserName"].ToString();
                    user.Password   = reader["Password"].ToString();
                    col.Add(user);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllUsersCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(col);
        }
        public ProductCategory GetProductCategory(int productCategoryID)
        {
            IDBManager      dbm             = new DBManager();
            ProductCategory productCategory = new ProductCategory();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ProductCategoryID", productCategoryID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductCategory");
                while (reader.Read())
                {
                    productCategory.ProductCategoryID = Int32.Parse(reader["ProductCategoryID"].ToString());
                    productCategory.Name         = reader["Name"].ToString();
                    productCategory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetProductCategory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(productCategory);
        }
Exemple #29
0
        public UserCollection GetAllUsersDynamicCollection(string where, string orderBy)
        {
            IDBManager     dbm = new DBManager();
            UserCollection col = new UserCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", where);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectUsersDynamic");
                while (reader.Read())
                {
                    User user = new User();
                    user.ID         = Int32.Parse(reader["ID"].ToString());
                    user.EmployeeID = Int32.Parse(reader["EmployeeID"].ToString());
                    user.UserName   = reader["UserName"].ToString();
                    user.Password   = reader["Password"].ToString();
                    col.Add(user);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllUsersDynamicCollection");
            }
            finally
            {
                dbm.Dispose();
            }
            return(col);
        }
        public PaymentMethodCollection GetAllPaymentMethodsDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            PaymentMethodCollection cols = new PaymentMethodCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectPaymentMethodsDynamic");
                while (reader.Read())
                {
                    PaymentMethod paymentMethod = new PaymentMethod();
                    paymentMethod.PaymentMethodID = Int32.Parse(reader["PaymentMethodID"].ToString());
                    paymentMethod.Name            = reader["Name"].ToString();
                    cols.Add(paymentMethod);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllPaymentMethodsDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }