Example #1
0
 private void Inventory_Click(object sender, RoutedEventArgs e)
 {
     if (Authenticated.IndexOf("InventoryPhysicalInventory") == -1 && Authenticated.IndexOf("CheckAllPhysicalInventory") == -1)
     {
         LogIn logIn = new LogIn();
         logIn.ShowDialog();
     }
     else
     {
         SaveInfoANdData();
         UserControl usc = new Food_Cost.AdjacmentInventory(ValOfResturant, ValOfKitchen, Serial_Inventory_NO.Text);
         TheMainGrid.Children.Clear();
         TheMainGrid.Children.Add(usc);
     }
 }
        private void Inventory_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("InventoryPhysicalInventory") == -1 && Authenticated.IndexOf("CheckAllPhysicalInventory") == -1)
            {
                LogIn logIn = new LogIn();
                logIn.ShowDialog();
            }
            else
            {
                SaveInfoANdData();
                UserControl usc = new Food_Cost.AdjacmentInventory(ValOfResturant, ValOfKitchen, Serial_Inventory_NO.Text);
                TheMainGrid.Children.Clear();
                TheMainGrid.Children.Add(usc);


                /* 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;
                 * }
                 *
                 * SqlConnection con = new SqlConnection(connString);
                 * if (NotBlindChx.IsChecked == false)
                 * {
                 *   try
                 *   {
                 *       con.Open();
                 *       for (int i = 0; i < ItemsDGV.Items.Count; i++)
                 *       {
                 *           string s = "Insert into PhysicalInventory_Items(Inventory_ID,Item_ID,Qty,InventoryQty,Variance,Cost) Values ( " + Serial_Inventory_NO.Text + ",'" + (((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[0]) + "'," + Convert.ToDouble(((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[3]) + "," + Convert.ToDouble(((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[4]) + "," + Convert.ToDouble(((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[5]) + "," + Convert.ToDouble(((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[6]) + ")";
                 *           SqlCommand cmd = new SqlCommand(s, con);
                 *           cmd.ExecuteNonQuery();
                 *       }
                 *   }
                 *   catch (Exception ex)
                 *   {
                 *       MessageBox.Show(ex.ToString());
                 *   }
                 *   finally
                 *   {
                 *       con.Close();
                 *   }
                 *
                 * }
                 * else if (NotBlindChx.IsChecked == true)
                 * {
                 *   try
                 *   {
                 *       con.Open();
                 *       for (int i = 0; i < ItemsDGV.Items.Count; i++)
                 *       {
                 *           string s = "Insert into PhysicalInventory_Items(Inventory_ID,Item_ID,Qty,Cost) Values ( " + Serial_Inventory_NO.Text + ",'" + (((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[0]) + "'," + Convert.ToDouble(((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[3]) + "," + Convert.ToDouble(((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[4]) + "," + (((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[5]).ToString() + ")";
                 *           SqlCommand cmd = new SqlCommand(s, con);
                 *           cmd.ExecuteNonQuery();
                 *       }
                 *   }
                 *   catch (Exception ex)
                 *   {
                 *       MessageBox.Show(ex.ToString());
                 *   }
                 *   finally
                 *   {
                 *       con.Close();
                 *   }
                 *
                 *
                 * }
                 * try
                 * {
                 *   con.Open();
                 *   string s = string.Format("insert into PhysicalInventory_tbl(Inventory_ID,Inventory_Num,Inventory_Type,Inventory_Date,Comment,Resturant_ID,KitchenID,Post_Date,UserID,Blind) values({0},{1},'{2}',{3},'{4}',{5},'{6}',GETDATE(),{7},{8})", Serial_Inventory_NO.Text, Inventory_NO.Text, Typecbx.Text, InventoryDate.Text, commenttxt.Text, ValOfResturant, ValOfKitchen, MainWindow.UserID, NotBlindChx.IsChecked);
                 *   SqlCommand cmd = new SqlCommand(s, con);
                 *   cmd.ExecuteNonQuery();
                 * }
                 * catch (Exception ex)
                 * {
                 *   MessageBox.Show(ex.ToString());
                 * }
                 * finally
                 * {
                 *   con.Close();
                 * }
                 * }*/
            }
        }