Beispiel #1
0
        public static List <LyncUserPlan> GetLyncUserPlans(int itemId)
        {
            // place log record
            TaskManager.StartTask("LYNC", "GET_LYNC_LYNCUSERPLANS", itemId);

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

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

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


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

                if (ExchangeOrg != null)
                {
                    foreach (LyncUserPlan p in plans)
                    {
                        p.IsDefault = (p.LyncUserPlanId == ExchangeOrg.LyncUserPlanID);
                    }
                }


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

            LyncController.GetLyncServices(lyncServiceId, out lyncServiceIds);

            foreach (int id in lyncServiceIds)
            {
                LyncServer lync = null;
                try
                {
                    lync = LyncController.GetLyncServer(id, organizationServiceId);
                    if (lync != null)
                    {
                        lync.ReloadConfiguration();
                    }
                }
                catch (Exception exe)
                {
                    TaskManager.WriteError(exe);
                    continue;
                }
            }
        }
Beispiel #3
0
        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);
                }
            }
        }