示例#1
0
        private void DeleteUnitBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("DeleteConvUnits") == -1 && Authenticated.IndexOf("CheckAllUnits") == -1)
            {
                LogIn logIn = new LogIn();
                logIn.ShowDialog();
            }
            else
            {
                try
                {
                    string where = "Code = " + TheCode_txt.Text;
                    Classes.DeleteRows(where, "Units_Conversion");
                }
                catch (Exception ex)
                { MessageBox.Show(ex.ToString()); }
                finally
                {
                    Classes.LogTable(Classes.MyComm.CommandText.ToString(), TheCode_txt.Text, "Units_Conversion", "Delete");
                    BtnRecipeUnit2.IsEnabled = false;
                    BtnRecipeUnit.IsEnabled  = false;
                    SaveUNitBtn.IsEnabled    = false;
                    UpdateUnitBtn.IsEnabled  = false;
                    DeleteUnitBtn.IsEnabled  = false;

                    RecipeUnit_DGV.DataContext = null;
                    LoadAllCOnv();
                    ClearUIFields();
                    MainUiFormat();
                }
                MessageBox.Show("Deleted Successfully");
            }
        }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();
            Classes.TheConnectionString();
            Classes.GetWS();
            Classes.GetDateFormate();
            Classes.GetDateTimeFormate();
            //DateTime DatetimeNow = new DateTime();
            //DatetimeNow = DateTime.Now;
            //if (DatetimeNow.Date > Convert.ToDateTime("11/1/2020"))
            //{
            //    MessageBox.Show("Please Check The Licence");
            //    System.Windows.Application.Current.Shutdown();
            //    return;
            //}
            Classes.UpdateDateFormat();
            Classes.Language();
            //Calculation.Calculate();
            NameofForm.Text = "Food Cost";
            //int num = (DateTime.Now.Hour* DateTime.Now.Day) +0x21;
            Classes.RetrieveTheYearAndMonth();
            //Check_Month();
            LogIn logIn = new LogIn();

            logIn.ShowDialog();
            if (logIn.CheckToLogin == false)
            {
                System.Windows.Application.Current.Shutdown();
            }
        }
示例#3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            LogIn logIn = new LogIn();

            logIn.Owner = this;
            logIn.ShowDialog();
        }
 public PurchaseOrder()
 {
     if (MainWindow.AuthenticationData.Count != 0)
     {
         if (MainWindow.AuthenticationData.ContainsKey("Purchase"))
         {
             Authenticated = MainWindow.AuthenticationData["Purchase"];
             if (Authenticated.Count == 0)
             {
                 MessageBox.Show("You Havent a Privilage to Open this Page");
                 LogIn logIn = new LogIn();
                 logIn.ShowDialog();
             }
             else
             {
                 InitializeComponent();
                 LoadTheMainRestaurant();
                 DateTime now = DateTime.Now;
                 MainUiFormat();
             }
         }
     }
     else
     {
         MessageBox.Show("You should Login First !");
         LogIn logIn = new LogIn();
         logIn.ShowDialog();
     }
 }   //Done
示例#5
0
 private void UpdateUnitBtn_Click(object sender, RoutedEventArgs e)
 {
     if (Authenticated.IndexOf("UpdateConvUnits") == -1 && Authenticated.IndexOf("CheckAllUnits") == -1)
     {
         LogIn logIn = new LogIn();
         logIn.ShowDialog();
     }
     else
     {
         try
         {
             string FiledSelection = "BaseUnit_ID,BaseUnit_Name,Value,SecondUnit_ID,SecondUnit_Name,Last_modifiled_Date";
             string Values         = string.Format("(select Code From Units where Name='{0}'),N'{0}','{1}',(select Code From Units where Name='{2}'),'{2}',GETDATE()", BaseUnit.Text, ConvUnit2.Text, Secondunit.Text);
             string Where          = "Code=" + TheCode_txt.Text;
             Classes.UpdateRow(FiledSelection, Values, Where, "Units_Conversion");
         }
         catch (Exception ex)
         { MessageBox.Show(ex.ToString()); }
         {
             RecipeUnit_DGV.DataContext = null;
             MessageBox.Show("Saved Sussesfully !");
             Classes.LogTable(Classes.MyComm.CommandText.ToString(), TheCode_txt.Text, "Units_Conversion", "Update");
             SaveUNitBtn.IsEnabled    = false;
             BtnRecipeUnit2.IsEnabled = false;
             BtnRecipeUnit.IsEnabled  = false;
             UpdateUnitBtn.IsEnabled  = false;
             LoadAllCOnv();
             BaseUnit.Text   = "";
             Secondunit.Text = "";
             ConvUnit2.Text  = "";
             ClearUIFields();
             MainUiFormat();
         }
     }
 }
