public SalesOrderHeader GetSalesOrderHeader(int SalesOrderID)
        {
            IDBManager       dbm = new DBManager();
            SalesOrderHeader SOH = new SalesOrderHeader();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@SalesOrderID", SalesOrderID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesOrderHeader");
                while (reader.Read())
                {
                    SOH.SalesOrderID        = Int32.Parse(reader["SalesOrderID"].ToString());
                    SOH.OrderDate           = DateTime.Parse(reader["OrderDate"].ToString());
                    SOH.DueDate             = DateTime.Parse(reader["OrderDate"].ToString());
                    SOH.ShipDate            = DateTime.Parse(reader["ShipDate"].ToString());
                    SOH.Status              = Byte.Parse(reader["Status"].ToString());
                    SOH.OnlineOrderFlag     = bool.Parse(reader["OnlineOrderFlag"].ToString());
                    SOH.SalesOrderNumber    = reader["SalesOrderNumber"].ToString();
                    SOH.PurchaseOrderNumber = reader["PurchaseOrderNumber"].ToString();
                    SOH.CustomerID          = Int32.Parse(reader["CustomerID"].ToString());
                    SOH.SalesPersonID       = Int32.Parse(reader["SalesPersonID"].ToString());
                    SOH.BillToAddressID     = Int32.Parse(reader["BillToAddressID"].ToString());
                    SOH.ShipToAddressID     = Int32.Parse(reader["ShipToAddressID"].ToString());
                    SOH.ShipMethodID        = Int32.Parse(reader["ShipMethodID"].ToString());
                    SOH.PaymentMethodID     = Int32.Parse(reader["PaymentMethodID"].ToString());
                    SOH.CurrencyRateID      = Int32.Parse(reader["CurrencyRateID"].ToString());
                    SOH.SubTotal            = decimal.Parse(reader["SubTotal"].ToString());
                    SOH.TaxAmt              = decimal.Parse(reader["TaxAmt"].ToString());
                    SOH.Freight             = decimal.Parse(reader["Freight"].ToString());
                    SOH.TotalDue            = decimal.Parse(reader["TotalDue"].ToString());
                    SOH.Comment             = reader["Comment"].ToString();
                    SOH.ModifiedDate        = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetSalesOrderHeader");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(SOH);
        }
        public SalesInvoiceHeaderCollection GetAllSalesInvoiceHeadersDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            SalesInvoiceHeaderCollection cols = new SalesInvoiceHeaderCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesInvoiceHeadersDynamic");
                while (reader.Read())
                {
                    SalesInvoiceHeader SIH = new SalesInvoiceHeader();
                    SIH.InvoiceID       = Int32.Parse(reader["InvoiceID"].ToString());
                    SIH.InvoiceNumber   = reader["InvoiceNumber"].ToString();
                    SIH.InvoiceDate     = DateTime.Parse(reader["InvoiceDate"].ToString());
                    SIH.DueDate         = DateTime.Parse(reader["DueDate"].ToString());
                    SIH.Status          = Byte.Parse(reader["Status"].ToString());
                    SIH.AccountNumber   = reader["AccountNumber"].ToString();
                    SIH.SaleOrderID     = Int32.Parse(reader["SaleOrderID"].ToString());
                    SIH.SalesPersonID   = Int32.Parse(reader["SalesPersonID"].ToString());
                    SIH.TerritoryID     = Int32.Parse(reader["TerritoryID"].ToString());
                    SIH.BillToAddressID = Int32.Parse(reader["BillToAddressID"].ToString());
                    SIH.ShipToAddressID = Int32.Parse(reader["ShipToAddressID"].ToString());
                    SIH.PaymentMethodID = Int32.Parse(reader["PaymentMethodID"].ToString());
                    SIH.SubTotal        = decimal.Parse(reader["SubTotal"].ToString());
                    SIH.TaxAmt          = decimal.Parse(reader["TaxAmt"].ToString());
                    SIH.Freight         = decimal.Parse(reader["Freight"].ToString());
                    SIH.TotalDue        = decimal.Parse(reader["TotalDue"].ToString());
                    SIH.Comment         = reader["Comment"].ToString();
                    SIH.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(SIH);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSalesInvoiceHeadersDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        public int AddSalesOrderHeader(SalesOrderHeader SOH)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(21);

                dbm.AddParameters(0, "@OrderDate", SOH.OrderDate);
                dbm.AddParameters(1, "@DueDate", SOH.DueDate);
                dbm.AddParameters(2, "@ShipDate", SOH.ShipDate);
                dbm.AddParameters(3, "@Status", SOH.Status);
                dbm.AddParameters(4, "@OnlineOrderFlag", SOH.OnlineOrderFlag);
                dbm.AddParameters(5, "@SalesOrderNumber", SOH.SalesOrderNumber);
                dbm.AddParameters(6, "@PurchaseOrderNumber", SOH.PurchaseOrderNumber);
                dbm.AddParameters(7, "@CustomerID", SOH.CustomerID);
                dbm.AddParameters(8, "@SalesPersonID", SOH.SalesPersonID);
                dbm.AddParameters(9, "@BillToAddressID", SOH.BillToAddressID);
                dbm.AddParameters(10, "@ShipToAddressID", SOH.ShipToAddressID);
                dbm.AddParameters(11, "@ShipMethodID", SOH.ShipMethodID);
                dbm.AddParameters(12, "@PaymentMethodID", SOH.PaymentMethodID);
                dbm.AddParameters(13, "@CurrencyRateID", SOH.CurrencyRateID);
                dbm.AddParameters(14, "@SubTotal", SOH.SubTotal);
                dbm.AddParameters(15, "@TaxAmt", SOH.TaxAmt);
                dbm.AddParameters(16, "@Freight", SOH.Freight);
                dbm.AddParameters(17, "@TotalDue", SOH.TotalDue);
                dbm.AddParameters(18, "@Comment", SOH.Comment);
                dbm.AddParameters(19, "@ModifiedDate", DateTime.Now);
                dbm.AddParameters(20, "@SalesOrderID", SOH.SalesOrderID);
                dbm.Parameters[20].Direction = ParameterDirection.Output;
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "InsertSalesOrderHeader");
                SOH.SalesOrderID = Int32.Parse(dbm.Parameters[20].Value.ToString());
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "InsertSalesOrderHeader");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(SOH.SalesOrderID);
        }
