Esempio n. 1
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
Esempio n. 2
0
        }           //Done

        private void NewBtn_Click(object sender, RoutedEventArgs e)
        {
            ClearData();
            transfer_No.Text      = Classes.InCrementTransactionSerial("Transfer_Kitchens", "Transfer_Serial");
            MainGrid.IsEnabled    = true;
            TransferBtn.IsEnabled = true;
            NewBtn.IsEnabled      = false;
            DetailsView.IsEnabled = true;
            ItemsView.IsEnabled   = true;
            NewBtn.IsEnabled      = false;
            UndoBtn.IsEnabled     = true;

            TransferBtn.IsEnabled = true;
        }           //Done
 //Adjacment Coming from Physcial Inventory
 public AdjacmentInventory(string ValofRest, string valofKit, string valofOPhiID)
 {
     Authenticated = MainWindow.AuthenticationData["AddjacmentItems"];
     InitializeComponent();
     ValOfResturant              = ValofRest;   ValOfKitchen = valofKit;
     Adjact.Visibility           = Visibility.Visible;
     NumberOfItemText.Visibility = Visibility.Visible;
     TotalofItems.Visibility     = Visibility.Visible;
     NUmberOfItems.Visibility    = Visibility.Visible;
     Total_Price.Visibility      = Visibility.Visible;
     Adjact.IsEnabled            = true;
     adjacChose.Visibility       = Visibility.Hidden;
     AdjacInfo.Visibility        = Visibility.Visible;
     ItemsDGV.IsReadOnly         = true;
     Serial_Adjacment_NO.Text    = Classes.InCrementTransactionSerial("Adjacment_tbl", "Adjacment_ID");
     LoadPhysicalInventory(ValofRest, valofKit, valofOPhiID);
 }
        }       //Done

        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (Kitchencbx.SelectedItem != null)
            {
                ValOfKitchen                = Classes.RetrieveKitchenCode(Kitchencbx.SelectedItem.ToString(), Outletcbx.SelectedItem.ToString());
                Adjact.Visibility           = Visibility.Visible;
                NumberOfItemText.Visibility = Visibility.Visible;
                TotalofItems.Visibility     = Visibility.Visible;
                NUmberOfItems.Visibility    = Visibility.Visible;
                Total_Price.Visibility      = Visibility.Visible;
                Adjact.IsEnabled            = true;
                adjacChose.Visibility       = Visibility.Hidden;
                AdjacInfo.Visibility        = Visibility.Visible;
                addItemBtn.Visibility       = Visibility.Visible;
                RemoveItemBtn.Visibility    = Visibility.Visible;
                LoadAllReasons();
                Serial_Adjacment_NO.Text = Classes.InCrementTransactionSerial("Adjacment_tbl", "Adjacment_ID");
            }
        }       //Done
        }    //Done

        //events
        private void NewBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("NewPO") == -1 && Authenticated.IndexOf("CheckAllPO") == -1)
            {
                LogIn logIn = new LogIn();    logIn.ShowDialog();
            }
            else
            {
                EnableUI();
                ClearFields();
                Serial_PO_NO.Text         = Classes.InCrementTransactionSerial("PO", "PO_Serial");
                PO_NO.IsReadOnly          = false;
                commenttxt.IsReadOnly     = false;
                ItemsDGV.IsReadOnly       = false;
                CopyBtn.IsEnabled         = false;
                searchBtn.IsEnabled       = false;
                NewBtn.IsEnabled          = false;
                Total_Price_With_Tax.Text = "0";
            }
        }   //Done
        }           //Done

        private void CopyBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("CopyPO") == -1 && Authenticated.IndexOf("CheckAllPO") == -1)
            {
                MainWindow.UserID2             = MainWindow.UserID;
                MainWindow.AuthenticationData2 = MainWindow.AuthenticationData;
                LogIn logIn = new LogIn();
                logIn.ShowDialog();
            }
            else
            {
                EnableUI();
                Serial_PO_NO.Text = Classes.InCrementTransactionSerial("PO", "PO_Serial");
                PO_NO.Text        = "";
                NewBtn.IsEnabled  = false;
                CopyBtn.IsEnabled = false;
                if (MainWindow.AuthenticationData2.Count > 0)
                {
                    MainWindow.AuthenticationData = MainWindow.AuthenticationData2;
                    MainWindow.UserID             = MainWindow.UserID2;
                }
            }
        }           //Done