示例#6
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("SaveUsersAuthentication") == -1 && Authenticated.IndexOf("CheckAllUsersAuthentication") == -1)
            {
                LogIn logIn = new LogIn();     logIn.ShowDialog();
            }
            else
            {
                if (UserClassIDtxt.Text == "")
                {
                    MessageBox.Show("Please enter ID Field");
                    return;
                }
                if (Nametxt.Text == "")
                {
                    MessageBox.Show("Please enter Name Field");
                    return;
                }

                try
                {
                    string FiledSelection = "UserClass_ID,Name,Active,CreateDate,User_ID,WS";
                    string Values         = string.Format("'{0}',N'{1}','{2}',GETDATE(),'{3}','{4}'", UserClassIDtxt.Text, Nametxt.Text, Active_chbx.IsChecked.ToString(), MainWindow.UserID, Classes.WS);
                    Classes.InsertRow("UserClass_tbl", FiledSelection, Values);
                }
                catch (Exception ex)
                { MessageBox.Show(ex.ToString()); }
                Classes.LogTable(Classes.MyComm.CommandText.ToString(), UserClassIDtxt.Text, "UserClass_tbl", "New");
                MainUIFormat();
                MessageBox.Show("Saved Successfully");
                LoadUserClasses();
            }
        }
示例#7
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("SaveUnits") == -1 && Authenticated.IndexOf("CheckAllUnits") == -1)
            {
                LogIn logIn = new LogIn();   logIn.ShowDialog();
            }
            else
            {
                if (Code_txt.Text == "")
                {
                    MessageBox.Show("Code Field Can't Be Empty");
                    return;
                }

                try
                {
                    string FiledSelection = "Code,Name,IsActive,Create_Date,User_ID,WS";
                    string Values         = string.Format("'{0}',N'{1}','{2}',GETDATE(),'{3}','{4}'", Code_txt.Text, Name_txt.Text, Active_chbx.IsChecked.ToString(), MainWindow.UserID, Classes.WS);
                    Classes.InsertRow("Units", FiledSelection, Values);
                }
                catch (Exception ex)
                { MessageBox.Show(ex.ToString()); }
                finally
                {
                    Classes.LogTable(Classes.MyComm.CommandText.ToString(), Code_txt.Text, "Units", "New");
                    MainUiFormat();
                    Unit_DGV.DataContext = null;
                    FillDGV();
                }
                MessageBox.Show("Saved Successfully");
            }
        }
示例#8
0
 public Transfer_Kitchens()
 {
     if (MainWindow.AuthenticationData.Count != 0)
     {
         if (MainWindow.AuthenticationData.ContainsKey("TransferKitchen"))
         {
             Authenticated = MainWindow.AuthenticationData["TransferKitchen"];
             if (Authenticated.Count == 0)
             {
                 MessageBox.Show("You Havent a Privilage to Open this Page");
                 LogIn logIn = new LogIn();
                 logIn.ShowDialog();
             }
             else
             {
                 InitializeComponent();
                 transfer_No.Text = Classes.InCrementTransactionSerial("Transfer_Kitchens", "Transfer_Serial");
             }
         }
     }
     else
     {
         MessageBox.Show("You should Login First !"); LogIn logIn = new LogIn(); logIn.ShowDialog();
     }
 }       //Done
