Exemple #1
0
        public bool UpdateProduct(Product product)
        {
            if (product.Description == String.Empty || product.Description == null)
            {
                product.Description = product.Name;
            }
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(29);
                dbm.AddParameters(0, "@ProductID", product.ProductID);
                dbm.AddParameters(1, "@Name", product.Name);
                dbm.AddParameters(2, "@Description", product.Description);
                dbm.AddParameters(3, "@ProductNumber", product.ProductNumber);
                dbm.AddParameters(4, "@MakeFlag", product.MakeFlag);
                dbm.AddParameters(5, "@FinishedGoodsFlag", product.FinishedGoodsFlag);
                dbm.AddParameters(6, "@Color", product.Color);
                dbm.AddParameters(7, "@SafetyStockLevel", product.SafetyStockLevel);
                dbm.AddParameters(8, "@ReorderPoint", product.ReorderPoint);
                dbm.AddParameters(9, "@StandardCost", product.StandardCost);
                dbm.AddParameters(10, "@ListPrice", product.ListPrice);
                dbm.AddParameters(11, "@Size", product.Size);
                dbm.AddParameters(12, "@SizeUnitMeasureCode", product.SizeUnitMeasureCode);
                dbm.AddParameters(13, "@WeightUnitMeasureCode", product.WeightUnitMeasureCode);
                dbm.AddParameters(14, "@Weight", product.Weight);
                dbm.AddParameters(15, "@DaysToManufacture", product.DaysToManufacture);
                dbm.AddParameters(16, "@ProductLine", product.ProductLine);
                dbm.AddParameters(17, "@Class", product.Class);
                dbm.AddParameters(18, "@Style", product.Style);
                dbm.AddParameters(19, "@ProductSubcategoryID", product.ProductSubcategoryID);
                dbm.AddParameters(20, "@ProductModelID", product.ProductModelID);
                dbm.AddParameters(21, "@SellStartDate", product.SellStartDate);
                dbm.AddParameters(22, "@SellEndDate", product.SellEndDate);
                dbm.AddParameters(23, "@DiscontinuedDate", product.DiscontinuedDate);
                dbm.AddParameters(24, "@ModifiedDate", product.ModifiedDate);
                dbm.AddParameters(25, "@PrimaryVendorId", product.PrimaryVendorId);
                dbm.AddParameters(26, "@SecondaryVendorId", product.SecondaryVendorId);
                dbm.AddParameters(27, "@ActiveFlag", product.ActiveFlag);
                dbm.AddParameters(28, "@Comments", product.Comments);


                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "UpdateProduct");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "UpdateProduct");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
Exemple #2
0
        public SalesOrderDetailCollection GetAllSalesOrderDetailsDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            SalesOrderDetailCollection cols = new SalesOrderDetailCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesOrderDetailsDynamic");
                while (reader.Read())
                {
                    SalesOrderDetail SOD = new SalesOrderDetail();
                    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());
                    if (reader["SpecialOfferDesc"] != DBNull.Value)
                    {
                        SOD.SpecialOfferDesc = reader["SpecialOfferDesc"].ToString();
                    }
                    else
                    {
                        SOD.SpecialOfferDesc = "";
                    }
                    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());
                    SOD.ProductName       = reader["Name"].ToString();
                    SOD.Description       = reader["Description"].ToString();
                    cols.Add(SOD);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSalesOrderDetailsDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        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 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);
        }
        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);
        }
Exemple #7
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);
        }
Exemple #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);
        }
Exemple #10
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);
        }
Exemple #12
0
        public DataSet GetAllLocationDataSet()
        {
            IDBManager dbm = new DBManager();
            DataSet    ds  = new DataSet();

            try
            {
                ds = dbm.GetDataSet(CommandType.StoredProcedure, "SelectLocationsAll");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllLocationDataSet()");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(ds);
        }
Exemple #13
0
        public DataSet GetAllSalesTerritoryHistorysViewDataSet()
        {
            IDBManager dbm = new DBManager();
            DataSet    ds  = new DataSet();

            try
            {
                ds = dbm.GetDataSet(CommandType.StoredProcedure, "ViewSalesTerritoryList");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSalesTerritoryHistorysViewDataSet()");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(ds);
        }
        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);
        }
Exemple #15
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);
        }
Exemple #16
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);
        }
Exemple #17
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 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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
Exemple #23
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);
        }
Exemple #24
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);
        }
Exemple #25
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);
        }
Exemple #26
0
        public VendorCollection GetAllVendorsCollection()
        {
            IDBManager       dbm  = new DBManager();
            VendorCollection cols = new VendorCollection();

            try
            {
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectVendorsAll");
                while (reader.Read())
                {
                    Vendor vendor = new Vendor();
                    vendor.VendorID              = Int32.Parse(reader["VendorID"].ToString());
                    vendor.ActiveFlag            = Boolean.Parse(reader["ActiveFlag"].ToString());
                    vendor.ContactName           = reader["ContactName"].ToString();
                    vendor.AccountNumber         = reader["AccountNumber"].ToString();
                    vendor.CreditRating          = Byte.Parse(reader["CreditRating"].ToString());
                    vendor.PreferredVendorStatus = Boolean.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.AddressID    = Int32.Parse(reader["AddressID"].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, "GetAllVendorsCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Exemple #27
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);
        }
Exemple #28
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);
        }
Exemple #29
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);
        }
Exemple #30
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);
        }