public LyncUser[] GetLyncUsersPaged(int itemId, string filterColumn, string filterValue, int maximumRows, int startRowIndex, string sortColumn) { if (!String.IsNullOrEmpty(filterValue)) { filterValue = filterValue + "%"; } if (maximumRows == 0) { maximumRows = Int32.MaxValue; } string name = string.Empty; string email = string.Empty; if (filterColumn == "DisplayName") { name = filterValue; } else { email = filterValue; } string[] data = sortColumn.Split(' '); string direction = data.Length > 1 ? "DESC" : "ASC"; LyncUsersPagedResult res = ES.Services.Lync.GetLyncUsersPaged(itemId, data[0], direction, startRowIndex, maximumRows); return(res.Value.PageUsers); }
public static LyncUsersPagedResult GetLyncUsersPaged(int itemId, string sortColumn, string sortDirection, int startRow, int count) { LyncUsersPagedResult res = TaskManager.StartResultTask <LyncUsersPagedResult>("LYNC", "GET_LYNC_USERS"); try { IDataReader reader = DataProvider.GetLyncUsers(itemId, sortColumn, sortDirection, startRow, count); List <LyncUser> accounts = new List <LyncUser>(); ObjectUtils.FillCollectionFromDataReader(accounts, reader); res.Value = new LyncUsersPaged { PageUsers = accounts.ToArray() }; } catch (Exception ex) { TaskManager.CompleteResultTask(res, LyncErrorCodes.GET_LYNC_USERS, ex); return(res); } IntResult intRes = GetLyncUsersCount(itemId); res.ErrorCodes.AddRange(intRes.ErrorCodes); if (!intRes.IsSuccess) { TaskManager.CompleteResultTask(res); return(res); } res.Value.RecordsCount = intRes.Value; TaskManager.CompleteResultTask(); return(res); }
private static void PopulateLyncReportItems(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller) { //Check if lync organization if (string.IsNullOrEmpty(org.LyncTenantId)) { return; } LyncUser[] lyncUsers = null; try { LyncUsersPagedResult res = LyncController.GetLyncUsers(org.Id); if (res.IsSuccess) { lyncUsers = res.Value.PageUsers; } } catch (Exception ex) { throw new ApplicationException( string.Format("Could not get lync users for current organization {0}", org.Id), ex); } if (lyncUsers == null) { return; } foreach (LyncUser lyncUser in lyncUsers) { try { LyncUserStatistics stats = new LyncUserStatistics(); try { stats.SipAddress = lyncUser.SipAddress; if (string.IsNullOrEmpty(lyncUser.LineUri)) { stats.PhoneNumber = string.Empty; } else { stats.PhoneNumber = lyncUser.LineUri; } LyncUserPlan plan = LyncController.GetLyncUserPlan(org.Id, lyncUser.LyncUserPlanId); stats.Conferencing = plan.Conferencing; stats.EnterpriseVoice = plan.EnterpriseVoice; stats.Federation = plan.Federation; stats.InstantMessaing = plan.IM; stats.MobileAccess = plan.Mobility; stats.LyncUserPlan = plan.LyncUserPlanName; stats.DisplayName = lyncUser.DisplayName; } catch (Exception ex) { TaskManager.WriteError(ex, "Could not get lync statistics. AccountName: {0}", lyncUser.DisplayName); } if (stats != null) { PopulateBaseItem(stats, org, topReseller); report.LyncReport.Items.Add(stats); } } catch (Exception ex) { TaskManager.WriteError(ex); } } }