Пример #1
0
        private void btnposSettingOK_Click(object sender, EventArgs e)
        {
            this.Hide();
            RestaurantPOS resPos = RestaurantPOS.getInstance();

            resPos.Show();
        }
Пример #2
0
        private void btnBackToPos_Click(object sender, EventArgs e)
        {
            RestaurantPOS respos = RestaurantPOS.getInstance();

            respos.Show();
            this.Hide();
        }
Пример #3
0
 public static RestaurantPOS getInstance()
 {
     if (uniqueInstance == null)
     {
         uniqueInstance = new RestaurantPOS();
     }
     return(uniqueInstance);
 }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (validateFormDetails())
            {
                //taking the user inputs and preparing the object
                foodCategory.foodCategoryID = txtCategoryID.Text;
                foodCategory.name           = txtCategoryName.Text;
                foodCategory.description    = txtCategoryDescription.Text;



                using (DBEntities db = new DBEntities())
                {
                    if (status == "insert")
                    {
                        db.FoodCategories.Add(foodCategory);

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

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

                    try
                    {
                        db.SaveChanges();
                    }
                    catch (System.Data.Entity.Validation.DbEntityValidationException ex)
                    {
                        foreach (var entityValidationErrors in ex.EntityValidationErrors)
                        {
                            foreach (var validationError in entityValidationErrors.ValidationErrors)
                            {
                                MessageBox.Show("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
                            }
                        }
                    }



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


                ///-------clear the flow layout and re load the category list
                Categories categories = Categories.getInstance();
                categories.clearCatgoryList();
                categories.loadFoodCategories();
                categories.Show();
                this.Hide();
            } //end of if
        }     // end of brnSave clicked event
Пример #5
0
        private void foodcategoryButton_MouseClick(object sender, MouseEventArgs e)
        {
            //when the button is clicked - need to get the category id of that name
            String foodCategoryBtnID = txtFCBtnCategoryID.Text;
            //MessageBox.Show(foodCategoryBtnID + " Buttton clicked");

            RestaurantPOS resPos = RestaurantPOS.getInstance();

            resPos.filterFoodCards(foodCategoryBtnID);
        }
Пример #6
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //getting user inputs
            entered_userName = txtUserName.Text;
            entered_password = txtPassword.Text;

            //getting the loginId respective to the credentions
            using (DBEntities db = new DBEntities())
            {
                //getting matching username Object
                user = db.UserLogins.Where(x => x.username == entered_userName && x.password == entered_password).ToList();
                int count = user.Count;  //counting the noOf Rows

                //validating the Login
                if (count == 1)
                {
                    MessageBox.Show("Login Successs!!!");

                    //extracting the login ID of the user
                    logged_loginId = user.First().loginID.ToString();

                    //filtering ...
                    if (logged_loginId.StartsWith("M") || logged_loginId.StartsWith("m"))
                    {
                        MessageBox.Show("Welcome Manager !!!");
                        //redirecting to Addmin Panel
                        AdminPanelForm adminPanel = AdminPanelForm.getInstance();
                        adminPanel.Show();
                        this.Hide();
                    }
                    else if (logged_loginId.StartsWith("HF") || logged_loginId.StartsWith("hf"))
                    {
                        MessageBox.Show("Welcome head Chef !!!");
                        KitchenPOS kitchenpos = KitchenPOS.getInstance();
                        kitchenpos.Show();
                        this.Hide();
                    }
                    else if (logged_loginId.StartsWith("R") || logged_loginId.StartsWith("r"))
                    {
                        MessageBox.Show("Welcome Receiptionist");
                        RestaurantPOS restaurantpos = RestaurantPOS.getInstance();
                        restaurantpos.Show();
                        this.Hide();
                    }
                }
                else if (count == 0)
                {
                    MessageBox.Show("Invalid Credentials!!!");
                }
                else
                {
                    MessageBox.Show("Error !!!");
                }
            }
        }
Пример #7
0
        private void posThemeSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            RestaurantPOS resPos = RestaurantPOS.getInstance();

            if (posThemeSelector.Text == "Light")
            {
                ApplyThemes(Color.Black, Color.Black);
                resPos.changeBackImage(0);
            }
            else if (posThemeSelector.Text == "Dark")
            {
                ApplyThemes(zColor(228, 63, 90), zColor(228, 63, 90));
                resPos.changeBackImage(1);
            }
        }
Пример #8
0
        private void ItemCategoryButton_Click(object sender, EventArgs e)
        {
            String        foodCategoryBtnID = txtICBtnCategoryID.Text;
            KitchenPOS    kpos = KitchenPOS.getInstance();
            RestaurantPOS rpos = RestaurantPOS.getInstance();

            if (ItemButtonID.StartsWith("KIc"))
            {
                kpos.filterFoodCards(foodCategoryBtnID);
            }
            else if (ItemButtonID.StartsWith("RPc"))
            {
                rpos.filterFoodCards(foodCategoryBtnID);
            }
        }