Пример #1
0
        public string CreateRole(string name, string parentid, string description, string operateid)
        {
            string roleid = Guid.NewGuid().ToString();
            bool   bl     = SystemDAL.BaseProvider.CreateRole(roleid, name, parentid, description, operateid);

            if (bl)
            {
                //处理缓存
                var role = new M_Role()
                {
                    RoleID       = roleid,
                    Name         = name,
                    Description  = description,
                    CreateTime   = DateTime.Now,
                    CreateUserID = operateid,
                    Status       = 1,
                    IsDefault    = 0
                };
                Roles.Add(role);

                return(roleid);
            }

            return("");
        }
Пример #2
0
        /// <summary>
        /// 获取角色详情(权限明细)
        /// </summary>
        /// <param name="roleid"></param>
        /// <returns></returns>
        public static M_Role GetRoleByID(string roleid)
        {
            M_Role  model = null;
            DataSet ds    = SystemDAL.BaseProvider.GetRoleByID(roleid);

            if (ds.Tables.Contains("Role") && ds.Tables["Role"].Rows.Count > 0)
            {
                model = new M_Role();
                model.FillData(ds.Tables["Role"].Rows[0]);
                model.Menus = new List <Menu>();
                foreach (DataRow dr in ds.Tables["Menus"].Rows)
                {
                    Menu menu = new Menu();
                    menu.FillData(dr);
                    model.Menus.Add(menu);
                }
            }
            return(model);
        }
Пример #3
0
        /// <summary>
        /// 获取角色列表
        /// </summary>
        public static List <M_Role> GetRoles()
        {
            if (Roles.Count == 0)
            {
                DataTable     dt   = new SystemDAL().GetRoles();
                List <M_Role> list = new List <M_Role>();
                foreach (DataRow dr in dt.Rows)
                {
                    M_Role model = new M_Role();
                    model.FillData(dr);
                    list.Add(model);
                }

                Roles = list;

                return(list);
            }

            return(Roles);
        }
        /// <summary>
        /// 获取角色列表
        /// </summary>
        public static List<M_Role> GetRoles()
        {
            if (Roles.Count==0)
            {
                DataTable dt = new SystemDAL().GetRoles();
                List<M_Role> list = new List<M_Role>();
                foreach (DataRow dr in dt.Rows)
                {
                    M_Role model = new M_Role();
                    model.FillData(dr);
                    list.Add(model);
                }

                Roles = list;

                return list;
            }

            return Roles;
        }
        public string CreateRole(string name, string parentid, string description, string operateid)
        {
            string roleid = Guid.NewGuid().ToString();
            bool bl = SystemDAL.BaseProvider.CreateRole(roleid, name, parentid, description, operateid);
            if (bl)
            {
                //处理缓存
                var role = new M_Role()
                {
                    RoleID = roleid,
                    Name = name,
                    Description = description,
                    CreateTime = DateTime.Now,
                    CreateUserID = operateid,
                    Status = 1,
                    IsDefault = 0
                };
                Roles.Add(role);

                return roleid;
            }

            return "";
        }
 /// <summary>
 /// 获取角色详情(权限明细)
 /// </summary>
 /// <param name="roleid"></param>
 /// <param name="agentid"></param>
 /// <returns></returns>
 public static M_Role GetRoleByID(string roleid)
 {
     M_Role model = null;
     DataSet ds = SystemDAL.BaseProvider.GetRoleByID(roleid);
     if (ds.Tables.Contains("Role") && ds.Tables["Role"].Rows.Count > 0)
     {
         model = new M_Role();
         model.FillData(ds.Tables["Role"].Rows[0]);
         model.Menus = new List<Menu>();
         foreach (DataRow dr in ds.Tables["Menus"].Rows)
         {
             Menu menu = new Menu();
             menu.FillData(dr);
             model.Menus.Add(menu);
         }
     }
     return model;
 }