Exemple #1
0
        private void RowClicked(object sender, MouseButtonEventArgs e)
        {
            if (sender != null)
            {
                DataGrid data = sender as DataGrid;
                if (data != null && data.SelectedItems != null && data.SelectedItems.Count == 1)
                {
                    try
                    {
                        DataTable TheUserData    = new DataTable();
                        string    FiledSelection = "ID,Name,Password,UserName,(Select Name From UserClass_tbl where UserClass_tbl.UserClass_ID=Users.UserClass_ID) as Tital,Adress,Phone,Email,Active";
                        string    WhereFiltering = " where ID=" + ((DataRowView)UsersDGV.SelectedItem).Row.ItemArray[0];
                        TheUserData           = Classes.RetrieveData(FiledSelection, WhereFiltering, "Users");
                        userIDtxt.Text        = TheUserData.Rows[0][0].ToString();
                        Nametxt.Text          = TheUserData.Rows[0][1].ToString();
                        UserNametxt.Text      = TheUserData.Rows[0][3].ToString();
                        passwordtxt.Password  = TheUserData.Rows[0][2].ToString();
                        jobTitle.Text         = TheUserData.Rows[0][4].ToString();
                        phone.Text            = TheUserData.Rows[0][6].ToString();;
                        Addresstxt.Text       = TheUserData.Rows[0][5].ToString();
                        Mailtxt.Text          = TheUserData.Rows[0][7].ToString();
                        Active_chbx.IsChecked = Convert.ToBoolean(TheUserData.Rows[0][8].ToString());
                    }
                    catch { }

                    EnableUI();
                    userIDtxt.IsEnabled = false;
                    newBtn.IsEnabled    = false;
                    saveBtn.IsEnabled   = false;
                }
            }
        }
Exemple #2
0
 private void LoginBtn_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DataTable DTLogin        = new DataTable();
         string    WhereSelection = string.Format("UserName='******' and Password='******'", UserNametxt.Text, Passwordtxt.Password);
         DTLogin = Classes.RetrieveData("ID,Name,UserName,UserClass_ID,Password", WhereSelection, "Users");
         if (DTLogin.Rows[0].ItemArray[0].ToString() == MainWindow.UserID)
         {
             MessageBox.Show("You are Already Logined");
             this.Close();
             return;
         }
         else
         {
             MainWindow.UserName = DTLogin.Rows[0].ItemArray[1].ToString();
             MainWindow.JobID    = DTLogin.Rows[0].ItemArray[3].ToString();
             MainWindow.UserID   = DTLogin.Rows[0].ItemArray[0].ToString();
             //MainWindow.ThetLogin.Add(Convert.ToInt32(MainWindow.UserID));
             WhereSelection            = string.Format("UserClass_ID='{0}'", DTLogin.Rows[0].ItemArray[3].ToString());
             MainWindow.Authentication = Classes.RetrieveData("ClassPrv", WhereSelection, "UserPrivilages_tbl").Rows[0].ItemArray[0].ToString();
             MainWindow.AuthenticationData.Clear();
             SplitAuthentication();
             MessageBox.Show("Welcome " + DTLogin.Rows[0].ItemArray[1].ToString());
             this.Close();
             CheckToLogin = true;
         }
     }
     catch
     {
         MessageBox.Show("Please Enter the Correct User Name and Password ..!");
         CheckToLogin = false;
     }
 }
Exemple #3
0
        //Recipe Units
        private void LoadAllCOnv()
        {
            DataTable TheConvUnits = new DataTable();

            TheConvUnits = Classes.RetrieveData("Code,BaseUnit_Name as 'Base Unit',Value as Qty,SecondUnit_Name 'Second Unit'", "Units_Conversion");
            RecipeUnit_DGV.DataContext = TheConvUnits;
        }
Exemple #4
0
        //functions
        private void FillDGV()
        {
            DataTable TheRestaurant = new DataTable();

            TheRestaurant          = Classes.RetrieveData("Code,Name,Name2,IsMain as Main,IsActive as Active", "Setup_Restaurant");
            Stores_DGV.DataContext = TheRestaurant;
        }               //Done
