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
} //Done private void GenerateBtn_Click(object sender, RoutedEventArgs e) { CountofRecipeItemData = 0; CountofRecipesData = 0; string UnitQty = ""; string Unit = ""; DataTable RecipeInfo = new DataTable(); if (Authenticated.IndexOf("GenertaeGenerate") == -1 && Authenticated.IndexOf("CheckAllGenerateBatch") == -1) { LogIn logIn = new LogIn(); logIn.ShowDialog(); } else { if (QtyofRecipetxt.Text == "") { MessageBox.Show("Please Enter Qty of Recipe"); return; } string Where = string.Format("Code={0}", valofRecipe); RecipeInfo = Classes.RetrieveData("UnitQty,Unit", Where, "Setup_Recipes"); UnitQty = RecipeInfo.Rows[0][0].ToString(); Unit = RecipeInfo.Rows[0][1].ToString(); 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); } } else { MessageBox.Show("Please Check The Value and The Qty of Items OR Recipes"); } UserControl us = new Food_Cost.GenerateBatch(); //Parent.Children.Clear(); //Parent.Children.Add(us); } } //Done Finall Function