コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #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;
        }
コード例 #4
0
 /// <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;
 }