Exemple #5
0
        //UNits
        private void FillDGV()
        {
            DataTable TheUnits = new DataTable();

            TheUnits             = Classes.RetrieveData("Code,Name,IsActive as Active", "Units");
            Unit_DGV.DataContext = TheUnits;
        }
        private void CreatedYear_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BtnEdit.IsEnabled = true;
            DataTable MonthsforYear = Classes.RetrieveData("*", "Year = '" + CBCreatedYears.SelectedItem + "'", "Setup_Fiscal_Period");

            if (MonthsforYear.Rows.Count != 0)
            {
                if (MonthsforYear.Rows[0]["Month Type"].ToString() == "Type2")
                {
                    Month13_StackPanel.Visibility = Visibility.Visible;
                }
                else
                {
                    Month13_StackPanel.Visibility = Visibility.Hidden;
                }
                Year.Text          = CBCreatedYears.SelectedItem.ToString();
                MonthType_cbx.Text = MonthsforYear.Rows[0]["Month Type"].ToString();

                SetStatus = new HashSet <string>();
                for (int i = 0; i < MonthsforYear.Rows.Count; i++)
                {
                    DatePicker From = FindName("from" + (i + 1)) as DatePicker;
                    DatePicker To   = FindName("to" + (i + 1)) as DatePicker;
                    From.Text = MonthsforYear.Rows[i]["From"].ToString();
                    To.Text   = MonthsforYear.Rows[i]["TO"].ToString();
                    SetStatus.Add(MonthsforYear.Rows[i]["isClosed"].ToString());
                }
            }
        }
        }               //Done

        private void LoadToDGVOfBulkItems(string code)
        {
            //Michael's Update
            ToTWeight = 0; ToTCost = 0;   string Where = "";
            DataTable BulkItems = new DataTable();   DataTable BulkItemsInfos = new DataTable();

            BulkItems      = ((DataTable)BulkItemsDGV.DataContext);
            Where          = string.Format("Code='{0}'", code);
            BulkItemsInfos = Classes.RetrieveData("Code,[Manual Code] as 'Manual Code',Name", Where, "Setup_Items");
            BulkItems.Rows.Add(BulkItemsInfos.Rows[0][0], BulkItemsInfos.Rows[0][1], BulkItemsInfos.Rows[0][2]);
            BulkItemsDGV.DataContext = BulkItems;
            if (BulkItemsDGV.Items.Count > 0)
            {
                for (int i = 0; i < BulkItemsDGV.Items.Count; i++)
                {
                    DataRowView ToTalItemm = BulkItemsDGV.Items[i] as DataRowView;
                    if (ToTalItemm.Row.ItemArray[3].ToString() != "")
                    {
                        ToTWeight += Convert.ToInt32(ToTalItemm.Row.ItemArray[3]);
                    }
                    if (ToTalItemm.Row.ItemArray[4].ToString() != "")
                    {
                        ToTCost += Convert.ToInt32(ToTalItemm.Row.ItemArray[4]);
                    }
                }
            }
            WaisWeightttxt.Text = ToTWeight.ToString();
            WaistCosttxt.Text   = ToTCost.ToString();
        }               //DOne
Exemple #8
0
        }           //Doen Finall Function

        private void LoadAllBulkItems()
        {
            string    Where = "";
            DataTable DT    = new DataTable();

            DT.Columns.Add("Code");
            DT.Columns.Add("Manual Code");
            DT.Columns.Add("Name");
            DT.Columns.Add("Qty");
            DT.Columns.Add("Unit");
            DT.Columns.Add("Cost");
            DataTable ItemQtyCost = new DataTable();
            DataTable ItemsInfo   = new DataTable();

            ItemsInfo = Classes.RetrieveData("Code,[Manual Code],Name,Unit,weight", "Is_BulkItem='true'", "Setup_Items");
            for (int i = 0; i < ItemsInfo.Rows.Count; i++)
            {
                Where       = string.Format("ItemID='{0}' and RestaurantID='{1}' and KitchenID='{2}'", ItemsInfo.Rows[i][0].ToString(), CodeOfResturant, CodeOfKitchens);
                ItemQtyCost = Classes.RetrieveData("Qty,Current_Cost", Where, "Items");
                if (ItemQtyCost.Rows.Count > 0)
                {
                    if (Convert.ToDouble(ItemQtyCost.Rows[0][0].ToString()) > 0 && Convert.ToDouble(ItemQtyCost.Rows[0][1].ToString()) > 0)
                    {
                        DT.Rows.Add(ItemsInfo.Rows[i][0], ItemsInfo.Rows[i][1], ItemsInfo.Rows[i][2], (Convert.ToDouble(ItemQtyCost.Rows[0][0]) * Convert.ToDouble(ItemsInfo.Rows[i][4])), ItemsInfo.Rows[i][3], ItemQtyCost.Rows[0][1]);
                    }
                }
            }
            for (int i = 0; i < ItemsInfo.Columns.Count; i++)
            {
                DT.Columns[i].ReadOnly = true;
            }
            ItemsDGV.DataContext = DT;
        }           //Doen Finall Function
