Пример #1
0
        private void btnItemcategories_Click(object sender, EventArgs e)
        {
            ItemCategories ic = ItemCategories.getInstance();

            this.Hide();
            ic.Show();
        }
Пример #2
0
 public static ItemCategories getInstance()
 {
     if (uniqueInstance == null)
     {
         uniqueInstance = new ItemCategories();
     }
     return(uniqueInstance);
 }
Пример #3
0
        private void btnSave_ItemCategory_Click(object sender, EventArgs e)
        {
            if (validateFormDetails())
            {
                itemCategory.itemCategoryID = txtItemCategoryID.Text;
                itemCategory.categoryName   = txtItemCategoryName.Text;
                itemCategory.description    = txtItemCategoryDescription.Text;


                using (DBEntities db = new DBEntities())
                {
                    if (status == "insert")
                    {
                        db.ItemCategories.Add(itemCategory);

                        MessageBox.Show("Category Added Successfully");
                    }
                    else if (status == "update")
                    {
                        //updating the database
                        db.Entry(itemCategory).State = EntityState.Modified;

                        MessageBox.Show("Category Updated Successfully");
                    }

                    db.SaveChanges();
                    clearTexts();
                }

                //addding new Item to the Restaurant POS as a button
                KitchenPOS.getInstance().loadCategoryButtons();

                ///-------clear the flow layout and re load the category list
                ItemCategories itemcategories = ItemCategories.getInstance();
                itemcategories.clearCatgoryList();
                itemcategories.loadItemCatrgories();
                itemcategories.Show();
                this.Hide();
            } //end of if
        }     //end  of save S