Beispiel #1
0
        private void itemNamecomboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToInt32(itemNamecomboBox.SelectedValue) > 0)
                {
                    InventoryItem aItem = new InventoryItem();
                    aItem = (InventoryItem)itemNamecomboBox.SelectedItem;
                    unittypelabel.Text = aItem.UnitName;

                    string transactiontype = transactionTypecomboBox.SelectedItem.ToString();
                    if (transactiontype == "Send_to_Kitchen" || transactiontype == "Damage_in_Stock")
                    {
                        if (transactiontype == "Damage_in_Stock")
                        {
                            ShowDamageField();
                        }
                        else if (transactiontype == "Send_to_Kitchen")
                        {
                            HideDamageField();
                        }
                        aItem = (InventoryItem)itemNamecomboBox.SelectedItem;
                        Stock    aStock    = new Stock();
                        StockBLL aStockBll = new StockBLL();
                        aStock             = aStockBll.GetStockByItemid(aItem.ItemId);
                        stocklabel.Visible = true;
                        stocklabel.Text    = "Now Current Stocks are " + aStock.Stocks + " " + unittypelabel.Text;
                    }

                    if (transactiontype == "Return_from_Kitchen" || transactiontype == "Damage_in_kitchen" || transactiontype == "Stock In")
                    {
                        if (transactiontype == "Damage_in_kitchen")
                        {
                            ShowDamageField();
                        }
                        else if (transactiontype == "Return_from_Kitchen")
                        {
                            HideDamageField();
                        }

                        else if (transactiontype == "Stock In")
                        {
                            HideDamageField();
                        }
                        aItem = (InventoryItem)itemNamecomboBox.SelectedItem;
                        Stock    aStock    = new Stock();
                        StockBLL aStockBll = new StockBLL();
                        aStock             = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem);
                        stocklabel.Visible = true;
                        stocklabel.Text    = "Now Current Kitchen Stocks are " + aStock.Stocks + " " + unittypelabel.Text;
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #2
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");
                }
            }
        }