예제 #1
0
        }//end of edit Food details method

        private void btnBack_Click(object sender, EventArgs e)
        {
            StockManagement sm = StockManagement.getInstance();

            this.Hide();
            sm.Show();
        }
예제 #2
0
        private void btndeleteItemCard_Click(object sender, EventArgs e)
        {
            String cardID = this.itemID; //getting the cliked card id

            StockManagement stockmanagement = StockManagement.getInstance();

            stockmanagement.deleteFood(cardID); //passing the Id
        }
예제 #3
0
 public static StockManagement getInstance()
 {
     if (uniqueInstance == null)
     {
         uniqueInstance = new StockManagement();
     }
     return(uniqueInstance);
 }
예제 #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            itemRow.itemID            = txtItemID.Text;
            itemRow.name              = txtItemName.Text;
            itemRow.limitQuantity     = Int32.Parse(txtLimit.Text);
            itemRow.unitOfMeasurement = txtUnitOfMesasure.Text; //#########


            double purchasePrice;
            bool   res1 = Double.TryParse(txtPurchacePrice.Text, out purchasePrice);

            if (res1 == false)
            {
                MessageBox.Show("please Fill the purchase price");
            }
            else
            {
                itemRow.purchase_price = (float)purchasePrice;
            }

            itemRow.suppliedBy = "ss";

            itemRow.unitOfMeasurement = txtUnitOfMesasure.Text;
            //setting category id
            String cid = Util.getCategoryID("ItemCategory", comboItemcategories.Text);

            MessageBox.Show(cid);
            itemRow.categoryID = cid;

            itemRow.image = Util.convertImageToBinary(picBocitempic.Image);

            using (DBEntities db = new DBEntities())
            {
                if (operation == "insert")
                {
                    db.Items.Add(itemRow);
                    MessageBox.Show("Item Added Successfully");
                }
                else if (operation == "update")
                {
                    db.Entry(itemRow).State = EntityState.Modified;
                    MessageBox.Show("Item details Updated Successfully");
                }

                db.SaveChanges();
            }

            StockManagement sm = StockManagement.getInstance();

            sm.clearItemList();
            sm.loadKitchenItems();
            this.Hide();
            sm.Show();
        }//end of save method