示例#1
0
        private void TransactionWhenBusinessPackageIsActive()
        {
            InventoryItem aItem = new InventoryItem();

            aItem = (InventoryItem)itemNamecomboBox.SelectedItem;
            InventoryCategory aInventoryCategory = new InventoryCategory();

            aInventoryCategory = (InventoryCategory)categoryNamecomboBox.SelectedItem;


            Stock       aStock          = new Stock();
            StockBLL    aStockBll       = new StockBLL();
            string      transactiontype = transactionTypecomboBox.SelectedItem.ToString();
            Transaction aTransaction    = new Transaction();

            aTransaction.TransactionDate = DateTime.Now;
            aTransaction.Item            = aItem;
            aTransaction.Category        = aInventoryCategory;
            aTransaction.TransactionType = transactiontype;
            CUserInfo aUserInfo = new CUserInfo();

            aUserInfo.UserName    = RMSGlobal.LogInUserName;
            aTransaction.UserInfo = aUserInfo;
            string sr = string.Empty;


            if (transactiontype == "Stock In")
            {
                // aStock = aStockBll.GetStockByItemid(aItem.ItemId);

                if ((Convert.ToDouble(quantitytextBox.Text) != 0))
                {
                    aStock.Stocks      = Convert.ToDouble(quantitytextBox.Text);
                    aStock.Item        = aItem;
                    aStock.Category    = aInventoryCategory;
                    aTransaction.Stock = aStock;
                    TransactionBLL aBll = new TransactionBLL();
                    sr = aBll.SendToKitchen(aTransaction);
                    ShowAndClear(sr);
                }
                else
                {
                    MessageBox.Show("Your Quantity Must be Greater than 0 and  less than or equal to " + aStock.Stocks + " " + unittypelabel.Text);
                }
            }

            //aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem);


            if (transactiontype == "Damage_in_kitchen")
            {
                if (danmagetextBox.Text.Length > 0)
                {
                    aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem);

                    if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) &&
                        (Convert.ToDouble(quantitytextBox.Text) != 0))
                    {
                        aStock.Stocks             = Convert.ToDouble(quantitytextBox.Text);
                        aStock.Item               = aItem;
                        aStock.Category           = aInventoryCategory;
                        aTransaction.Stock        = aStock;
                        aTransaction.DamageReport = danmagetextBox.Text.Replace("'", "''");

                        TransactionBLL aBll = new TransactionBLL();
                        sr = aBll.DamageInKitchen(aTransaction);
                        ShowAndClear(sr);
                    }
                    else
                    {
                        MessageBox.Show("Your Quantity Must be Greater than 0 and  less than or equal to  " + aStock.Stocks + " " +
                                        unittypelabel.Text);
                    }
                }
                else
                {
                    MessageBox.Show("Please Check Your Damage Report Field It's Never Empty");
                }
            }
        }