Ejemplo n.º 1
0
        //private void button11_Click(object sender, EventArgs e)
        //{

        //}



        //Maintain Stock Mouse Right Click
        //Maintain Stock Mouse Right Click-------------------------------------------------------------------//


        //Maintain Stock Mouse Right Click
        //Maintain Stock Mouse Right Click-------------------------------------------------------------------//



        //Stock Management Click Event Handlers
        //
        //-----------------------------------------------------------------------//



        private void button1_Click(object sender, EventArgs e)
        {
            if (navButton == quoteBtn)
            {
                SalesAndOrdering sales = new SalesAndOrdering();
                sales.ShowDialog();
                //navigate(quoteBtn);
            }
            if (navButton == btnSuppliers11)
            {
                SupplierForm supplier = new SupplierForm();
                supplier.ShowDialog();
            }
            if (navButton == clientBtn)
            {
                frmAddCustomer customer = new frmAddCustomer();
                customer.ShowDialog();
            }
            if (navButton == supplierBtn)
            {
                frmAddCombo combo = new frmAddCombo();
                combo.ShowDialog();
            }

            if (navButton == jobOBtn)
            {
                Menu_And_Combo menu = new Menu_And_Combo();
                menu.ShowDialog();
            }
            if (navButton == inventoryBtn)
            {
                frmAdd_New_Stock_Item addStock = new frmAdd_New_Stock_Item();
                addStock.ShowDialog();
            }
            if (navButton == empBtn)
            {
                Add_Employee employee = new Add_Employee();
                employee.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        void myMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (navButton == btnMenu)
            {
                if (e.ClickedItem.Name.ToString() == "Deleted")
                {
                    Globals.menu.Hide();
                    if (dgvSupplier.Rows.Count != 0)
                    {
                        int id = Globals.MenuCombopassing;

                        Menu_Item deieteItem = db.Menu_Item.FirstOrDefault(c => c.Menu_Item_ID == id);

                        if (deieteItem != null)
                        {
                            db.Menu_Item.Remove(deieteItem);
                            db.SaveChanges();
                            MessageBox.Show("Stock item(" + deieteItem.Menu_Item_Name + ") deleted successfully");
                        }
                        else
                        {
                            MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                        }
                    }
                }
                else if (e.ClickedItem.Name.ToString() == "View")
                {
                    Globals.menu.Hide();
                    int       id   = Globals.MenuCombopassing;
                    Menu_Item item = db.Menu_Item.FirstOrDefault(c => c.Menu_Item_ID == id);
                    if (item != null)
                    {
                        frmMaintainMenuItem form = new frmMaintainMenuItem();
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                    }
                }
            }



            //Suppliers Right Cick Event handlers

            if (navButton == btnEmployees)
            {
                if (e.ClickedItem.Name.ToString() == "Deleted")
                {
                    Globals.menu.Hide();
                    if (dgvSupplier.Rows.Count != 0)
                    {
                        int id = Globals.Employeepassing;

                        Employee deieteItem = db.Employees.FirstOrDefault(c => c.Employee_ID == id);

                        if (deieteItem != null)
                        {
                            db.Employees.Remove(deieteItem);
                            db.SaveChanges();
                            MessageBox.Show("Stock item(" + deieteItem.Employee_Name + ") deleted successfully");
                        }
                        else
                        {
                            MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                        }
                    }
                }
                else if (e.ClickedItem.Name.ToString() == "View")
                {
                    Globals.menu.Hide();
                    int      id   = Globals.Employeepassing;
                    Employee item = db.Employees.FirstOrDefault(c => c.Employee_ID == id);
                    if (item != null)
                    {
                        Maintain_Employee form = new Maintain_Employee();
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                    }
                }
            }


            //Suppliers Right click Handlers

            if (navButton == btnSuppliers11)
            {
                if (e.ClickedItem.Name.ToString() == "Deleted")
                {
                    Globals.menu.Hide();
                    if (dgvSupplier.Rows.Count != 0)
                    {
                        int id = Globals.Supplierpassing;

                        Supplier deieteItem = db.Suppliers.FirstOrDefault(c => c.Supllier_ID == id);

                        if (deieteItem != null)
                        {
                            db.Suppliers.Remove(deieteItem);
                            db.SaveChanges();
                            MessageBox.Show("Stock item(" + deieteItem.Supplier_Name + ") deleted successfully");
                        }
                        else
                        {
                            MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                        }
                    }
                }
                else if (e.ClickedItem.Name.ToString() == "View")
                {
                    Globals.menu.Hide();
                    int      id   = Globals.Supplierpassing;
                    Supplier item = db.Suppliers.FirstOrDefault(c => c.Supllier_ID == id);
                    if (item != null)
                    {
                        SupplierForm form = new SupplierForm();
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                    }
                }
            }

            if (navButton == btnCombo)
            {
                if (e.ClickedItem.Name.ToString() == "Deleted")
                {
                    Globals.menu.Hide();
                    if (dgvSupplier.Rows.Count != 0)
                    {
                        int id = Globals.Combopassing;

                        Combo deieteItem = db.Comboes.FirstOrDefault(c => c.Combo_ID == id);

                        if (deieteItem != null)
                        {
                            db.Comboes.Remove(deieteItem);
                            db.SaveChanges();
                            MessageBox.Show("Stock item(" + deieteItem.Combo_Description + ") deleted successfully");
                        }
                        else
                        {
                            MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                        }
                    }
                }
                else if (e.ClickedItem.Name.ToString() == "View")
                {
                    Globals.menu.Hide();
                    int   id   = Globals.Combopassing;
                    Combo item = db.Comboes.FirstOrDefault(c => c.Combo_ID == id);
                    if (item != null)
                    {
                        frmMaintainCombo form = new frmMaintainCombo();
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                    }
                }
            }

            if (navButton == btnCombo)
            {
                if (e.ClickedItem.Name.ToString() == "Deleted")
                {
                    Globals.menu.Hide();
                    if (dgvSupplier.Rows.Count != 0)
                    {
                        int id = Globals.Combopassing;

                        Combo deieteItem = db.Comboes.FirstOrDefault(c => c.Combo_ID == id);

                        if (deieteItem != null)
                        {
                            db.Comboes.Remove(deieteItem);
                            db.SaveChanges();
                            MessageBox.Show("Stock item(" + deieteItem.Combo_Description + ") deleted successfully");
                        }
                        else
                        {
                            MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                        }
                    }
                }
                else if (e.ClickedItem.Name.ToString() == "View")
                {
                    Globals.menu.Hide();
                    int   id   = Globals.Combopassing;
                    Combo item = db.Comboes.FirstOrDefault(c => c.Combo_ID == id);
                    if (item != null)
                    {
                        frmMaintainCombo form = new frmMaintainCombo();
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                    }
                }
            }

            //Stock Management Click Event Handlers
            //
            //-----------------------------------------------------------------------------------------------------//
            if (e.ClickedItem.Name.ToString() == "View")
            {
                Globals.menu.Hide();

                int        id         = Globals.MStockpassing;
                Stock_Item itemEdited = db.Stock_Item.FirstOrDefault(c => c.Stock_ID == id);
                if (itemEdited != null)
                {
                    Maintain_Stock_Item myform = new Maintain_Stock_Item();
                    myform.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                }
            }

            else if (e.ClickedItem.Name.ToString() == "Check In")
            {
                Globals.menu.Hide();
                int        id         = Globals.MStockpassing;
                Stock_Item itemEdited = db.Stock_Item.FirstOrDefault(c => c.Stock_ID == id);
                if (itemEdited.Stock_Type_ID == 1)
                {
                    if (itemEdited != null)
                    {
                        Check_In_Stock_Item myform = new Check_In_Stock_Item();
                        myform.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                    }
                }
                else
                {
                    MessageBox.Show("Action not allowed in such stock item");
                }
            }

            else if (e.ClickedItem.Name.ToString() == "Check Out")
            {
                Globals.menu.Hide();
                int        id         = Globals.MStockpassing;
                Stock_Item itemEdited = db.Stock_Item.FirstOrDefault(c => c.Stock_ID == id);
                if (itemEdited.Stock_Type_ID == 1)
                {
                    if (itemEdited != null)
                    {
                        Check_Out_Stock_Item myform = new Check_Out_Stock_Item();
                        myform.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                    }
                }
                else
                {
                    MessageBox.Show("Action not allowed in such stock item");
                }
            }

            else if (e.ClickedItem.Name.ToString() == "Take")
            {
                Globals.menu.Hide();
                int        id         = Globals.MStockpassing;
                Stock_Item itemEdited = db.Stock_Item.FirstOrDefault(c => c.Stock_ID == id);
                if (itemEdited != null)
                {
                    Take_Stock_Item myform = new Take_Stock_Item();
                    myform.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                }
            }
            else if (e.ClickedItem.Name.ToString() == "Write Off")
            {
                Globals.menu.Hide();
                int        id         = Globals.MStockpassing;
                Stock_Item itemEdited = db.Stock_Item.FirstOrDefault(c => c.Stock_ID == id);
                if (itemEdited != null)
                {
                    Write_Off_stock_Item myform = new Write_Off_stock_Item();
                    myform.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Error:Stock item does not exist/No stock item selected,select a stock item");
                }
            }
        }