示例#9
0
 private void SaveBtn_Click(object sender, RoutedEventArgs e)
 {
     if (Authenticated.IndexOf("SaveTheInventory") == -1 && Authenticated.IndexOf("CheckAllPhysicalInventory") == -1)
     {
         LogIn logIn = new LogIn();
         logIn.ShowDialog();
     }
     else
     {
         if (Serial_Inventory_NO.Text.Equals(""))
         {
             MessageBox.Show("First You should Enter The Serial !");
             return;
         }
         if (Inventory_NO.Text.Equals(""))
         {
             MessageBox.Show("First You should Enter The Manual Number !");
             return;
         }
         if (Typecbx.Text.Equals(""))
         {
             MessageBox.Show("First You should Choose The Type !");
             return;
         }
         if (InventoryDate.Text.Equals(""))
         {
             MessageBox.Show("First You should Choose The Date !");
             return;
         }
         SaveInfoANdData();
     }
 }          //Done
 public AdjacmentInventory()
 {
     if (MainWindow.AuthenticationData.Count != 0)
     {
         if (MainWindow.AuthenticationData.ContainsKey("AddjacmentItems"))
         {
             Authenticated = MainWindow.AuthenticationData["AddjacmentItems"];
             if (Authenticated.Count == 0)
             {
                 MessageBox.Show("You Havent a Privilage to Open this Page");
                 LogIn logIn = new LogIn();
                 logIn.ShowDialog();
             }
             else
             {
                 InitializeComponent();
                 LoadAllResturant();
             }
         }
     }
     else
     {
         MessageBox.Show(" You Should Logined First !"); LogIn logIn = new LogIn();   logIn.ShowDialog();
     }
 }           //Done
示例#11
0
 private void DeleteBtn_Click(object sender, RoutedEventArgs e)
 {
     if (Authenticated.IndexOf("DeleteUnits") == -1 && Authenticated.IndexOf("CheckAllUnits") == -1)
     {
         LogIn logIn = new LogIn();   logIn.ShowDialog();
     }
     else
     {
         try
         {
             string where = "Code = " + Code_txt.Text;
             Classes.DeleteRows(where, "Units");
         }
         catch (Exception ex)
         { MessageBox.Show(ex.ToString()); }
         finally
         {
             MainUiFormat();
             Classes.LogTable(Classes.MyComm.CommandText.ToString(), Code_txt.Text, "Units", "Delete");
             Unit_DGV.DataContext = null;
             FillDGV();
         }
         MessageBox.Show("Deleted Successfully");
     }
 }
示例#12
0
 public KitcheItemsn()
 {
     if (MainWindow.AuthenticationData.ContainsKey("KitchenItems"))
     {
         Authenticated = MainWindow.AuthenticationData["KitchenItems"];
         if (Authenticated.Count == 0)
         {
             MessageBox.Show("You Havent a Privilage to Open this Page");
             LogIn logIn = new LogIn();
             logIn.ShowDialog();
         }
         else
         {
             InitializeComponent();
             LoadAllOutlet();
             SaveBtn.IsEnabled = false;
             dt.Columns.Add("Code");
             dt.Columns.Add("Manual Code");
             dt.Columns.Add("Name");
             dt.Columns.Add("Name2");
             dt.Columns.Add("Shelf");
             dt.Columns.Add("Min Qty");
             dt.Columns.Add("Max Qty");
             dt.Columns.Add("Unit");
         }
     }
 }
示例#13
0
 private void SaveUNitBtn_Click(object sender, RoutedEventArgs e)
 {
     if (Authenticated.IndexOf("SaveConvUnits") == -1 && Authenticated.IndexOf("CheckAllUnits") == -1)
     {
         LogIn logIn = new LogIn();
         logIn.ShowDialog();
     }
     else
     {
         try
         {
             string FiledSelection = "Code,BaseUnit_ID,BaseUnit_Name,Value,SecondUnit_ID,SecondUnit_Name,Create_Date,User_ID,WS";
             string Values         = string.Format("'{5}',(select Code from Units where Name='{0}'),N'{0}','{1}',(select Code from Units where Name='{2}'),N'{2}',GETDATE(),'{3}','{4}'", BaseUnit.Text, ConvUnit2.Text, Secondunit.Text, MainWindow.UserID, Classes.WS, TheCode_txt.Text);
             Classes.InsertRow("Units_Conversion", FiledSelection, Values);
         }
         catch (Exception ex) { MessageBox.Show(ex.ToString()); }
         finally
         {
             MessageBox.Show("Saved Sussesfully !");
             RecipeUnit_DGV.DataContext = null;
             LoadAllCOnv();
             ClearUIFields();
             Classes.LogTable(Classes.MyComm.CommandText.ToString(), TheCode_txt.Text, "Units_Conversion", "New");
             SaveUNitBtn.IsEnabled    = false;
             BtnRecipeUnit2.IsEnabled = false;
             BtnRecipeUnit.IsEnabled  = false;
         }
     }
 }
