Example #1
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);
        }
        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);
        }
Example #3
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);
        }
        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);
        }
Example #5
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);
        }
Example #6
0
        public bool AddSpecialOfferProduct(SpecialOfferProduct SOP)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(3);
                dbm.AddParameters(0, "@SpecialOfferID", SOP.SpecialOfferID);
                dbm.AddParameters(1, "@ProductID", SOP.ProductID);
                dbm.AddParameters(2, "@ModifiedDate", DateTime.Now);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "InsertSpecialOfferProduct");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "InsertSpecialOfferProduct");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
Example #7
0
        public DataSet GetLocationDynamicDataSet(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            DataSet    ds  = new DataSet();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                ds = dbm.GetDataSet(CommandType.StoredProcedure, "SelectLocationsDynamic");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetLocationDynamicDataSet()");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(ds);
        }
Example #8
0
        public bool UpdateSalesTerritoryHistory(SalesTerritoryHistory STH)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(3);
                dbm.AddParameters(0, "@ID", STH.ID);
                dbm.AddParameters(1, "@EndDate", STH.EndDate);
                dbm.AddParameters(2, "@ModifiedDate", DateTime.Now);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "UpdateSalesTerritoryHistory");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "UpdateSalesTerritoryHistory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
Example #9
0
        public bool UpdateUser(User user)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(4);
                dbm.AddParameters(0, "@ID", user.ID);
                dbm.AddParameters(1, "@EmployeeID", user.EmployeeID);
                dbm.AddParameters(2, "@UserName", user.UserName);
                dbm.AddParameters(3, "@Password", user.Password);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "UpdateUser");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
Example #10
0
        public SalesInvoiceDetailCollection GetAllSalesInvoiceDetailsDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            SalesInvoiceDetailCollection cols = new SalesInvoiceDetailCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesInvoiceDetailsDynamic");
                while (reader.Read())
                {
                    SalesInvoiceDetail SID = new SalesInvoiceDetail();
                    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());
                    cols.Add(SID);
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllSalesInvoiceDetailsDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        public bool AddSalesPersonQuotaHistory(SalesPersonQuotaHistory SPQH)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(4);
                dbm.AddParameters(0, "@SalesPersonID", SPQH.SalesPersonID);
                dbm.AddParameters(1, "@QuotaDate", SPQH.QuotaDate);
                dbm.AddParameters(2, "@SalesQuota", SPQH.SalesQuota);
                dbm.AddParameters(3, "@ModifiedDate", DateTime.Now);
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "InsertSalesPersonQuotaHistory");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "InsertSalesPersonQuotaHistory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
Example #12
0
        public PurchaseInvoiceDetailCollection GetAllPurchaseInvoiceDetailDynamicCollection(string whereExpression, string orderBy)
        {
            IDBManager dbm = new DBManager();
            PurchaseInvoiceDetailCollection cols = new PurchaseInvoiceDetailCollection();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@WhereCondition", whereExpression);
                dbm.AddParameters(1, "@OrderByExpression", orderBy);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectPurchaseInvoiceDetailsDynamic");
                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, "GetAllPurchaseInvoiceDetailDynamicCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
        public int AddPaymentMethod(PaymentMethod paymentMethod)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(2);
                dbm.AddParameters(0, "@Name", paymentMethod.Name);
                dbm.AddParameters(1, "@PaymentMethodID", paymentMethod.PaymentMethodID);
                dbm.Parameters[1].Direction = ParameterDirection.Output;
                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "InsertPaymentMethod");
                paymentMethod.PaymentMethodID = Int32.Parse(dbm.Parameters[1].Value.ToString());
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "AddPaymentMethod");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(paymentMethod.PaymentMethodID);
        }
Example #14
0
        public bool UpdateInventory(ProductInventory productInventory)
        {
            IDBManager dbm = new DBManager();

            try
            {
                dbm.CreateParameters(3);
                dbm.AddParameters(0, "@ProductID", productInventory.ProductID);
                dbm.AddParameters(1, "@Quantity", productInventory.Quantity);
                dbm.AddParameters(2, "@ModifiedDate", DateTime.Now);

                dbm.ExecuteNonQuery(CommandType.StoredProcedure, "UpdateInventory");
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "UpdateInventory");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(true);
        }
        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 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);
        }
Example #17
0
        public Customer GetCustomer(int customerID)
        {
            IDBManager dbm      = new DBManager();
            Customer   customer = new Customer();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@CustomerID", customerID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectCustomer");
                while (reader.Read())
                {
                    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.CustomerType     = reader["CustomerType"].ToString();
                    customer.CreditLimit      = Decimal.Parse(reader["CreditLimit"].ToString());
                    customer.DeliveryDay      = Int16.Parse(reader["DeliveryDay"].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());
                }
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetCustomer");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(customer);
        }
Example #18
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 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);
        }
Example #20
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);
        }
Example #21
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);
        }
Example #22
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);
        }
Example #23
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);
        }
        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);
        }
Example #25
0
        public PurchaseOrderDetailCollection GetAllPurchaseOrderDetailCollection(int purchaseOrderID)
        {
            IDBManager dbm = new DBManager();
            PurchaseOrderDetailCollection cols = new PurchaseOrderDetailCollection();

            try
            {
                dbm.CreateParameters(1);
                dbm.AddParameters(0, "@PurchaseOrderID", purchaseOrderID);
                IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectPurchaseOrderDetailByOrderID");
                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, "PurchaseOrderDetailCollection");
                throw (ex);
            }
            finally
            {
                dbm.Dispose();
            }
            return(cols);
        }
Example #26
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);
        }
Example #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);
        }
Example #28
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);
        }
Example #29
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);
        }
Example #30
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);
        }