示例#4
0
        public CustomerCollection GetAllCustomersDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager         dbm  = new DBManager();
            CustomerCollection cols = new CustomerCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectCustomersDynamic");
                while (reader.Read())
                {
                    Customer customer = new Customer();
                    customer.CustomerID       = Int32.Parse(reader["CustomerID"].ToString());
                    customer.TerritoryID      = Int32.Parse(reader["TerritoryID"].ToString());
                    customer.AddressID        = Int32.Parse(reader["AddressID"].ToString());
                    customer.AccountNumber    = reader["AccountNumber"].ToString();
                    customer.CreditLimit      = Decimal.Parse(reader["CreditLimit"].ToString());
                    customer.DeliveryDay      = Int16.Parse(reader["DeliveryDay"].ToString());
                    customer.CustomerType     = reader["CustomerType"].ToString();
                    customer.Name             = reader["Name"].ToString();
                    customer.ContactName      = reader["ContactName"].ToString();
                    customer.Email            = reader["Email"].ToString();
                    customer.Phone            = reader["Phone"].ToString();
                    customer.SecondPhone      = reader["SecondPhone"].ToString();
                    customer.Fax              = reader["Fax"].ToString();
                    customer.ModifiedDate     = DateTime.Parse(reader["ModifiedDate"].ToString());
                    customer.BillingAddressID = Int32.Parse(reader["BillingAddressID"].ToString());
                    customer.ActiveFlag       = Boolean.Parse(reader["ActiveFlag"].ToString());
                    cols.Add(customer);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllCustomersDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
示例#5
0
        public PurchaseOrderHeaderCollection GetAllPurchaseOrderHeaderDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            PurchaseOrderHeaderCollection cols = new PurchaseOrderHeaderCollection();

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

                    purchaseOrderHeader.PurchaseOrderID = Int32.Parse(reader["PurchaseOrderID"].ToString());
                    purchaseOrderHeader.RevisionNumber  = reader["RevisionNumber"].ToString();
                    purchaseOrderHeader.Status          = Byte.Parse(reader["Status"].ToString());
                    purchaseOrderHeader.EmployeeID      = Int32.Parse(reader["EmployeeID"].ToString());
                    purchaseOrderHeader.VendorID        = Int32.Parse(reader["VendorID"].ToString());
                    purchaseOrderHeader.ShipMethodID    = Int32.Parse(reader["ShipMethodID"].ToString());
                    purchaseOrderHeader.OrderDate       = DateTime.Parse(reader["OrderDate"].ToString());
                    purchaseOrderHeader.ShipDate        = DateTime.Parse(reader["ShipDate"].ToString());
                    purchaseOrderHeader.SubTotal        = Decimal.Parse(reader["SubTotal"].ToString());
                    purchaseOrderHeader.TaxAmt          = Decimal.Parse(reader["TaxAmt"].ToString());
                    purchaseOrderHeader.Freight         = Decimal.Parse(reader["Freight"].ToString());
                    purchaseOrderHeader.TotalDue        = Decimal.Parse(reader["TotalDue"].ToString());
                    purchaseOrderHeader.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(purchaseOrderHeader);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllPurchaseOrderHeaderDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        public SalesInvoiceHeader GetSalesInvoiceHeader(int InvoiceID)
        {
            IDBManager         dbm = new DBManager();
            SalesInvoiceHeader SIH = new SalesInvoiceHeader();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@InvoiceID", InvoiceID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesInvoiceHeader");
                while (reader.Read())
                {
                    SIH.InvoiceID       = Int32.Parse(reader["InvoiceID"].ToString());
                    SIH.InvoiceNumber   = reader["InvoiceNumber"].ToString();
                    SIH.InvoiceDate     = DateTime.Parse(reader["InvoiceDate"].ToString());
                    SIH.DueDate         = DateTime.Parse(reader["DueDate"].ToString());
                    SIH.Status          = Byte.Parse(reader["Status"].ToString());
                    SIH.AccountNumber   = reader["AccountNumber"].ToString();
                    SIH.SaleOrderID     = Int32.Parse(reader["SaleOrderID"].ToString());
                    SIH.SalesPersonID   = Int32.Parse(reader["SalesPersonID"].ToString());
                    SIH.TerritoryID     = Int32.Parse(reader["TerritoryID"].ToString());
                    SIH.BillToAddressID = Int32.Parse(reader["BillToAddressID"].ToString());
                    SIH.ShipToAddressID = Int32.Parse(reader["ShipToAddressID"].ToString());
                    SIH.PaymentMethodID = Int32.Parse(reader["PaymentMethodID"].ToString());
                    SIH.SubTotal        = decimal.Parse(reader["SubTotal"].ToString());
                    SIH.TaxAmt          = decimal.Parse(reader["TaxAmt"].ToString());
                    SIH.Freight         = decimal.Parse(reader["Freight"].ToString());
                    SIH.TotalDue        = decimal.Parse(reader["TotalDue"].ToString());
                    SIH.Comment         = reader["Comment"].ToString();
                    SIH.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetSalesInvoiceHeader");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(SIH);
        }
示例#7
0
        public PurchaseOrderDetailCollection GetAllPurchaseOrderDetailDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            PurchaseOrderDetailCollection cols = new PurchaseOrderDetailCollection();

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

                    purchaseOrderDetail.PurchaseOrderID       = Int32.Parse(reader["PurchaseOrderID"].ToString());
                    purchaseOrderDetail.PurchaseOrderDetailID = Int32.Parse(reader["PurchaseOrderDetailID"].ToString());
                    purchaseOrderDetail.DueDate       = DateTime.Parse(reader["DueDate"].ToString());
                    purchaseOrderDetail.OrderQty      = Int16.Parse(reader["OrderQty"].ToString());
                    purchaseOrderDetail.ProductID     = Int32.Parse(reader["ProductID"].ToString());
                    purchaseOrderDetail.UnitPrice     = Decimal.Parse(reader["UnitPrice"].ToString());
                    purchaseOrderDetail.NumberOfCases = Double.Parse(reader["NumberOfCases"].ToString());
                    purchaseOrderDetail.UnitPerCase   = Int32.Parse(reader["UnitPerCase"].ToString());
                    purchaseOrderDetail.ReceivedQty   = Int64.Parse(reader["ReceivedQty"].ToString());
                    purchaseOrderDetail.RejectedQty   = Int64.Parse(reader["RejectedQty"].ToString());
                    purchaseOrderDetail.StockedQty    = Int64.Parse(reader["StockedQty"].ToString());
                    purchaseOrderDetail.ModifiedDate  = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(purchaseOrderDetail);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllPurchaseOrderDetailDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        public int AddSalesInvoiceHeader(SalesInvoiceHeader SIH)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(18);

                dbm.AddParameters(0, "@InvoiceNumber", SIH.InvoiceNumber);
                dbm.AddParameters(1, "@InvoiceDate", SIH.InvoiceDate);
                dbm.AddParameters(2, "@DueDate", SIH.DueDate);
                dbm.AddParameters(3, "@Status", SIH.Status);
                dbm.AddParameters(4, "@AccountNumber", SIH.AccountNumber);
                dbm.AddParameters(5, "@SaleOrderID", SIH.SaleOrderID);
                dbm.AddParameters(6, "@SalesPersonID", SIH.SalesPersonID);
                dbm.AddParameters(7, "@TerritoryID", SIH.TerritoryID);
                dbm.AddParameters(8, "@BillToAddressID", SIH.BillToAddressID);
                dbm.AddParameters(9, "@ShipToAddressID", SIH.ShipToAddressID);
                dbm.AddParameters(10, "@PaymentMethodID", SIH.PaymentMethodID);
                dbm.AddParameters(11, "@SubTotal", SIH.SubTotal);
                dbm.AddParameters(12, "@TaxAmt", SIH.TaxAmt);
                dbm.AddParameters(13, "@Freight", SIH.Freight);
                dbm.AddParameters(14, "@TotalDue", SIH.TotalDue);
                dbm.AddParameters(15, "@Comment", SIH.Comment);
                dbm.AddParameters(16, "@ModifiedDate", DateTime.Now);
                dbm.AddParameters(17, "@InvoiceID", SIH.InvoiceID);

                dbm.Parameters[17].Direction = ParameterDirection.Output;
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "InsertSalesInvoiceHeader");
                SIH.InvoiceID = Int32.Parse(dbm.Parameters[17].Value.ToString());
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "InsertSalesInvoiceHeader");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(SIH.InvoiceID);
        }