示例#14
0
 public Users()
 {
     if (MainWindow.AuthenticationData.Count != 0)
     {
         if (MainWindow.AuthenticationData.ContainsKey("Users"))
         {
             Authenticated = MainWindow.AuthenticationData["Users"];
             if (Authenticated.Count == 0)
             {
                 MessageBox.Show("You Havent a Privilage to Open this Page");
                 LogIn logIn = new LogIn();
                 logIn.ShowDialog();
             }
             else
             {
                 InitializeComponent();
                 FillDGV();
                 MainUiFormat();
             }
         }
     }
     else
     {
         MessageBox.Show("You Should Logined First !");    LogIn logIn = new LogIn();   logIn.ShowDialog();
     }
 }
示例#15
0
 private void UpdateBtn_Click(object sender, RoutedEventArgs e)
 {
     if (Authenticated.IndexOf("UpdateUsers") == -1 && Authenticated.IndexOf("CheckAllUsers") == -1)
     {
         LogIn logIn = new LogIn();    logIn.ShowDialog();
     }
     else
     {
         try
         {
             string FiledSelection = "Name,UserName,Password,UserClass_ID,Mobile,Adress,Email,Active,ModifiedDate";
             string Values         = string.Format("N'{0}','{1}','{2}',(select UserClass_ID FROM UserClass_tbl Where Name='{3}'),'{4}',N'{5}','{6}','{7}',GETDATE()", Nametxt.Text, UserNametxt.Text, passwordtxt.Password, jobTitle.Text, phone.Text, Addresstxt.Text, Mailtxt.Text, Active_chbx.IsChecked.ToString());
             string Where          = "ID = " + userIDtxt.Text;
             Classes.UpdateRow(FiledSelection, Values, Where, "Users");
         }
         catch (Exception ex)
         { MessageBox.Show(ex.ToString()); }
         finally
         {
             MainUiFormat();
             Classes.LogTable(Classes.MyComm.CommandText.ToString(), userIDtxt.Text, "Users", "Update");
             UsersDGV.DataContext = null;
             FillDGV();
         }
         MessageBox.Show("Updated Successfully");
     }
 }
示例#16
0
 private void UpdateBtn_Click(object sender, RoutedEventArgs e)
 {
     if (Authenticated.IndexOf("UpdateUnits") == -1 && Authenticated.IndexOf("CheckAllUnits") == -1)
     {
         LogIn logIn = new LogIn();   logIn.ShowDialog();
     }
     else
     {
         try
         {
             string FiledSelection = "Name,IsActive,Last_modifiled_Date";
             string Values         = string.Format("N'{0}','{1}',GETDATE()", Name_txt.Text, Active_chbx.IsChecked);
             string Where          = "Code = " + Code_txt.Text;
             Classes.UpdateRow(FiledSelection, Values, Where, "Units");
         }
         catch (Exception ex)
         { MessageBox.Show(ex.ToString()); }
         finally
         {
             Classes.LogTable(Classes.MyComm.CommandText.ToString(), Code_txt.Text, "Units", "Update");
             MainUiFormat();
             Unit_DGV.DataContext = null;
             FillDGV();
         }
         MessageBox.Show("Updated Successfully");
     }
 }