Exemple #9
0
        public void LoadAllCategories()
        {
            DataTable AllCat = new DataTable();

            AllCat = Classes.RetrieveData("Code,Name,IsActive as Active", "IsActive = 'True'", "Setup_RecipeCategory");
            CategoryDGV.DataContext = AllCat;
        }
Exemple #10
0
        //public void LoadUnits()
        //{
        //    SqlConnection con = new SqlConnection(Classes.DataConnString);

        //    try
        //    {
        //        string s = "select Name from Units";
        //        DataTable dt = new DataTable();
        //        using (SqlDataAdapter da = new SqlDataAdapter(s, con))
        //            da.Fill(dt);

        //        Unitstxt.Items.Clear();
        //        for (int i = 0; i < dt.Rows.Count; i++)
        //        {
        //            Unitstxt.Items.Add(dt.Rows[i]["Name"]);

        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.ToString());
        //    }
        //    finally
        //    {
        //        con.Close();
        //    }
        //}

        public void FillRecpieDGV()
        {
            DataTable AllRecipes = new DataTable();

            AllRecipes = Classes.RetrieveData("Code,Name,Name2,(select Name from Setup_RecipeCategory where Code=Category_ID)", "Setup_Recipes");
            AllRecipesDGV.DataContext = AllRecipes;
        }
Exemple #11
0
        }       //Done Finall Function

        private void LoadData(string RecipeName)
        {
            string    category = "", SubCategory = "";
            DataTable RecipeInfo     = new DataTable();
            DataTable RecipeCat      = new DataTable();
            DataTable RecipeSubCat   = new DataTable();
            string    WhereFiltering = string.Format("Name=N'{0}'", RecipeName);

            RecipeInfo = Classes.RetrieveData("*", WhereFiltering, "Setup_Recipes");

            WhereFiltering = string.Format("Code={0}", RecipeInfo.Rows[0]["Category_ID"]);
            category       = Classes.RetrieveData("Name", WhereFiltering, "Setup_RecipeCategory").Rows[0][0].ToString();

            WhereFiltering = string.Format("Code={0}", RecipeInfo.Rows[0]["SubCategory_ID"]);
            SubCategory    = Classes.RetrieveData("Name", WhereFiltering, "Setup_RecipeSubCategories").Rows[0][0].ToString();

            codetxt.Text         = RecipeInfo.Rows[0]["Code"].ToString();
            Nametxt.Text         = RecipeInfo.Rows[0]["Name"].ToString();
            Name2txt.Text        = RecipeInfo.Rows[0]["Name2"].ToString();
            CrossCodetxt.Text    = RecipeInfo.Rows[0]["CrossCode"].ToString();
            Categorytxt.Text     = category;
            SUBCategorytxt.Text  = SubCategory;
            Categtxt.Text        = RecipeInfo.Rows[0]["Category_ID"].ToString();
            SUBCategtxt.Text     = RecipeInfo.Rows[0]["SubCategory_ID"].ToString();
            ActiveChbx.IsChecked = RecipeInfo.Rows[0]["IsActive"].ToString().Equals("True");
            Unittxt.Text         = RecipeInfo.Rows[0]["UnitQty"].ToString();
            Unitstxt.Text        = RecipeInfo.Rows[0]["Unit"].ToString();
            LoadRecipeItemsToGrid(codetxt.Text);
        }       //Done FInall Function
Exemple #12
0
        //Functions
        private void FillDGV()
        {
            DataTable TheVendros = new DataTable();

            TheVendros = Classes.RetrieveData("Code,Name,IsActive", "Vendors");
            Vendors_DGV.DataContext = TheVendros;
        }       //Done
