Exemplo n.º 1
0
        public List <MenuIsAllowed> GetMenuByRoleID(int roleID)
        {
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("@RoleID", roleID));
            DataTable dt  = new SqlHelper().ExecuteQuery("p_Auth_Menu_Select_By_RoleID", param);
            var       lst = new List <MenuIsAllowed>();

            foreach (DataRow row in dt.Rows)
            {
                var item = new MenuIsAllowed();
                item.MenuID         = !row.IsNull("MenuID") ? row["MenuID"].ToString() : "";
                item.ParentMenuID   = !row.IsNull("ParentMenuID") ? row["ParentMenuID"].ToString() : "";
                item.MenuName       = !row.IsNull("MenuName") ? row["MenuName"].ToString() : "";
                item.MenuIndex      = !row.IsNull("MenuIndex") ? Convert.ToInt32(row["MenuIndex"]) : 0;
                item.ControllerName = !row.IsNull("ControllerName") ? row["ControllerName"].ToString() : "";
                item.IsAllowed      = !row.IsNull("IsAllowed") ? Convert.ToBoolean(row["IsAllowed"]) : false;

                lst.Add(item);
            }
            return(lst);
        }
Exemplo n.º 2
0
        public List<MenuIsAllowed> GetMenuByRoleID(int roleID)
        {
            List<SqlParameter> param = new List<SqlParameter>();
            param.Add(new SqlParameter("@RoleID", roleID));
            DataTable dt = new SqlHelper().ExecuteQuery("p_Auth_Menu_Select_By_RoleID", param);
            var lst = new List<MenuIsAllowed>();
            foreach (DataRow row in dt.Rows)
            {
                var item = new MenuIsAllowed();
                item.MenuID = !row.IsNull("MenuID") ? row["MenuID"].ToString() : "";
                item.ParentMenuID = !row.IsNull("ParentMenuID") ? row["ParentMenuID"].ToString() : "";
                item.MenuName = !row.IsNull("MenuName") ? row["MenuName"].ToString() : "";
                item.MenuIndex = !row.IsNull("MenuIndex") ? Convert.ToInt32(row["MenuIndex"]) : 0;
                item.ControllerName = !row.IsNull("ControllerName") ? row["ControllerName"].ToString() : "";
                item.IsAllowed = !row.IsNull("IsAllowed") ? Convert.ToBoolean(row["IsAllowed"]) : false;

                lst.Add(item);
            }
            return lst;
        }