示例#17
0
        private void GenerateBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("GenertaeGenerate") == -1 && Authenticated.IndexOf("CheckAllGenerateBatch") == -1)
            {
                LogIn logIn = new LogIn(); logIn.ShowDialog();
            }
            else
            {
                CountofRecipeItemData = 0;
                CountofRecipesData    = 0;
                if (QtyofRecipetxt.Text == "")
                {
                    MessageBox.Show("Please Enter Qty of Recipe");   return;
                }

                string        UnitQty = "";  string Unit = "";
                SqlConnection con    = new SqlConnection(Classes.DataConnString);
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand();

                try
                {
                    con.Open();
                    string s = "SELECT UnitQty,Unit FROM Setup_Recipes WHERE Code=" + valofRecipe;
                    cmd    = new SqlCommand(s, con);
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        UnitQty = reader["UnitQty"].ToString();
                        Unit    = reader["Unit"].ToString();
                    }
                }
                catch (Exception ex)
                { MessageBox.Show(ex.ToString()); }
                finally
                { con.Close(); }

                bool boolianCheck = ItsRecipe(valofRecipe, UnitQty, Unit);
                if (boolianCheck == true && ToFinishFunction == false)
                {
                    UpddateQty();
                    MessageBox.Show("Recipe Generated Succesfuly");
                }
                else if ((boolianCheck == false && ToFinishFunction == true) && isParent == false)
                {
                    MessageBoxResult result = MessageBox.Show("Can't Genertare this Recipe Because Item Can't Complete It , You wan't to Order ?", "Confirmation",
                                                              MessageBoxButton.OKCancel, MessageBoxImage.Warning);
                    if (result == MessageBoxResult.OK)
                    {
                        UserControl usc = new Food_Cost.OrderRequesation(valofStore, ValOfKitchen);
                        //Parent.Children.Clear();
                        //Parent.Children.Add(usc);
                    }
                }

                UserControl us = new Food_Cost.GenerateBatch();
                //Parent.Children.Clear();
                //Parent.Children.Add(us);
            }
        }           //Done
        private void DeleteSubBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("DeleteRecipeSubCatgoey") == -1 && Authenticated.IndexOf("CheckAllRecipeCategory") == -1)
            {
                LogIn logIn = new LogIn();
                logIn.ShowDialog();
            }
            else
            {
                SqlConnection con         = new SqlConnection(Classes.DataConnString);
                string        checkRecipe = "";
                try
                {
                    con.Open();
                    string     s   = "SELECT SubCategory_ID FROM Setup_Recipes Where SubCategory_ID=" + CodeSub_txt.Text;
                    SqlCommand cmd = new SqlCommand(s, con);
                    if (cmd.ExecuteScalar() != null)
                    {
                        checkRecipe = cmd.ExecuteScalar().ToString();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    con.Close();
                }

                if (checkRecipe != CodeSub_txt.Text)
                {
                    try
                    {
                        con.Open();
                        string     q   = "Delete Setup_RecipeSubCategories Where Code=" + CodeSub_txt.Text;
                        SqlCommand cmd = new SqlCommand(q, con);
                        cmd.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    finally
                    {
                        con.Close();
                        MainUiSubFormat();
                        FillSubDGV();
                    }
                    MessageBox.Show("Deleted Successfully");
                }
                else
                {
                    MessageBox.Show("Can't delete this Sub Category");
                    checkRecipe = "";
                }
            }
        }
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("SaveAddjacmentReasons") == -1 && Authenticated.IndexOf("CheckAllAddjacmentReasons") == -1)
            {
                LogIn logIn = new LogIn();
                logIn.ShowDialog();
            }
            else
            {
                if (Code_txt.Text != "1")
                {
                    if (Code_txt.Text == "")
                    {
                        MessageBox.Show("Code Field Can't Be Empty");
                        return;
                    }

                    for (int i = 0; i < ReasonsDGV.Items.Count; i++)
                    {
                        if (Code_txt.Text == ((DataRowView)ReasonsDGV.Items[i]).Row.ItemArray[0].ToString())
                        {
                            MessageBox.Show("This Code Is Not Avaliable");
                            return;
                        }
                    }

                    SqlConnection con = new SqlConnection(Classes.DataConnString);
                    try
                    {
                        con.Open();
                        string     s   = "insert into Setup_AdjacmentReasons_tbl(Code, Name, Name2, Active) values (" + Code_txt.Text + ",N'" + Name_txt.Text + "',N'" + Name2_txt.Text + "','" + Active_chbx.IsChecked + "')";
                        SqlCommand cmd = new SqlCommand(s, con);
                        cmd.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    finally
                    {
                        con.Close();
                        MainUiFormat();

                        ReasonsDGV.DataContext = null;
                        FillDGV();
                    }
                    MessageBox.Show("Saved Successfully");
                }
                else
                {
                    MessageBox.Show("You can't Update This Reason");
                }
            }
        }
示例#20
0
        }           //Done

        private void AddRecipeBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("AddRecipes") == -1 && Authenticated.IndexOf("CheckAllRecipes") == -1)
            {
                LogIn logIn = new LogIn();  logIn.ShowDialog();
            }
            else
            {
                AllRecipes allRecipes = new AllRecipes(this);    allRecipes.ShowDialog();
            }
        }       //Done
示例#21
0
 private void PackIcon_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (Authenticated.IndexOf("UsersAuth") == -1 && Authenticated.IndexOf("CheckAllUsers") == -1)
     {
         LogIn logIn = new LogIn();    logIn.ShowDialog();
     }
     else
     {
         UserAuth w = new UserAuth();
         w.ShowDialog();
     }
 }