Exemple #13
0
        private void FillDGV()
        {
            DataTable AdjReasons = new DataTable();

            AdjReasons             = Classes.RetrieveData("Code,Name,Name2,Active", "Setup_AdjacmentReasons_tbl");
            ReasonsDGV.DataContext = AdjReasons;
        }    //Done
Exemple #14
0
        private void FillDGV()
        {
            DataTable TheUsers = new DataTable();

            TheUsers             = Classes.RetrieveData("ID,Name,UserName,(select Name FROM UserClass_tbl Where Users.UserClass_ID=UserClass_tbl.UserClass_ID) as Tital,Active", "Users");
            UsersDGV.DataContext = TheUsers;
        }
        }           //Done

        private void LoadToDGVOfParentItemsStartly(string Code)
        {
            string Where = ""; DataTable ParentsItems = new DataTable();

            Where        = string.Format("Parent_Item='{0}'", Code);
            ParentsItems = Classes.RetrieveData("Code,(Select Name From Setup_Items Where Code=Setup_ParentItems.Code) Name", Where, "Setup_ParentItems");
            ParentItemsDGV.DataContext = ParentsItems;
        }           //Done FInall Function
        }     //Done

        private void LoadToDGVOfItems()
        {
            DataTable AllItems = new DataTable();
            string    s        = string.Format("Code <> '{0}' AND Active=1", ItemCode);

            AllItems             = Classes.RetrieveData("Code,[Manual Code] as 'Manual Code',Name,Category", s, "Setup_Items");
            ItemsDGV.DataContext = AllItems;
        }            //Done
        }  //Done Finall Function

        private void LoadToDGVOfItems()
        {
            DataTable AllItems = new DataTable();
            string    s        = string.Format("Code <> '{0}' AND Active=1", CodeOfparent);

            AllItems             = Classes.RetrieveData("Code,Name,Name2,Category", s, "Setup_Items");
            ItemsDGV.DataContext = AllItems;
        }    //Done Finall Function
        public void LoadAllCategories(string val)
        {
            DataTable AllSubCat = new DataTable();

            string where = string.Format("IsActive='True' and Category_ID={0}", val);
            AllSubCat    = Classes.RetrieveData("Code,Name,IsActive as Active", where, "Setup_RecipeSubCategories");
            SubCategories.DataContext = AllSubCat;
        }
        }       //Done

        private void LoadAllReasons()
        {
            DataTable TheReasons = Classes.RetrieveData("Name", "Active='True'", "Setup_AdjacmentReasons_tbl");

            for (int i = 0; i < TheReasons.Rows.Count; i++)
            {
                Reasoncbx.Items.Add(TheReasons.Rows[i][0].ToString());
            }
        }   //Done
Exemple #20
0
        private void LoadAllJobs()
        {
            DataTable TheJobTitles = Classes.RetrieveData("Name", "UserClass_tbl");

            for (int i = 0; i < TheJobTitles.Rows.Count; i++)
            {
                jobTitle.Items.Add(TheJobTitles.Rows[i][0].ToString());
            }
        }
