Пример #1
0
        public bool SellProductBL(SellBO objSellBO)
        {
            SellDA objSellDA = new SellDA();
            int    ProductID = objSellDA.GetProductID(objSellBO.ProductName);

            TypeDA objTypeDA    = new TypeDA();
            int    OldTypeCount = objTypeDA.GetOldTypeCount(objSellBO.TypeName, ProductID);

            Constants.RemainingProduct = OldTypeCount;
            if (OldTypeCount < objSellBO.ProductCount)
            {
                return(false);
            }
            int NewTypeCount = OldTypeCount - objSellBO.ProductCount;

            objTypeDA.DecreaseFromStock(objSellBO.TypeName, ProductID, NewTypeCount);

            decimal Price = objSellDA.GetPriceOfProduct(objSellBO, ProductID);

            objSellBO.ProductPrice = Price * objSellBO.ProductCount;
            objSellDA.SellProductDA(objSellBO);

            decimal oldLoan = objSellDA.GetOldLoan(objSellBO);
            decimal newLoan = oldLoan + objSellBO.ProductPrice;

            objSellDA.AddLoanDA(objSellBO, newLoan);

            return(true);
        }
Пример #2
0
        public decimal CalculatePriceBL(SellBO objSellBO)
        {
            SellDA  objSellDA = new SellDA();
            int     ProductID = objSellDA.GetProductID(objSellBO.ProductName);
            decimal Price     = objSellDA.GetPriceOfProduct(objSellBO, ProductID);

            objSellBO.ProductPrice = Price * objSellBO.ProductCount;
            return(objSellBO.ProductPrice);
        }
Пример #3
0
        public void DeleteTypeBL(string ProductName, string TypeName)
        {
            TypeDA objTypeDA = new TypeDA();
            SellDA objSellDA = new SellDA();

            int ProductID = objSellDA.GetProductID(ProductName);

            objTypeDA.DeleteTypeBL(ProductID, TypeName);
        }
        public void DeleteProductBL(string ProductName)
        {
            SellDA    objSellDA    = new SellDA();
            ProductDA objProductDA = new ProductDA();
            TypeDA    objTypeDA    = new TypeDA();
            int       ProductID    = objSellDA.GetProductID(ProductName);

            objProductDA.DeleteProductBL(ProductName);
            objTypeDA.DeleteTypeBL(ProductID);
        }
Пример #5
0
        public DataSet PopulateGridViewCustomerHistoryBL()
        {
            SellDA  objSellDA = new SellDA();
            DataSet ds        = objSellDA.PopulateGridViewCustomerHistoryDA();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                decimal dec    = Convert.ToDecimal(ds.Tables[0].Rows[i][4]);
                string  decStr = dec.ToString("0.##");
                ds.Tables[0].Rows[i].SetField(4, decStr);
                ds.AcceptChanges();
            }
            return(ds);
        }
Пример #6
0
        public bool PayLoanDA(SellBO objSellBO, decimal payment)
        {
            SellDA     objSellDA     = new SellDA();
            CostumerDA objCostumerDA = new CostumerDA();
            decimal    oldLoan       = objSellDA.GetOldLoan(objSellBO);
            decimal    newLoan       = 0;

            if (oldLoan < payment)
            {
                return(false);
            }
            else
            {
                newLoan = oldLoan - payment;
                objCostumerDA.PayLoanDA(objSellBO, newLoan);
                return(true);
            }
        }
Пример #7
0
        public decimal GetTotalLoanBL()
        {
            SellDA objSellDA = new SellDA();

            return(objSellDA.GetTotalLoanDA());
        }
Пример #8
0
        public void ClearSellHistoryBL()
        {
            SellDA objSellDA = new SellDA();

            objSellDA.ClearSellHistoryDA();
        }
        public int GetProductID(string ProductName)
        {
            SellDA objSellDA = new SellDA();

            return(objSellDA.GetProductID(ProductName));
        }