示例#9
0
        public VendorCollection GetAllVendorsDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager       dbm  = new DBManager();
            VendorCollection cols = new VendorCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectVendorsDynamic");
                while (reader.Read())
                {
                    Vendor vendor = new Vendor();
                    vendor.VendorID              = Int32.Parse(reader["VendorID"].ToString());
                    vendor.AddressID             = Int32.Parse(reader["AddressID"].ToString());
                    vendor.ActiveFlag            = bool.Parse(reader["ActiveFlag"].ToString());
                    vendor.ContactName           = reader["ContactName"].ToString();
                    vendor.AccountNumber         = reader["AccountNumber"].ToString();
                    vendor.CreditRating          = byte.Parse(reader["CreditRating"].ToString());
                    vendor.PreferredVendorStatus = bool.Parse(reader["PreferredVendorStatus"].ToString());
                    vendor.Name         = reader["Name"].ToString();
                    vendor.Email        = reader["Email"].ToString();
                    vendor.Phone        = reader["Phone"].ToString();
                    vendor.Fax          = reader["Fax"].ToString();
                    vendor.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    vendor.AltPhone     = reader["AltPhone"].ToString();
                    vendor.Terms        = reader["Terms"].ToString();
                    cols.Add(vendor);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllVendorsDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        public bool DeleteSalesPersonQuotaHistory(SalesPersonQuotaHistory SPQH)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@SalesPersonID", SPQH.SalesPersonID);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "DeleteSalesPersonQuotaHistory");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "DeleteSalesPersonQuotaHistory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
示例#11
0
        public bool DeletePurchaseInvoiceDetail(int pruchaseOrderDetailID)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@InvoiceDetailID", pruchaseOrderDetailID);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "DeletePurchaseInvoiceDetail");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "DeletePurchaseInvoiceDetail");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
        public bool DeleteSalesInvoiceHeader(SalesInvoiceHeader SIH)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@InvoiceID", SIH.InvoiceID);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "DeleteSalesInvoiceHeader");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "DeleteSalesInvoiceHeader");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
示例#13
0
        public bool DeleteSpecialOffer(SpecialOffer SO)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@SpecialOfferID", SO.SpecialOfferID);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "DeleteSpecialOffer");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "DeleteSpecialOffer");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
示例#14
0
        public bool DeleteEmployee(Employee employee)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@EmployeeID", employee.EmployeeID);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "DeleteEmployee");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "DeleteEmployee");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
示例#15
0
        public bool DeleteProductInventory(int productID)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ProductID", productID);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "DeleteProductCostHistory");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "DeleteProductInventory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
示例#16
0
        public bool DeleteOrderNumber(int id)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ID", id);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "DeleteOrderNumber");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "DeleteOrderNumber");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
示例#17
0
        public ProductVendorCollection GetAllProductVendorDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            ProductVendorCollection cols = new ProductVendorCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductVendorsDynamic");
                while (reader.Read())
                {
                    ProductVendor productVendor = new ProductVendor();
                    productVendor.ProductID       = Int32.Parse(reader["ProductID"].ToString());
                    productVendor.VendorID        = Int32.Parse(reader["VendorID"].ToString());
                    productVendor.AverageLeadTime = Int32.Parse(reader["AverageLeadTime"].ToString());
                    productVendor.StandardPrice   = Decimal.Parse(reader["StandardCost"].ToString());
                    productVendor.LastReceiptCost = Decimal.Parse(reader["LastReceiptCost"].ToString());
                    productVendor.LastReceiptDate = DateTime.Parse(reader["LastReceiptDate"].ToString());
                    productVendor.MinOrderQty     = Int32.Parse(reader["MinOrderQty"].ToString());
                    productVendor.MaxOrderQty     = Int32.Parse(reader["MaxOrderQty"].ToString());
                    productVendor.OnOrderQty      = Int32.Parse(reader["OnOrderQty"].ToString());
                    productVendor.UnitMeasureCode = reader["LastReceiptCost"].ToString();
                    productVendor.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(productVendor);
                }
            }

            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductVendorDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