Esempio n. 7
0
        }       //Done

        private void NewBtn_Click(object sender, RoutedEventArgs e)
        {
            MainGrid.IsEnabled            = true;
            TransferBtn.IsEnabled         = true;
            NewBtn.IsEnabled              = false;
            transfer_No.Text              = Classes.InCrementTransactionSerial("Transfer_Kitchens", "Transfer_Serial");
            transfer_No.IsReadOnly        = true;
            Manual_transfer_No.IsReadOnly = false;
            Manual_transfer_No.IsEnabled  = true;
            Transfer_dt.IsEnabled         = true;
            Transfer_Time.IsEnabled       = true;
            commenttxt.IsReadOnly         = false;
            commenttxt.IsEnabled          = true;
            Resturant.IsReadOnly          = true;
            Resturant.IsEnabled           = true;
            Statustxt.IsEnabled           = true;
            Statustxt.IsReadOnly          = true;

            From_Kitchen.IsReadOnly = true;
            From_Kitchen.IsEnabled  = true;

            To_Kitchen.IsReadOnly = true;
            To_Kitchen.IsEnabled  = true;

            resturantBtn.IsEnabled   = true;
            FromKitchenBtn.IsEnabled = true;
            ToKitchenBtn.IsEnabled   = true;
            ItemsDGV.IsReadOnly      = false;
            AddItemsBtn.IsEnabled    = true;
            RemoveItemBtn.IsEnabled  = true;
            SearchBtn.IsEnabled      = true;
            NewBtn.IsEnabled         = false;
            UndoBtn.IsEnabled        = true;
            TransferBtn.IsEnabled    = true;
            ClearData();
            Transfer_dt.SelectedDate = DateTime.Now;
        }           //Done