示例#22
0
        }       //Done

        private void AddRecipeBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("AddItemTransferReasturant") == -1 && Authenticated.IndexOf("CheckAllTransferResturant") == -1)
            {
                LogIn logIn = new LogIn(); logIn.ShowDialog();
            }
            else
            {
                AllRecipes TheRecipes = new AllRecipes(this);
                TheRecipes.ShowDialog();
            }
        }
示例#23
0
        }       //Done Finall Function

        private void AddItemBtn_Click(object sender, RoutedEventArgs e)
        {
            //AllRecipesDGV.SelectedItem = null;
            if (Authenticated.IndexOf("AddItemRecipes") == -1 && Authenticated.IndexOf("CheckAllRecipes") == -1)
            {
                LogIn logIn = new LogIn(); logIn.ShowDialog();
            }
            else
            {
                Items items = new Items(this); items.ShowDialog();
            }
        }           //Done Finall Function
示例#24
0
        }           //Done

        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("AddItemTransferReasturant") == -1 && Authenticated.IndexOf("CheckAllTransferResturant") == -1)
            {
                LogIn logIn = new LogIn();    logIn.ShowDialog();
            }
            else
            {
                Items itemswindow = new Items(this);
                itemswindow.ShowDialog();
            }
        }           //Done
        }           //Done

        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("OrderPO") == -1 && Authenticated.IndexOf("CheckAllPO") == -1)
            {
                LogIn logIn = new LogIn(); logIn.ShowDialog();
            }
            else
            {
                if (!DoSomeChecks())
                {
                    return;
                }

                SqlConnection con  = new SqlConnection(Classes.DataConnString);
                SqlConnection con2 = new SqlConnection(Classes.DataConnString);

                try
                {
                    con2.Open();
                    string     s   = string.Format("select PO_Serial From PO WHere PO_Serial='{0}'", Serial_PO_NO.Text);
                    SqlCommand cmd = new SqlCommand(s, con2);
                    if (cmd.ExecuteScalar() == null)
                    {
                        try
                        {
                            Save_PO_Items(con);
                            Save_PO_Details(con);
                        }
                        catch { return; }
                    }
                    else
                    {
                        try
                        {
                            s   = string.Format("delete From PO_Items where PO_Serial='{0}'", Serial_PO_NO.Text);
                            cmd = new SqlCommand(s, con2);
                            cmd.ExecuteNonQuery();
                            try
                            {
                                Save_PO_Items(con);
                                Edit_PO_Details(con);
                            }
                            catch { return; }
                        }
                        catch { return; }
                    }
                }
                catch { }
                MainUiFormat();
                ClearFields();
                MessageBox.Show("Saved Successfully");
            }
        }               //Done
示例#26
0
        }           //Done

        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("SaveResturants") == -1 && Authenticated.IndexOf("CheckAllResturants") == -1)
            {
                LogIn logIn = new LogIn();  logIn.ShowDialog();
            }
            else
            {
                if (Code_txt.Text == "")
                {
                    MessageBox.Show("Code Field Can't Be Empty");
                    return;
                }
                for (int i = 0; i < Stores_DGV.Items.Count; i++)
                {
                    if (Code_txt.Text == ((DataRowView)Stores_DGV.Items[i]).Row.ItemArray[0].ToString())
                    {
                        MessageBox.Show("This Code Is Not Avaliable");
                        return;
                    }
                }
                if (IsMain.IsChecked == true)
                {
                    try
                    {
                        DataTable IsMain = Classes.RetrieveData("IsMain", "IsMain='True'", "Setup_Restaurant");
                        if (IsMain.Rows.Count != 0)
                        {
                            MessageBox.Show("Can't be More than Main Resturant !");
                            return;
                        }
                    }
                    catch { }
                }

                try
                {
                    string FiledSelection = "Code,Name,Name2,IsMain,IsActive,Create_Date,WS,UserID";
                    string values         = string.Format("'{0}', N'{1}', N'{2}', '{3}','{4}',{5},'{6}','{7}'", Code_txt.Text, Name_txt.Text, Name2_txt.Text, IsMain.IsChecked, Active_chbx.IsChecked, "GETDATE()", Classes.WS, MainWindow.UserID);
                    Classes.InsertRow("Setup_Restaurant", FiledSelection, values);
                }
                catch (Exception ex)
                { MessageBox.Show(ex.ToString()); }
                finally
                {
                    Classes.LogTable(Classes.MyComm.CommandText.ToString(), Code_txt.Text, "Setup_Restaurant", "New");
                    MainUiFormat();
                    Stores_DGV.DataContext = null;
                    FillDGV();
                }
                MessageBox.Show("Saved Successfully");
            }
        }           //Done
