public ActionResult Index()
 {
     LoginModel login = (LoginModel)Session.Contents["AuthenticatedUser"];
     SettingsModel model = new SettingsModel();
     if (login != null)
     {
         Session.Add("Settings", model);
         return View(model);
     }
     else
     {
         LoginModel.ErrorMessage = "Session Expired";
         return RedirectToAction("Login", "Login");
     }
 }
 private static SettingsModel InitializeCatalog(AuthenticatedUserManager user, ReportingServiceClient proxy)
 {
     SettingsModel model = new SettingsModel();
     model.Catalog = new CatalogModel();
     model.Catalog = CatalogModel.GetCatalogItems(user, proxy);
     return model;
 }
 public static SettingsModel GetRoles(AuthenticatedUserManager user)
 {
     user.ConfiguredRoleCollection.Fill();
     SettingsModel model = new SettingsModel();
     model.ConfiguredRoles = user.ConfiguredRoleCollection;
     model.Roles = new StringCollection();
     model.Roles = AuthenticationManager.Authenticate(user.Username, user.Password, user.Domain).SecurityRoleCollection;
     foreach (BOConfiguredRole role in model.ConfiguredRoles)
     {
         if(model.Roles.Contains(role.RoleName))
         {
             model.Roles.Remove(role.RoleName);
         }
     }
     return model;
 }
        public static SettingsModel GetConfigurations(AuthenticatedUserManager user)
        {
            BOConfigurationCollection collection = user.ConfigurationCollection;
            collection.Fill();
            SettingsModel model = new SettingsModel();

            model.ApplicationConfigurations = new BOConfigurationCollection();

            #region appSettings value assignments
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.StartupPageAddress });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SMTPServer });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SupportEmail });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.BaseUrl });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.MinimumUIYear });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SRSBaseUrl });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SRSReportExecutionPage });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SRSReportExecutionServicePage });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SRSReportServicePage });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.FTPServer });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.FTPPath });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.FTPUser });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.FTPPassword });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.CSVDelimiter });
            #endregion

            model.SubscriptionConfigurations = new BOConfigurationCollection();

            #region subscriptionSettings value assignments
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.ScheduleServiceSignature });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.TimerQueuePollingInterval });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.TimerQueueLoadingInterval });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.TimerMaintenancePollingInterval });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.MaxScheduleThreads });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.HeadquartersTimeZone });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionLogLevel });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionNameFormat });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.MaxReportFileAge });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.MaxScheduleFailCount });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.MaxScheduleQueueAge });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionReportTimeout });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionZipThreshold });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionEmailAttachmentThreshold });
            #endregion

            foreach (BOConfiguration setting in collection)
            {
                if (model.ApplicationConfigurations[setting.PropertyName] != null)
                {
                    model.ApplicationConfigurations[setting.PropertyName].PropertyValue = setting.PropertyValue;
                    model.ApplicationConfigurations[setting.PropertyName].PropertyDescription = setting.PropertyDescription;
                }
            }
            foreach (BOConfiguration setting in collection)
            {
                if (model.SubscriptionConfigurations[setting.PropertyName] != null)
                {
                    model.SubscriptionConfigurations[setting.PropertyName].PropertyValue = setting.PropertyValue;
                    model.SubscriptionConfigurations[setting.PropertyName].PropertyDescription = setting.PropertyDescription;

                }
            }

            model.SubscriptionNameFormat = new List<string>()
            {
                Constants.SubscriptionNameFormats.NameDate,
                Constants.SubscriptionNameFormats.ReportDate,
                Constants.SubscriptionNameFormats.ReportNameDate
            };

            model.SubscriptionLogLevel = new Dictionary<int, string>()
            {
                {(int)TraceLevel.None, TraceLevel.None.ToString()},
                {(int)TraceLevel.Standard, TraceLevel.Standard.ToString()},
                {(int)TraceLevel.Verbose, TraceLevel.Verbose.ToString()}
            };
            return model;
        }