示例#18
0
        public bool UpdatePaymentMethod(PaymentMethod paymentMethod)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@PaymentMethodID", paymentMethod.PaymentMethodID);
                dbm.AddParameters(1, "@Name", paymentMethod.Name);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "UpdatePaymentMethod");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "UpdatePaymentMethod");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
示例#19
0
        public ProductInventory GetProductInventory(int productID)
        {
            IDBManager       dbm = new DBManager();
            ProductInventory productInventory = new ProductInventory();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ProductID", productID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectProductInventory");
                while (reader.Read())
                {
                    productInventory.ProductID = Int32.Parse(reader["ProductID"].ToString());
                    if (reader["LocationID"] != DBNull.Value)
                    {
                        productInventory.LocationID = Int32.Parse(reader["LocationID"].ToString());
                    }
                    if (reader["Shelf"] != DBNull.Value)
                    {
                        productInventory.Shelf = reader["Shelf"].ToString();
                    }
                    if (reader["Quantity"] != DBNull.Value)
                    {
                        productInventory.Quantity = Int16.Parse(reader["Quantity"].ToString());
                    }
                    productInventory.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetProductInventory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(productInventory);
        }
        public DataSet GetAllProductAdjustmentHistoryDataSet(int purchaseAdjustedQuantity)
        {
            IDBManager dbm = new DBManager();
            DataSet    ds  = new DataSet();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@ProductID", purchaseAdjustedQuantity);
                ds = dbm.GetDataSet(CommandType.StoredProcedure, "SelectProductAdjustmentHistoryByAdjustedQuantity");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductAdjustmentHistoryDataSet()");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(ds);
        }