Exemple #21
0
        public static void CloseMonth(DataRow DRCurrentMonth)
        {
            try
            {
                cols = "Year varchar(50),Month varchar(50),FromDate datetime,ToDate datetime,Restaurant_ID int,Kitchen_ID int,Item_ID varchar(50),Qty bigint,Cost float";

                Classes.CreateTable("BeginningEndingMonth", cols);

                where = "Month = '" + DRCurrentMonth["Month"].ToString() + "' AND Year = '" + DRCurrentMonth["Year"].ToString() + "'";
                Classes.DeleteRows(where, "BeginningEndingMonth");

                DataTable Items = Classes.RetrieveData("Code", "Setup_Items");

                DataTable DTTop = new DataTable();

                DataTable Kitchens = Classes.RetrieveData("*", "Setup_Kitchens");

                string Dvalues = "('" + DRCurrentMonth["Year"] + "','" + DRCurrentMonth["Month"].ToString() + "','" + Convert.ToDateTime(DRCurrentMonth["From"]).ToString(Classes.sysDateTimeFormat) + "','" + Convert.ToDateTime(DRCurrentMonth["To"]).ToString(Classes.sysDateTimeFormat) + "'";

                foreach (DataRow KitName in Kitchens.Rows)
                {
                    values = "";
                    string Dkitchen = ",'" + KitName["Name"].ToString() + "'";
                    for (int i = 0; i < Items.Rows.Count; i++)
                    {
                        where = " _Date <= '" + Convert.ToDateTime(DRCurrentMonth["To"]).ToString(Classes.sysDateTimeFormat) + "' AND Item_ID = '" + Items.Rows[i][0].ToString() + "' AND KitchenName = '" + KitName["Name"].ToString() + "' order by  _DATE DESC";
                        DTTop = Classes.RetrieveData("top 1 * ", where, "TransActions");

                        if (DTTop.Rows.Count != 0)
                        {
                            Qty  = double.Parse(DTTop.Rows[0]["Current_Qty"].ToString());
                            Cost = double.Parse(DTTop.Rows[0]["CurrentCost"].ToString());
                        }
                        else
                        {
                            Qty  = 0;
                            Cost = 0;
                        }
                        string DQtyCost    = ",'" + Items.Rows[i][0].ToString() + "','" + Qty.ToString() + "','" + Cost.ToString() + "'";
                        string RestKitchen = ",'" + KitName["RestaurantID"].ToString() + "','" + KitName["Code"].ToString() + "'";
                        values += Dvalues + RestKitchen + DQtyCost + "),";
                        if (i % 999 == 0 || i == Items.Rows.Count - 1)
                        {
                            Classes.InsertRow("BeginningEndingMonth", values.Substring(1, values.Length - 3));
                            values = "";
                        }
                    }
                }
                //MessageBox.Show("Month Closed Successfully");
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }
Exemple #22
0
        private static void UpdateItems(DataRow DRCurrentMonth)
        {
            string where = "Year = '" + DRCurrentMonth["Year"].ToString() + "' AND Month = '" + DRCurrentMonth["Month"].ToString() + "'";
            DataTable ItemsQtyCost = Classes.RetrieveData("*", where + " AND Qty > '0' ", "BeginningEndingMonth");

            foreach (DataRow Item in ItemsQtyCost.Rows)
            {
                where = " RestaurantID = '" + Item["Restaurant_ID"] + "' AND KitchenID = '" + Item["Kitchen_ID"] + "' AND ItemID = '" + Item["Item_ID"] + "'";
                Classes.UpdateRow("Qty,Current_Cost", Item["Qty"] + "," + Item["Cost"], where, "Items");
            }
        }
        }           //Done Finall Function

        private void LoadToDGVOfBulkItems(string code)
        {
            //Michael's Update
            string    Where = "";
            DataTable ParentsItems = new DataTable(); DataTable ParentItemsInfos = new DataTable();

            ParentsItems     = ((DataTable)ParentItemsDGV.DataContext);
            Where            = string.Format("Code='{0}'", code);
            ParentItemsInfos = Classes.RetrieveData("Code,Name", Where, "Setup_Items");
            ParentsItems.Rows.Add(ParentItemsInfos.Rows[0][0], ParentItemsInfos.Rows[0][1]);
            ParentItemsDGV.DataContext = ParentsItems;
        }               //DOne
Exemple #24
0
        }       //Done

        private string IncrementCode()
        {
            int Code = 0;

            try
            {
                Code  = Convert.ToInt32(Classes.RetrieveData("top(1)Code", "Setup_Recipes Order by Code DESC").Rows[0][0].ToString());
                Code += 1;
            }
            catch { Code = 1; }
            return(Code.ToString());
        }
Exemple #25
0
        }           //Done Finall Function

        private void LoadCategoreis()
        {
            DataTable AllCategoreis = new DataTable();

            AllCategoreis = Classes.RetrieveData("Name", "Setup_RecipeCategory");
            for (int i = 0; i < AllCategoreis.Rows.Count; i++)
            {
                TreeViewItem treeViewItem = new TreeViewItem();
                treeViewItem.Header = AllCategoreis.Rows[i][0].ToString();
                treeViewItems.Items.Add(treeViewItem);
            }
        }       //Done Finall Function
        private void load_years()
        {
            string cols = "Year varchar(50),Month varchar(50),[Month Type] varchar(50),[From] date,[To] date,isClosed bit";

            Classes.CreateTable("Setup_Fiscal_Period", cols);
            DataTable Years = Classes.RetrieveData("DISTINCT(Year)", "Setup_Fiscal_Period");

            foreach (DataRow year in Years.Rows)
            {
                CBCreatedYears.Items.Add(year[0]);
            }
        }
