protected void AddSubCatagory(object parameter)
        {
            string  sub_category_name;
            TextBox tb = (TextBox)parameter;

            sub_category_name = tb.Text;
            if ((sub_category_name != "") && (SelectedCategory != null))
            {
                List <sub_category> temp_list = SubCategoryServices.GetAllSubCategoryByName(sub_category_name.Trim(), SelectedCategory.id);
                if (temp_list.Count == 0)
                {
                    sub_category ct = new sub_category();
                    ct.id = 0;
                    ct.subcategory_name = sub_category_name;
                    ct.category         = SelectedCategory.id;
                    int temp_SubCategory_id = SubCategoryServices.AddUpdateSubCategory(ct);
                    if (temp_SubCategory_id != 0)
                    {
                        // MessageBox.Show("Category " + sub_category_name + " is Created");
                        InventoryHelper.SuccessAlert("Success", "Category " + sub_category_name + " is Created");
                        BindGrid();
                    }
                }
            }
        }
        protected void UpdateSubCatagory(object parameter)
        {
            int     Sub_category_id = 0;
            TextBox tb = (TextBox)parameter;

            int.TryParse(tb.Text, out Sub_category_id);
            if ((Sub_category_id > 0) && (SelectedCategory != null))
            {
                SubCategoryEntity   ob_sub_Category = _lstSubCategory.Where(s => s.id == Sub_category_id).FirstOrDefault();
                List <sub_category> temp_list       = SubCategoryServices.GetAllSubCategoryByName(ob_sub_Category.sub_category_name.Trim(), SelectedCategory.id);
                if (temp_list.Count == 0 || temp_list.Count == 1)
                {
                    if (temp_list.Count == 1)
                    {
                        sub_category temp = temp_list.FirstOrDefault();
                        if (temp.id != ob_sub_Category.id)
                        {
                            BindGrid();
                            //RaisedPropertyChanged("Category");
                            //MessageBox.Show("SubCategory Name alredy Exist.");
                            InventoryHelper.SimpleAlert("Warning", "SubCategory Name alredy Exist.");
                            return;
                        }
                    }
                    sub_category temp_ob_sub_Category = SubCategoryServices.GetSubCategory(ob_sub_Category.id);
                    temp_ob_sub_Category.subcategory_name = ob_sub_Category.sub_category_name;
                    int temp_sub_Category_id = SubCategoryServices.AddUpdateSubCategory(temp_ob_sub_Category);
                    if (temp_sub_Category_id == ob_sub_Category.id)
                    {
                        //MessageBox.Show("Sub-Category " + ob_sub_Category.sub_category_name + " is Updated");
                        InventoryHelper.SuccessAlert("Success", "Sub-Category " + ob_sub_Category.sub_category_name + " is Updated");
                        BindGrid();
                        //RaisedPropertyChanged("Category");
                    }
                }
                else
                {
                    // MessageBox.Show("Category Name already Exist");
                    InventoryHelper.SimpleAlert("Warning", "Category Name already Exist");
                }
            }
        }