示例#21
0
        public Vendor GetVendor(int vendorID)
        {
            IDBManager dbm    = new DBManager();
            Vendor     vendor = new Vendor();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@VendorID", vendorID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectVEendor");
                while (reader.Read())
                {
                    vendor.VendorID              = Int32.Parse(reader["VendorID"].ToString());
                    vendor.AddressID             = Int32.Parse(reader["AddressID"].ToString());
                    vendor.ActiveFlag            = bool.Parse(reader["ActiveFlag"].ToString());
                    vendor.ContactName           = reader["ContactName"].ToString();
                    vendor.AccountNumber         = reader["AccountNumber"].ToString();
                    vendor.CreditRating          = byte.Parse(reader["CreditRating"].ToString());
                    vendor.PreferredVendorStatus = bool.Parse(reader["PreferredVendorStatus"].ToString());
                    vendor.Name         = reader["Name"].ToString();
                    vendor.Email        = reader["Email"].ToString();
                    vendor.Phone        = reader["Phone"].ToString();
                    vendor.Fax          = reader["Fax"].ToString();
                    vendor.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    vendor.AltPhone     = reader["AltPhone"].ToString();
                    vendor.Terms        = reader["Terms"].ToString();
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetVendor");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(vendor);
        }
示例#22
0
        public DataSet GetAllVendorsByNameDataSet(string name)
        {
            IDBManager dbm = new DBManager();
            DataSet    ds  = new DataSet();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@Name", name);
                ds = dbm.GetDataSet(CommandType.StoredProcedure, "SelectVendorByName");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllVendorsDataSet()");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(ds);
        }
