Ejemplo n.º 1
0
        private static string LoadRootCategoryByPermission(DropDownList cb_Cate, ListBox lb_Cate, CheckBoxList cbl_Cate)
        {
            string       strResult    = "";
            MainSecurity objSec       = new MainSecurity();
            Role         objrole      = objSec.GetRole(HttpContext.Current.User.Identity.Name);
            DataTable    objParentCat = objSec.getParentCategoryAssigned(HttpContext.Current.User.Identity.Name, Portal.API.Config.CurrentChannel);

            if (cb_Cate != null)
            {
                cb_Cate.Items.Add(new ListItem("-----Chọn tất cả -----", "0"));
            }
            if (lb_Cate != null)
            {
                lb_Cate.Items.Add(new ListItem("-----Chọn chuyên mục khác -----", "0"));
            }

            DataTable childRows       = new DataTable();
            DataTable childLevel3Rows = new DataTable();

            using (Portal.Core.DAL.MainDB objDB = new Portal.Core.DAL.MainDB())
            {
                foreach (DataRow objrow in objParentCat.Rows)
                {
                    childRows  = objDB.FrontEndStoreProcedure.Category_GetListByWhere(" Where Cat_ParentID=" + objrow["Cat_ID"] + "", " Order By Cat_Order ");
                    strResult += objrow["Cat_ID"] + ",";

                    if (cb_Cate != null)
                    {
                        cb_Cate.Items.Add(new ListItem("" + objrow["Cat_Name"].ToString().ToUpper() + "", objrow["Cat_ID"] + ""));
                    }
                    if (lb_Cate != null)
                    {
                        lb_Cate.Items.Add(new ListItem("" + objrow["Cat_Name"].ToString().ToUpper() + "", objrow["Cat_ID"] + ""));
                    }
                    if (cbl_Cate != null)
                    {
                        cbl_Cate.Items.Add(new ListItem("" + objrow["Cat_Name"].ToString().ToUpper() + "", objrow["Cat_ID"] + ""));
                    }
                }
            }

            return(strResult);
        }
Ejemplo n.º 2
0
        private void LoadLtsBox()
        {
            //string userID = Request.Params.Get("id");
            string userID = Session["id"] != null ? Session["id"].ToString() : "";

            //khoi tao bien secu de lay toan bo roles cua thang hien tai
            lstRoles.Items.Clear();
            lstCat.Items.Clear();
            lstPer.Items.Clear();

            MainSecurity objscu = new MainSecurity();
            DataTable    dt     = objscu.GetRoleAsTableNoCache(userID, 1);

            if (dt.Rows.Count > 0)
            {
                lstRoles.DataSource     = dt;
                lstRoles.DataTextField  = "Role_Name";
                lstRoles.DataValueField = "Role_ID";
                lstRoles.DataBind();
            }

            //lay thong tin ve chuyen muc cua thang hien tai
            dt = objscu.getParentCategoryAssigned(userID, 1);
            if (dt.Rows.Count > 0)
            {
                lstCat.DataTextField  = "Cat_Name";
                lstCat.DataValueField = "Cat_ID";
                lstCat.DataSource     = dt;
                lstCat.DataBind();
            }

            //lay thong tin ve toan bo quyen
            dt = objscu.GetPermissionAsTable(userID, 1, -1);
            if (dt.Rows.Count > 0)
            {
                lstPer.DataSource     = dt;
                lstPer.DataTextField  = "Permission_Name";
                lstPer.DataValueField = "Permission_ID";
                lstPer.DataBind();
            }
        }