private void GetAllKBuserByAD() { string keyword = WebUtility.GetStringParameter("keyword", string.Empty); int pageIndex = WebUtility.GetIntegerParameter("pi", 0); int pageSize = WebUtility.GetIntegerParameter("ps", 15); int status = WebUtility.GetIntegerParameter("status", 2); IList InformationCollection = kbuserservice.GetAllKBUsersAndCount(keyword, (KBUserService.KBUserStatusFilter)status, pageIndex, pageSize); KBUserInfo[] allKBUser = (KBUserInfo[])InformationCollection[0]; int allFilteredKBUserCount = (int)InformationCollection[1]; int allFilteredEnabledKBUserCount = (int)InformationCollection[2]; int allFilteredDisabledKBUserCount = (int)InformationCollection[3]; int allKBUserCount = (int)InformationCollection[4]; int allEnabledKBUserCount = (int)InformationCollection[5]; int allDisabledKBUserCount = (int)InformationCollection[6]; KBUserInfo[] kbuserHasName = new KBUserInfo[allKBUser.Length]; SortedList users = new SortedList(); string key = string.Empty; for (int i = 0; i < allKBUser.Length; i++) { try { kbuserHasName[i] = kbuserservice.GetKBUserBySubjectId(allKBUser[i].SubjectId); key = kbuserHasName[i].DisplayName.Trim(); if (string.IsNullOrEmpty(key) || key == "N/A") { key = "ZZZZZZNA" + i.ToString(); } users.Add(key, kbuserHasName[i]); } catch (Exception ex) { log4net.LogManager.GetLogger("KM").Error(ex.Message, ex); } } allKBUser = null; kbuserHasName = new KBUserInfo[users.Count]; for (int x = 0; x < users.Count; x++) { kbuserHasName[x] = (KBUserInfo)users.GetByIndex(x); } ArrayList usersWithTotalCount = new ArrayList(); usersWithTotalCount.Add(kbuserHasName); usersWithTotalCount.Add(allFilteredKBUserCount); usersWithTotalCount.Add(allFilteredEnabledKBUserCount); usersWithTotalCount.Add(allFilteredDisabledKBUserCount); usersWithTotalCount.Add(allKBUserCount); usersWithTotalCount.Add(allEnabledKBUserCount); usersWithTotalCount.Add(allDisabledKBUserCount); WebUtility.WriteAjaxResult(true, null, usersWithTotalCount); }
private KBUserInfo GetKBUser(string subjectid) { KBUserInfo kbu = new KBUserInfo(); if (IdentityCache.Get(subjectid) != null) { kbu = (KBUserInfo)IdentityCache.Get(subjectid); } else { kbu = kbuserService.GetKBUserBySubjectId(subjectid); } return kbu; }
private KBUserInfo SetKbUserDefaultValue(KBUserInfo kbUser) { if (kbUser.Address == null) kbUser.Address = string.Empty; if (kbUser.CellphoneNumber == null) kbUser.CellphoneNumber = string.Empty; if (kbUser.DisplayName == null) kbUser.DisplayName = string.Empty; if (kbUser.EmailAddress == null) kbUser.EmailAddress = string.Empty; if (kbUser.Extension == null) kbUser.Extension = string.Empty; if (kbUser.FriendlyName == null) kbUser.FriendlyName = string.Empty; if (kbUser.HighestSchool == null) kbUser.HighestSchool = string.Empty; if (kbUser.Interests == null) kbUser.Interests = string.Empty; if (kbUser.LastIP == null) kbUser.LastIP = string.Empty; if (kbUser.MSN == null) kbUser.MSN = string.Empty; if (kbUser.SecondSchool == null) kbUser.SecondSchool = string.Empty; if (kbUser.Skype == null) kbUser.Skype = string.Empty; return kbUser; }