示例#23
0
        public bool DeleteSalesOrderDetailsDynamic(string where)
        {
            IDBManager dbm = new DBManager();
            bool       ret = true;

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@WhereCondition", where);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "DeleteSalesOrderDetailsDynamic");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "DeleteSalesOrderDetailsDynamic");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(ret);
        }
示例#24
0
        public int AddCustomer(Customer customer)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(16);

                dbm.AddParameters(0, "@TerritoryID", customer.TerritoryID);
                dbm.AddParameters(1, "@AddressID", customer.AddressID);
                dbm.AddParameters(2, "@AccountNumber", customer.AccountNumber);
                dbm.AddParameters(3, "@CreditLimit", customer.CreditLimit);
                dbm.AddParameters(4, "@DeliveryDay", customer.DeliveryDay);
                dbm.AddParameters(5, "@CustomerType", customer.CustomerType);
                dbm.AddParameters(6, "@Name", customer.Name);
                dbm.AddParameters(7, "@ContactName", customer.ContactName);
                dbm.AddParameters(8, "@Email", customer.Email);
                dbm.AddParameters(9, "@Phone", customer.Phone);
                dbm.AddParameters(10, "@SecondPhone", customer.SecondPhone);
                dbm.AddParameters(11, "@Fax", customer.Fax);
                dbm.AddParameters(12, "@ModifiedDate", DateTime.Now);
                dbm.AddParameters(13, "@BillingAddressId", customer.BillingAddressID);
                dbm.AddParameters(14, "@CustomerID", customer.CustomerID);
                dbm.AddParameters(15, "@ActiveFlag", customer.ActiveFlag);
                dbm.Parameters[14].Direction = ParameterDirection.Output;
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "InsertCustomer");
                customer.CustomerID = Int32.Parse(dbm.Parameters[14].Value.ToString());
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "AddCustomer");
                return(-1);
            }
            finally
            {
                dbm.Dispose();
            }
            return(customer.CustomerID);
        }
示例#25
0
        public bool DeleteSalesTerritoryHistory(int SalesPersonID)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@SalesPersonID", SalesPersonID);
                dbm.AddParameters(1, "@EndDate", DateTime.Now);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "DeleteSalesTerritoryHistory");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "DeleteSalesTerritoryHistory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
示例#26
0
        public DataSet GetAllPaymentDataSet(int PaymentID)
        {
            IDBManager dbm = new DBManager();
            DataSet    ds  = new DataSet();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@PaymentID", PaymentID);
                ds = dbm.GetDataSet(CommandType.StoredProcedure, "SelectPaymentByOrderID");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllPaymentDataSet()");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(ds);
        }
