public static Role GetRoleByID(string roleid, string agentid) { Role model = null; DataSet ds = OrganizationDAL.BaseProvider.GetRoleByID(roleid, agentid); if (ds.Tables.Contains("Role") && ds.Tables["Role"].Rows.Count > 0) { model = new 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; }
public static List<Role> GetRoles(string agentid) { if (!Roles.ContainsKey(agentid)) { DataTable dt = new OrganizationDAL().GetRoles(agentid); List<Role> list = new List<Role>(); foreach (DataRow dr in dt.Rows) { Role model = new Role(); model.FillData(dr); list.Add(model); } Roles.Add(agentid, list); return list; } return Roles[agentid].Where(m => m.Status == 1).ToList(); }