Esempio n. 8
0
        private void BulkItemsBtn_Click(object sender, RoutedEventArgs e)
        {
            //Michael's Update
            if (Authenticated.IndexOf("DoProcessBulk") == -1 && Authenticated.IndexOf("CheckAllBulk") == -1)
            {
                LogIn logIn = new LogIn(); logIn.ShowDialog();
            }
            else
            {
                if (CheckToSave())
                {
                    try
                    {
                        string BulkItemID = "", BulkItemWeight = "", BulkItemCost = "", w = "";
                        BulkItemID     = ((DataRowView)ItemsDGV.SelectedItem).Row.ItemArray[0].ToString();
                        BulkItemWeight = ((DataRowView)ItemsDGV.SelectedItem).Row.ItemArray[3].ToString();
                        BulkItemCost   = ((DataRowView)ItemsDGV.SelectedItem).Row.ItemArray[5].ToString();
                        SqlConnection con = new SqlConnection(Classes.DataConnString);
                        SqlCommand    cmd = new SqlCommand();
                        DataTable     DT  = new DataTable();
                        DT = ItemsofBulkItemsDGV.DataContext as DataTable;
                        string ID = Classes.InCrementTransactionSerial("Process_BulkItems", "ProcessBulk_ID");
                        for (int i = 0; i < DT.Rows.Count; i++)
                        {
                            con.Open();
                            w   = string.Format("UPDATE Items set Qty=Qty+{0},Last_Cost=Current_Cost,Current_Cost=(((Qty*Current_Cost)+({0}*{4}))/(Qty+{0})) where ItemID='{1}' and RestaurantID={2} and KitchenID={3}", DT.Rows[i]["Weight"], DT.Rows[i]["Code"], CodeOfResturant, CodeOfKitchens, DT.Rows[i]["Cost"]);
                            cmd = new SqlCommand(w, con);
                            int n = cmd.ExecuteNonQuery();
                            if (n == 0)
                            {
                                w   = string.Format("insert into Items(RestaurantID,KitchenID,ItemID,Qty,Current_Cost,Net_Cost) values({0},{1},'{2}',{3},{4},{5})", CodeOfResturant, CodeOfKitchens, DT.Rows[i]["Code"], DT.Rows[i]["Weight"], DT.Rows[i]["Cost"], Convert.ToDouble(DT.Rows[i]["Cost"]) * Convert.ToDouble(DT.Rows[i]["Weight"]));
                                cmd = new SqlCommand(w, con);
                                cmd.ExecuteNonQuery();
                            }

                            w   = string.Format("Update ItemsYear set {0}={0}+{2},{1}=(({0}*{1})+({2}*{3})/({0}+{1})) where ItemID='{4}' and Restaurant_ID='{5}' and Kitchen_ID='{6}' and Year='{7}'", MainWindow.MonthQty, MainWindow.MonthCost, DT.Rows[i]["Weight"], DT.Rows[i]["Cost"], DT.Rows[i]["Code"], CodeOfResturant, CodeOfKitchens, MainWindow.CurrentYear);
                            cmd = new SqlCommand(w, con);
                            n   = cmd.ExecuteNonQuery();
                            if (n == 0)
                            {
                                w   = string.Format("insert into ItemsYear(ItemID,Restaurant_ID,Kitchen_ID,Year,{0},{1}) values('{2}','{3}','{4}','{5}',{6},{7})", MainWindow.MonthQty, MainWindow.MonthCost, DT.Rows[i]["Code"], CodeOfResturant, CodeOfKitchens, MainWindow.CurrentYear, DT.Rows[i]["Weight"], DT.Rows[i]["Cost"]);
                                cmd = new SqlCommand(w, con);
                                cmd.ExecuteNonQuery();
                            }

                            w   = string.Format("insert into Process_BulkItems_Items(ProcessBulk_ID,ParentItem_ID,ParentQty,ParentCost,ChiledItem_ID,ChiledQty,ChiledCost) values('{0}','{1}',{2},{3},'{4}',{5},{6})", ID, BulkItemID, BulkItemWeight, BulkItemCost, DT.Rows[i]["Code"], DT.Rows[i]["Weight"], DT.Rows[i]["Cost"]);
                            cmd = new SqlCommand(w, con);
                            cmd.ExecuteNonQuery();
                            con.Close();
                        }
                        con.Open();
                        w   = string.Format("update Items set Qty=0 where RestaurantID={0} and KitchenID={1} and ItemID='{2}' ", CodeOfResturant, CodeOfKitchens, BulkItemID);
                        cmd = new SqlCommand(w, con);
                        cmd.ExecuteNonQuery();

                        w   = string.Format("update ItemsYear set {0}={1} Where ItemID='{2}' and Restaurant_ID='{3}' and Kitchen_ID='{4}' and Year='{5}'", MainWindow.MonthQty, BulkItemWeight, BulkItemID, CodeOfResturant, CodeOfKitchens, MainWindow.CurrentYear);
                        cmd = new SqlCommand(w, con);
                        cmd.ExecuteNonQuery();

                        w   = string.Format("insert into Process_BulkItems(ProcessBulk_ID,Process_Date,User_ID,Resturant_ID,KitchenID,Post_Date) values('{0}',GETDATE(),'{1}',{2},{3},GETDATE())", ID, MainWindow.UserID, CodeOfResturant, CodeOfKitchens);
                        cmd = new SqlCommand(w, con);
                        cmd.ExecuteNonQuery();
                    }
                    catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                }
            }
        }           //Doen Finall Function
        public void UpddateQty()
        {
            string        valOfGenerate = "";
            SqlConnection con           = new SqlConnection(Classes.DataConnString);
            SqlCommand    cmd           = new SqlCommand();

            valOfGenerate = Classes.InCrementTransactionSerial("GenerateRecipe_tbl", "Generate_ID");
            try
            {
                con.Open();
                string s = string.Format("Insert into GenerateRecipe_tbl(Generate_ID,Generate_Date,Resturant_ID,Kitchen_ID,Recipe_ID,Qty,UserID,WS) Values ('{0}',GETDATE(),'{1}','{2}','{3}','{4}','{5}','{6}')", valOfGenerate, valofStore, ValOfKitchen, valofRecipe, QtyofRecipetxt.Text, MainWindow.UserID, Classes.WS);
                cmd = new SqlCommand(s, con);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
            finally { con.Close(); }


            try
            {
                con.Open();
                for (int i = 0; i < CountofRecipesData; i++)
                {
                    string s = string.Format("Update RecipeQty SEt Qty=Qty-{1} Where Recipe_ID='{0}' AND Resturant_ID={2} AND Kitchen_ID={3}", RecipesData[i, 0], Convert.ToDouble(RecipesData[i, 1]), valofStore, ValOfKitchen);
                    cmd = new SqlCommand(s, con);
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex) {  }
            finally { con.Close(); }

            double CostOfrecipe = 0;

            for (int i = 0; i < CountofRecipeItemData; i++)
            {
                CostOfrecipe += Convert.ToDouble(RecipeItemDData[i, 2]);
            }
            for (int i = 0; i < CountofRecipesData; i++)
            {
                CostOfrecipe += Convert.ToDouble(RecipesData[i, 2]);
            }
            try
            {
                con.Open();
                string s = "SELECT Recipe_ID FROM RecipeQty WHERE Recipe_ID=" + valofRecipe;
                cmd = new SqlCommand(s, con);
                if (cmd.ExecuteScalar() == null)
                {
                    s   = string.Format("INSERT INTO RecipeQty Values({0},{1},{2},{3},{4})", valofRecipe, Convert.ToDouble(QtyofRecipetxt.Text), valofStore, ValOfKitchen, CostOfrecipe / Convert.ToDouble(QtyofRecipetxt.Text));
                    cmd = new SqlCommand(s, con);
                    cmd.ExecuteNonQuery();
                }
                else
                {
                    s   = string.Format("Update RecipeQty SEt Qty=Qty+{1},Price=(((Qty*Price)+({1}*{4}))/Qty+{1}) Where Recipe_ID={0} AND Resturant_ID={2} AND Kitchen_ID={3}", valofRecipe, Convert.ToDouble(QtyofRecipetxt.Text), valofStore, ValOfKitchen, CostOfrecipe / Convert.ToDouble(QtyofRecipetxt.Text));
                    cmd = new SqlCommand(s, con);
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex) { }
            finally { con.Close(); }
            ////////////////////////
            try
            {
                con.Open();
                for (int i = 0; i < CountofRecipeItemData; i++)
                {
                    string s = string.Format("insert into GenerateRecipe_Items (Generate_ID,RecipeItem_ID,Type,Qty,Cost,Net_Cost,Current_Qty) values ('{0}','{1}','Item','{2}','{3}','{4}','{5}')", valOfGenerate, RecipeItemDData[i, 0], RecipeItemDData[i, 1], RecipeItemDData[i, 2], (Convert.ToDouble(RecipeItemDData[i, 1]) * Convert.ToDouble(RecipeItemDData[i, 2])), RecipeItemDData[i, 3]);
                    cmd = new SqlCommand(s, con);
                    cmd.ExecuteNonQuery();
                }
                for (int i = 0; i < CountofRecipesData; i++)
                {
                    string s = string.Format("insert into GenerateRecipe_Items (Generate_ID,RecipeItem_ID,Type,Qty,Cost,Net_Cost,Current_Qty) values ('{0}','{1}','Recipe','{2}','{3}','{4}','{5}')", valOfGenerate, RecipesData[i, 0], RecipesData[i, 1], RecipesData[i, 2], (Convert.ToDouble(RecipesData[i, 1]) * Convert.ToDouble(RecipesData[i, 2])), RecipesData[i, 3]);
                    cmd = new SqlCommand(s, con);
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
            finally { con.Close(); }

            try
            {
                con.Open();
                for (int i = 0; i < CountofRecipeItemData; i++)
                {
                    string w = string.Format("update Items set Qty=Qty-'{0}',Net_Cost=((Qty-'{0}')*Current_Cost) where RestaurantID='{1}' and KitchenID='{2}' and ItemID='{3}'", RecipeItemDData[i, 1], valofStore, ValOfKitchen, RecipeItemDData[i, 0]);
                    cmd = new SqlCommand(w, con);
                    cmd.ExecuteNonQuery();

                    w   = string.Format("update ItemsYear Set {0}={0}-{1} where ItemID='{2}' and Restaurant_ID='{3}' and Kitchen_ID='{4}' and Year='{5}'", MainWindow.MonthQty, RecipeItemDData[i, 1], RecipeItemDData[i, 0], valofStore, ValOfKitchen, MainWindow.CurrentYear);
                    cmd = new SqlCommand(w, con);
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
            finally { con.Close(); }
        }   //Done
        private void BulkItemsBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Authenticated.IndexOf("DoProcessBulk") == -1 && Authenticated.IndexOf("CheckAllBulk") == -1)
            {
                LogIn logIn = new LogIn(); logIn.ShowDialog();
            }
            else
            {
                string        ID = Classes.InCrementTransactionSerial("Process_BulkItems", "ProcessBulk_ID");
                string        BaseCode = ""; string BaseQty = ""; string SUBQty = ""; double BaseCost = 0; string BaseWeight = "";  double CalcQty = 0; double CalcCost = 0;
                SqlConnection con    = new SqlConnection(Classes.DataConnString);
                SqlCommand    cmd    = new SqlCommand();
                SqlConnection con2   = new SqlConnection(Classes.DataConnString);
                SqlCommand    cmd2   = new SqlCommand();
                SqlDataReader reader = null;
                for (int i = 0; i < ItemsDGV.Items.Count; i++)
                {
                    if (((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[0].ToString() == "True")
                    {
                        BaseCode   = ((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[1].ToString();
                        BaseQty    = ((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[4].ToString();
                        SUBQty     = BaseQty;
                        BaseCost   = Convert.ToDouble(((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[6].ToString());
                        BaseWeight = (Classes.RetrieveData("Weight", "Code=" + BaseCode, "Setup_Items")).Rows[0][0].ToString();
                        con.Open();
                        try
                        {
                            string s = string.Format("select * from Setup_BulkItems where Item_Code='{0}'", BaseCode);
                            cmd    = new SqlCommand(s, con);
                            reader = cmd.ExecuteReader();
                            while (reader.Read())
                            {
                                CalcQty  = (((Convert.ToDouble(reader["WeightPrecentage"]) / 100) * Convert.ToDouble(BaseQty)) / Convert.ToDouble(BaseWeight));
                                CalcCost = (((Convert.ToDouble(reader["CostPrecentage"]) / 100) * Convert.ToDouble(BaseCost)) / Convert.ToDouble(BaseWeight));
                                try
                                {
                                    con2.Open();
                                    string w = string.Format("UPDATE Items set Qty=Qty+{0},Last_Cost=Current_Cost,Current_Cost=(((Qty*Current_Cost)+({0}*{4}))/(Qty+{0})) where ItemID='{1}' and RestaurantID={2} and KitchenID={3}", CalcQty, reader["Code"], CodeOfResturant, CodeOfKitchens, CalcCost);
                                    cmd2 = new SqlCommand(w, con2);
                                    int n = cmd2.ExecuteNonQuery();
                                    if (n == 0)
                                    {
                                        w    = string.Format("insert into Items(RestaurantID,KitchenID,ItemID,Qty,Current_Cost,Net_Cost) values({0},{1},'{2}',{3},{4},{5})", CodeOfResturant, CodeOfKitchens, reader["Code"], CalcQty, CalcCost, CalcCost * CalcQty);
                                        cmd2 = new SqlCommand(w, con2);
                                        cmd2.ExecuteNonQuery();
                                    }

                                    w    = string.Format("Update ItemsYear set {0}={0}+{2},{1}=(({0}*{1})+({2}*{3})/({0}+{1})) where ItemID='{4}' and Restaurant_ID='{5}' and Kitchen_ID='{6}' and Year='{7}'", MainWindow.MonthQty, MainWindow.MonthCost, CalcQty, CalcCost, reader["Code"], CodeOfResturant, CodeOfKitchens, MainWindow.CurrentYear);
                                    cmd2 = new SqlCommand(w, con2);
                                    n    = cmd2.ExecuteNonQuery();
                                    if (n == 0)
                                    {
                                        w    = string.Format("insert into ItemsYear(ItemID,Restaurant_ID,Kitchen_ID,Year,{0},{1}) values('{2}','{3}','{4}','{5}',{6},{7})", MainWindow.MonthQty, MainWindow.MonthCost, reader["Code"], CodeOfResturant, CodeOfKitchens, MainWindow.CurrentYear, CalcQty, CalcCost);
                                        cmd2 = new SqlCommand(w, con2);
                                        cmd2.ExecuteNonQuery();
                                    }
                                }
                                catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                                SUBQty = (Convert.ToDouble(SUBQty) - CalcQty).ToString();

                                try
                                {
                                    string w = string.Format("insert into Process_BulkItems_Items(ProcessBulk_ID,ParentItem_ID,ParentQty,ParentCost,ChiledItem_ID,ChiledQty,ChiledCost) values('{0}','{1}',{2},{3},{4},{5},{6})", ID, BaseCode, ((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[4].ToString(), ((DataRowView)ItemsDGV.Items[i]).Row.ItemArray[6].ToString(), reader["Code"], BaseCost, BaseCost);
                                    cmd2 = new SqlCommand(w, con2);
                                    cmd2.ExecuteNonQuery();
                                }
                                catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                                con2.Close();
                            }
                            try
                            {
                                con2.Open();
                                string w = string.Format("update Items set Qty={0} where RestaurantID={1} and KitchenID={2} and ItemID='{3}' ", SUBQty, CodeOfResturant, CodeOfKitchens, BaseCode);
                                cmd2 = new SqlCommand(w, con2);
                                cmd2.ExecuteNonQuery();
                            }
                            catch (Exception ex) { MessageBox.Show(ex.ToString()); }

                            try
                            {
                                string w = string.Format("update ItemsYear set {0}={1} Where ItemID='{2}' and Restaurant_ID='{3}' and Kitchen_ID='{4}' and Year='{5}'", MainWindow.MonthQty, SUBQty, BaseCode, CodeOfResturant, CodeOfKitchens, MainWindow.CurrentYear);
                                cmd2 = new SqlCommand(w, con2);
                                cmd2.ExecuteNonQuery();
                            }
                            catch (Exception ex) { MessageBox.Show(ex.ToString()); }

                            try
                            {
                                string w = string.Format("insert into Process_BulkItems(ProcessBulk_ID,Process_Date,User_ID,Resturant_ID,KitchenID,Post_Date) values('{0}',GETDATE(),'{1}',{2},{3},GETDATE())", ID, MainWindow.UserID, CodeOfResturant, CodeOfKitchens);
                                cmd2 = new SqlCommand(w, con2);
                                cmd2.ExecuteNonQuery();
                            }
                            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                        }
                        catch (Exception ex)
                        { MessageBox.Show(ex.ToString()); }
                        con2.Close();
                    }
                }
                MessageBox.Show("Done");
            }
            BulkItems.IsEnabled = false;
        }