示例#27
0
        public EmployeeCollection GetEmployeeDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager         dbm  = new DBManager();
            EmployeeCollection cols = new EmployeeCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);

                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectEmployeesDynamic");
                while (reader.Read())
                {
                    Employee employee = new Employee();
                    employee.EmployeeID = Int32.Parse(reader["EmployeeID"].ToString());
                    employee.FirstName  = reader["FirstName"].ToString();
                    employee.MiddleName = reader["MiddleName"].ToString();
                    employee.LastName   = reader["LastName"].ToString();
                    employee.Login      = reader["Login"].ToString();
                    employee.AddressID  = Int32.Parse(reader["AddressID"].ToString());
                    employee.WorkPhone  = reader["WorkPhone"].ToString();
                    employee.HomePhone  = reader["HomePhone"].ToString();
                    employee.CellPhone  = reader["CellPhone"].ToString();
                    //employee.FullName = reader["FullName"].ToString();
                    cols.Add(employee);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetEmployeeDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
示例#28
0
        public SpecialOfferCollection GetAllSpecialOffersDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager             dbm  = new DBManager();
            SpecialOfferCollection cols = new SpecialOfferCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSpecialOffersDynamic");
                while (reader.Read())
                {
                    SpecialOffer SO = new SpecialOffer();
                    SO.SpecialOfferID = Int32.Parse(reader["SpecialOfferID"].ToString());
                    SO.Description    = reader["Description"].ToString();
                    SO.Category       = reader["Category"].ToString();
                    SO.DiscountPct    = decimal.Parse(reader["DiscountPct"].ToString());
                    SO.EndDate        = DateTime.Parse(reader["EndDate"].ToString());
                    SO.MaxQty         = Int32.Parse(reader["MaxQty"].ToString());
                    SO.MinQty         = Int32.Parse(reader["MinQty"].ToString());
                    SO.StartDate      = DateTime.Parse(reader["StartDate"].ToString());
                    SO.Type           = reader["Type"].ToString();
                    SO.ModifiedDate   = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(SO);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSpecialOffersDynamicCollection");
                throw (ex);;
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
示例#29
0
        public PurchaseOrderHeader GetPurchaseOrderHeader(int purchaseOrderID)
        {
            IDBManager          dbm = new DBManager();
            PurchaseOrderHeader purchaseOrderHeader = new PurchaseOrderHeader();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@PurchaseOrderID", purchaseOrderID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectPurchaseOrderHeader");
                while (reader.Read())
                {
                    purchaseOrderHeader.PurchaseOrderID = Int32.Parse(reader["PurchaseOrderID"].ToString());
                    purchaseOrderHeader.RevisionNumber  = reader["RevisionNumber"].ToString();
                    purchaseOrderHeader.Status          = Byte.Parse(reader["Status"].ToString());
                    purchaseOrderHeader.EmployeeID      = Int32.Parse(reader["EmployeeID"].ToString());
                    purchaseOrderHeader.VendorID        = Int32.Parse(reader["VendorID"].ToString());
                    purchaseOrderHeader.ShipMethodID    = Int32.Parse(reader["ShipMethodID"].ToString());
                    purchaseOrderHeader.OrderDate       = DateTime.Parse(reader["OrderDate"].ToString());
                    purchaseOrderHeader.ShipDate        = DateTime.Parse(reader["ShipDate"].ToString());
                    purchaseOrderHeader.SubTotal        = Decimal.Parse(reader["SubTotal"].ToString());
                    purchaseOrderHeader.TaxAmt          = Decimal.Parse(reader["TaxAmt"].ToString());
                    purchaseOrderHeader.Freight         = Decimal.Parse(reader["Freight"].ToString());
                    purchaseOrderHeader.TotalDue        = Decimal.Parse(reader["TotalDue"].ToString());
                    purchaseOrderHeader.ModifiedDate    = DateTime.Parse(reader["ModifiedDate"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetPurchaseOrderHeader");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(purchaseOrderHeader);
        }
示例#30
0
        public PaymentCollection GetAllPaymentDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager        dbm  = new DBManager();
            PaymentCollection cols = new PaymentCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectPaymentsDynamic");
                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.CheckNumber  = reader["CheckNumber"].ToString();
                    PAY.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString());
                    cols.Add(PAY);
                }
            }

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