예제 #1
0
        public static List <SfBUserPlan> GetSfBUserPlans(int itemId)
        {
            // place log record
            TaskManager.StartTask("SFB", "GET_SFB_SFBUSERPLANS", itemId);

            try
            {
                List <SfBUserPlan> plans = new List <SfBUserPlan>();

                UserInfo user = ObjectUtils.FillObjectFromDataReader <UserInfo>(DataProvider.GetUserByExchangeOrganizationIdInternally(itemId));

                if (user.Role == UserRole.User)
                {
                    SfBController.GetSfBUserPlansByUser(itemId, user, ref plans);
                }
                else
                {
                    SfBController.GetSfBUserPlansByUser(0, user, ref plans);
                }


                ExchangeOrganization ExchangeOrg = ObjectUtils.FillObjectFromDataReader <ExchangeOrganization>(DataProvider.GetExchangeOrganization(itemId));

                if (ExchangeOrg != null)
                {
                    foreach (SfBUserPlan p in plans)
                    {
                        p.IsDefault = (p.SfBUserPlanId == ExchangeOrg.SfBUserPlanID);
                    }
                }


                return(plans);
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
        }
예제 #2
0
        private void Enable_CsComputer()
        {
            int[] sfbServiceIds;

            SfBController.GetSfBServices(sfbServiceId, out sfbServiceIds);

            foreach (int id in sfbServiceIds)
            {
                SfBServer sfb = null;
                try
                {
                    sfb = SfBController.GetSfBServer(id, organizationServiceId);
                    if (sfb != null)
                    {
                        sfb.ReloadConfiguration();
                    }
                }
                catch (Exception exe)
                {
                    TaskManager.WriteError(exe);
                    continue;
                }
            }
        }
예제 #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);
                }
            }
        }