/// <summary> /// ������й�����ʵ�� /// </summary> /// <returns></returns> public Dictionary<int, AdminRole> GetAllAdminRoleEntity() { Dictionary<int, AdminRole> alladminrole = (Dictionary<int, AdminRole>)CachingService.Get(CachingService.CACHING_ALL_ADMINROLE_ENTITY); if (alladminrole == null) { DataTable dt = GetALLAdminRole(); if (dt == null) return null; if (dt.Rows.Count == 0) return null; alladminrole = new Dictionary<int, AdminRole>(); for (int i = 0; i < dt.Rows.Count; i++) { DataRow Row = dt.Rows[i]; AdminRole role = new AdminRole(); role.iID = (int)Row["iId"]; role.vcRoleName = Row["vcRoleName"].ToString(); role.vcContent = Row["vcContent"].ToString(); role.vcPopedom = this.GetPopedomsByIDs( Row["vcPopedom"].ToString()); role.PopedomStr = Row["vcPopedom"].ToString(); role.vcClassPopedom = Row["vcClassPopedom"].ToString(); role.dUpdateDate = objectHandlers.ToTime(Row["dUpdateDate"].ToString()); alladminrole.Add(role.iID, role); } CachingService.Set(CachingService.CACHING_ALL_ADMINROLE_ENTITY, alladminrole, null); } return alladminrole; }
/// <summary> /// /// </summary> /// <param name="rid"></param> /// <param name="iIds"></param> /// <returns></returns> public Dictionary<int, Popedom> GetAdminPopedomsByID(AdminRole adminrole, string iIds) { Dictionary<int, Popedom> allpop = this.GetAllPopedomEntity(); if (allpop == null) return null; if (allpop.Count == 0) return null; Dictionary<int, Popedom> pops = new Dictionary<int, Popedom>(); if (iIds.IndexOf(",") > -1) { string[] ids = iIds.Split(','); for (int i = 0; i < ids.Length; i++) { int tid = objectHandlers.ToInt(ids[i]); if (allpop.ContainsKey(tid)) { pops.Add(tid, allpop[tid]); } } } else { int id = objectHandlers.ToInt(iIds); if (allpop.ContainsKey(id)) { pops.Add(id, allpop[id]); } } if (adminrole.vcPopedom != null && adminrole.vcPopedom.Count != 0) { foreach (KeyValuePair<int, Popedom> keyvalue in adminrole.vcPopedom) { if (!pops.ContainsKey(keyvalue.Key)) { pops.Add(keyvalue.Key, keyvalue.Value); } } } return (pops.Count == 0) ? null : pops; }