Exemplo n.º 1
0
        public static SfBUsersPagedResult GetSfBUsersPaged(int itemId, string sortColumn, string sortDirection, int startRow, int count)
        {
            SfBUsersPagedResult res = TaskManager.StartResultTask <SfBUsersPagedResult>("SFB", "GET_SFB_USERS");

            try
            {
                IDataReader reader =
                    DataProvider.GetSfBUsers(itemId, sortColumn, sortDirection, startRow, count);
                List <SfBUser> accounts = new List <SfBUser>();
                ObjectUtils.FillCollectionFromDataReader(accounts, reader);
                res.Value = new SfBUsersPaged {
                    PageUsers = accounts.ToArray()
                };
            }
            catch (Exception ex)
            {
                TaskManager.CompleteResultTask(res, SfBErrorCodes.GET_SFB_USERS, ex);
                return(res);
            }

            IntResult intRes = GetSfBUsersCount(itemId);

            res.ErrorCodes.AddRange(intRes.ErrorCodes);
            if (!intRes.IsSuccess)
            {
                TaskManager.CompleteResultTask(res);
                return(res);
            }
            res.Value.RecordsCount = intRes.Value;

            TaskManager.CompleteResultTask();
            return(res);
        }
Exemplo n.º 2
0
        public SfBUser[] GetSfBUsersPaged(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";
            SfBUsersPagedResult res       =
                ES.Services.SfB.GetSfBUsersPaged(itemId, data[0], direction, startRowIndex, maximumRows);

            return(res.Value.PageUsers);
        }
Exemplo n.º 3
0
        private static void PopulateSfBReportItems(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller)
        {
            //Check if sfb organization
            if (string.IsNullOrEmpty(org.SfBTenantId))
            {
                return;
            }

            SfBUser[] sfbUsers = null;

            try
            {
                SfBUsersPagedResult res = SfBController.GetSfBUsers(org.Id);
                if (res.IsSuccess)
                {
                    sfbUsers = res.Value.PageUsers;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(
                          string.Format("Could not get sfb users for current organization {0}", org.Id), ex);
            }


            if (sfbUsers == null)
            {
                return;
            }

            foreach (SfBUser sfbUser in sfbUsers)
            {
                try
                {
                    SfBUserStatistics stats = new SfBUserStatistics();

                    try
                    {
                        stats.SipAddress = sfbUser.SipAddress;
                        if (string.IsNullOrEmpty(sfbUser.LineUri))
                        {
                            stats.PhoneNumber = string.Empty;
                        }
                        else
                        {
                            stats.PhoneNumber = sfbUser.LineUri;
                        }

                        SfBUserPlan plan = SfBController.GetSfBUserPlan(org.Id, sfbUser.SfBUserPlanId);
                        stats.Conferencing    = plan.Conferencing;
                        stats.EnterpriseVoice = plan.EnterpriseVoice;
                        stats.Federation      = plan.Federation;
                        stats.InstantMessaing = plan.IM;
                        stats.MobileAccess    = plan.Mobility;
                        stats.SfBUserPlan     = plan.SfBUserPlanName;
                        stats.DisplayName     = sfbUser.DisplayName;
                    }
                    catch (Exception ex)
                    {
                        TaskManager.WriteError(ex, "Could not get sfb statistics. AccountName: {0}",
                                               sfbUser.DisplayName);
                    }


                    if (stats != null)
                    {
                        PopulateBaseItem(stats, org, topReseller);
                        report.SfBReport.Items.Add(stats);
                    }
                }
                catch (Exception ex)
                {
                    TaskManager.WriteError(ex);
                }
            }
        }