protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Category cats = new Category();
         cats.LoadAll();
         uiRepeaterCats.DataSource = cats.DefaultView;
         uiRepeaterCats.DataBind();
     }
 }
        private void PopulateCatTree()
        {
            ProductTree.Nodes.Clear();
            if (Convert.ToInt32(lkCommodityTypes.EditValue) == BLL.Type.Constants.Pharmacuticals)
            {
                Category cat = new Category();
                SubCategory subCat = new SubCategory();
                Product prod = new Product();
                cat.LoadAll();
                cat.Sort = "CategoryName";
                ProductTree.Nodes.Add("All0", "All");
                foreach (DataRowView dv in cat.DefaultView)
                {
                    TreeNode nodes = new TreeNode();
                    nodes.Name = "cat" + dv["ID"].ToString();
                    nodes.Text = dv["CategoryName"].ToString() + " (" + dv["CategoryCode"].ToString() + ")";
                    nodes.ToolTipText = "Double Click to List";
                    subCat.GetSubCategory(Convert.ToInt32(dv["ID"]));
                    subCat.Sort = "SubCategoryName";
                    foreach (DataRowView subDv in subCat.DefaultView)
                    {

                        TreeNode subNodes = new TreeNode();
                        subNodes.Name = "sub" + subDv["ID"].ToString();
                        subNodes.Text = subDv["SubCategoryName"].ToString() + " (" + subDv["SubCategoryCode"].ToString() + ")";
                        subNodes.ToolTipText = "Double Click to List";

                        nodes.Nodes.Add(subNodes);
                    }
                    ProductTree.Nodes[0].Nodes.Add(nodes);

                }
                ProductTree.Nodes[0].Expand();
            }
            else
            {
                SupplyCategory scat = new SupplyCategory();
                scat.LoadAll();
                scat.Sort = "Name";
                ProductTree.Nodes.Add("Als0", "All");
                foreach (DataRowView dv in scat.DefaultView)
                {
                    TreeNode nodes = new TreeNode();
                    nodes.Name = "sup" + dv["ID"].ToString();
                    nodes.Text = dv["Name"].ToString();
                    nodes.ToolTipText = "Double Click to List";
                    ProductTree.Nodes[0].Nodes.Add(nodes);

                }
                ProductTree.Nodes[0].Expand();
            }
        }
        private void LoadDDLs()
        {
            Category cats = new Category();
            cats.LoadAll();
            uiDropDownListADD_Category.DataSource = cats.DefaultView;
            uiDropDownListADD_Category.DataTextField = "Name";
            uiDropDownListADD_Category.DataValueField = "CategoryID";
            uiDropDownListADD_Category.DataBind();

            uiDropDownListEdit_Category.DataSource = cats.DefaultView;
            uiDropDownListEdit_Category.DataTextField = "Name";
            uiDropDownListEdit_Category.DataValueField = "CategoryID";
            uiDropDownListEdit_Category.DataBind();

            var adminTypes = Helper.EnumUtil.GetValues<Helper.Enums.RoomMemberLevel>().Where(l => (int)l > (int)Helper.Enums.RoomMemberLevel.Visitor && (int)l != (int)Helper.Enums.RoomMemberLevel.Owner).Select(r => new
            {
                AdminTypeID = (int)r,
                Name = Helper.StringEnum.GetStringValue(r)
            }).ToList();
            uiDropDownListAdminType.DataSource = adminTypes;
            uiDropDownListAdminType.DataTextField = "Name";
            uiDropDownListAdminType.DataValueField = "AdminTypeID";
            uiDropDownListAdminType.DataBind();

            BindSubCats();

            Room myrooms = new Room();
            myrooms.GetRoomsByCreatorID(Member.CurrentMemberID);
            uiDropDownListMyRooms.DataSource = myrooms.DefaultView;
            uiDropDownListMyRooms.DataTextField = "Name";
            uiDropDownListMyRooms.DataValueField = "RoomID";
            uiDropDownListMyRooms.DataBind();
            uiDropDownListMyRooms.Items.Insert(0, new ListItem("إختر غرفة. . . ."));
            if (CurrentRoom != 0)
                uiDropDownListMyRooms.SelectedValue = CurrentRoom.ToString();
        }
        private void ManageItems_Load(object sender, EventArgs e)
        {
            Category cat = new Category();
            SubCategory subCat = new SubCategory();
            Product prod = new Product();
            cat.LoadAll();
            cat.Sort = "CategoryName";
            lblCategory.Text = "Products By Category";
            ProductTree.Nodes.Add("All0","All");
            foreach (DataRowView dv in cat.DefaultView)
            {
                TreeNode nodes = new TreeNode();
                nodes.Name =  "cat" + dv["ID"].ToString();
                nodes.Text = dv["CategoryName"].ToString() + " (" + dv["CategoryCode"].ToString() + ")";
                nodes.ToolTipText = "Double Click to List";
                subCat.GetSubCategory(Convert.ToInt32(dv["ID"]));
                subCat.Sort = "SubCategoryName";
                foreach (DataRowView subDv in subCat.DefaultView)
                {

                    TreeNode subNodes = new TreeNode();
                    subNodes.Name = "sub" + subDv["ID"].ToString();
                    subNodes.Text = subDv["SubCategoryName"].ToString() + " (" + subDv["SubCategoryCode"].ToString() + ")";
                    subNodes.ToolTipText = "Double Click to List";

                    nodes.Nodes.Add(subNodes);
                }
               ProductTree.Nodes[0].Nodes.Add(nodes);

            }
            ProductTree.Nodes[0].Expand();

            Stores stor = new Stores();
            stor.GetActiveStores();
            cboStores.DataSource = stor.DefaultView;
        }
        private void PopulateCategory()
        {
            ProductTree.Nodes.Clear();
            Category cat = new Category();
            SubCategory subCat = new SubCategory();
            cat.LoadAll();
            cat.Sort = "CategoryName";
            ProductTree.Nodes.Add("All0", "All");
            foreach (DataRowView dv in cat.DefaultView)
            {
                TreeNode nodes = new TreeNode
                                     {
                                         Name = "cat" + dv["ID"].ToString(),
                                         Text =
                                             dv["CategoryName"].ToString() + " (" + dv["CategoryCode"].ToString() + ")",
                                         ToolTipText = "Double click to add"
                                     };
                subCat.GetSubCategory(Convert.ToInt32(dv["ID"]));
                subCat.Sort = "SubCategoryName";
                foreach (DataRowView subDv in subCat.DefaultView)
                {
                    if (!ExistInList(Convert.ToInt32(subDv["ID"])))
                    {
                        TreeNode subNodes = new TreeNode
                                                {
                                                    Name = "sub" + subDv["ID"].ToString(),
                                                    Text =
                                                        subDv["SubCategoryName"].ToString() + " (" +
                                                        subDv["SubCategoryCode"].ToString() + ")",
                                                    ToolTipText = "Double click to add"
                                                };

                        nodes.Nodes.Add(subNodes);
                    }
                }
                ProductTree.Nodes[0].Nodes.Add(nodes);
            }
            ProductTree.Nodes[0].Expand();
        }