示例#27
0
        private void DeleteBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("DeleteKitchenItems") == -1 && Authenticated.IndexOf("CheckAllKitchenItems") == -1)
            {
                LogIn logIn = new LogIn();
                logIn.ShowDialog();
            }
            else
            {
                SqlConnection con = new SqlConnection(Classes.DataConnString);
                try
                {
                    con.Open();
                    string     H   = "SELECT Item_Code FROM Setup_RecipeItems WHere Item_Code='" + ValtoDelete + "'";
                    SqlCommand cmd = new SqlCommand(H, con);
                    if (cmd.ExecuteScalar() == null)
                    {
                        try
                        {
                            H   = "Delete Setup_KitchenItems Where ItemID=" + ValtoDelete + " And RestaurantID=" + ValOfResturant + " AND KitchenID=" + ValOfKitchen;
                            cmd = new SqlCommand(H, con);
                            cmd.ExecuteNonQuery();

                            //H = "Delete Items Where ItemID=" + ValtoDelete + " And RestaurantID=" + ValOfResturant + " AND KitchenID=" + ValOfKitchen;
                            //cmd = new SqlCommand(H, con);
                            //cmd.ExecuteNonQuery();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                        finally
                        {
                            LoadDatatoGrid();
                            MessageBox.Show("Items are deleteed  ");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Can't Delete this Item");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
            }
        } //el mafrood ntcheck lw el item da m4 equal 0 yb2a can not delete
示例#28
0
        }       //DOne

        private void RemoveItemBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("DeleteAddjacment") == -1 && Authenticated.IndexOf("CheckAllAddjacment") == -1)
            {
                LogIn logIn = new LogIn(); logIn.ShowDialog();
            }
            else
            {
                DataTable ToDelete = ItemsDGV.DataContext as DataTable;
                ToDelete.Rows.RemoveAt(ItemsDGV.SelectedIndex);
                ItemsDGV.DataContext = ToDelete;
            }
        }       //Done
        }  //Done

        private void TheInventoryDetails_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("StartTheInventory") == -1 && Authenticated.IndexOf("CheckAllPhysicalInventory") == -1)
            {
                LogIn logIn = new LogIn();
                logIn.ShowDialog();
            }
            else
            {
                SqlConnection con = new SqlConnection(Classes.DataConnString);
                try
                {
                    con.Open();
                    string     s   = string.Format("select Inventory_ID,Inventory_Type From PhysicalInventory_tbl where Inventory_Type='Open'");
                    SqlCommand cmd = new SqlCommand(s, con);
                    if (cmd.ExecuteScalar() != null)
                    {
                        MessageBoxResult result = MessageBox.Show("You Hve an Opened Physical Inventory , You wan't to Open It ?", "Confirmation",
                                                                  MessageBoxButton.OKCancel, MessageBoxImage.Warning);
                        if (result == MessageBoxResult.OK)
                        {
                            string W = string.Format("select Top(1)Inventory_ID From PhysicalInventory_tbl ORDER BY Inventory_ID DESC");
                            cmd = new SqlCommand(W, con);
                            StartInventory();
                            LoadOpenPhysicalInventory(cmd.ExecuteScalar().ToString());
                        }
                    }
                    else
                    {
                        if (Outletcbx.Text.Equals(""))
                        {
                            MessageBox.Show("you Shoud Choose The Resturant first !");
                            return;
                        }
                        else if (Kitchencbx.Text.Equals(""))
                        {
                            MessageBox.Show("you Shoud Choose The Kitchen first !");
                            return;
                        }
                        DeleteDataAtQtyOnHand();
                        GetCodeofResturantAndKitchen();
                        InsertToONHandTable();
                        StartInventory();
                        GetInventoryID();
                        LoadAllItems();
                    }
                }
                catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                con.Close();
            }
        }   //Done
        }   //Done

        private void AddItemBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("AddItemAddjacment") == -1 && Authenticated.IndexOf("CheckAllAddjacment") == -1)
            {
                LogIn logIn = new LogIn();  logIn.ShowDialog();
            }
            else
            {
                ValOfResturant = ValOfResturant;
                ValOfKitchen   = ValOfKitchen;
                Items itemswindow = new Items(this);
                itemswindow.ShowDialog();
            }
        }       //Done