Exemple #27
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
Exemple #28
0
 private static void LoadITEM_COST(DataTable DTPreviousMonth)
 {
     if (DTPreviousMonth.Rows.Count != 0)
     {
         string Pyear  = DTPreviousMonth.Rows[0]["Year"].ToString();
         string Pmonth = DTPreviousMonth.Rows[0]["Month"].ToString();
         string where = "Year = '" + Pyear + "' AND Month = '" + Pmonth + "'";
         DataTable TempItems = Classes.RetrieveData("*", where, "BeginningEndingMonthView");
         foreach (DataRow DRI in TempItems.Rows)
         {
             item_cost[DRI["KitchenName"].ToString() + DRI["Item_ID"].ToString()] = DRI["Cost"].ToString();
         }
     }
 }
Exemple #29
0
        public static TreeView LoadDates(TreeView TVDates)
        {
            DataTable DT = Classes.RetrieveData("*", "isClosed = 'True'", "Setup_Fiscal_Period");

            foreach (DataRow DR in DT.Rows)
            {
                if (!TVDates.Nodes.ContainsKey(DR["Year"].ToString()))
                {
                    TVDates.Nodes.Add(DR["Year"].ToString(), DR["Year"].ToString());
                }
                TVDates.Nodes[DR["Year"].ToString()].Nodes.Add("Month" + DR["Month"].ToString());
            }
            return(TVDates);
        }
Exemple #30
0
        }       //Doen Finall Function

        private void ItemsDGV_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            //Michael's Update
            double    Cost = 0, Weight = 0, _Qty = 0, _Cost = 0;
            string    Where     = "";
            DataTable ItemsInfo = new DataTable();
            DataTable BulkItems = new DataTable();
            DataTable DT        = new DataTable();

            DT.Columns.Add("Code");
            DT.Columns.Add("Manual Code");
            DT.Columns.Add("Name");
            DT.Columns.Add("Weight Precentage");
            DT.Columns.Add("Cost Precentage");
            DT.Columns.Add("Weight");
            DT.Columns.Add("Cost");
            DataGrid grid = sender as DataGrid;

            if (grid != null && grid.SelectedItems != null && grid.SelectedItems.Count == 1)
            {
                Where     = string.Format("Item_Code='{0}'", ((DataRowView)grid.SelectedItem).Row.ItemArray[0]);
                BulkItems = Classes.RetrieveData("Code,WeightPrecentage,CostPrecentage", Where, "Setup_BulkItems");
                for (int i = 0; i < BulkItems.Rows.Count; i++)
                {
                    Where     = string.Format("Code='{0}'", BulkItems.Rows[i][0]);
                    ItemsInfo = Classes.RetrieveData("[Manual Code],Name", Where, "Setup_Items");
                    _Qty      = Convert.ToDouble(((DataRowView)grid.SelectedItem).Row.ItemArray[3]);
                    _Cost     = Convert.ToDouble(((DataRowView)grid.SelectedItem).Row.ItemArray[5]);
                    Cost      = ((Convert.ToDouble(BulkItems.Rows[i][2].ToString()) * _Cost) / 100);
                    Weight    = ((Convert.ToDouble(BulkItems.Rows[i][1].ToString()) * _Qty) / 100);
                    DT.Rows.Add(BulkItems.Rows[i][0], ItemsInfo.Rows[0][0], ItemsInfo.Rows[0][1], BulkItems.Rows[i][1].ToString(), BulkItems.Rows[i][2].ToString(), Weight, Cost);
                    ItemsofBulkItemsDGV.Visibility = Visibility.Visible;
                }
            }
            else
            {
                ItemsofBulkItemsDGV.Visibility = Visibility.Hidden; return;
            }
            for (int i = 0; i < DT.Columns.Count; i++)
            {
                DT.Columns[i].ReadOnly = true;
            }
            DT.Columns["Weight Precentage"].ReadOnly = false;
            DT.Columns["Cost Precentage"].ReadOnly   = false;
            DT.Columns["Weight"].ReadOnly            = false;
            DT.Columns["Cost"].ReadOnly = false;

            ItemsofBulkItemsDGV.DataContext = DT;
        }       //Doen Finall Function