Exemple #1
0
        protected void Application_Start()
        {
            ControllerActionRepository actionAuthorizationRepo = new ControllerActionRepository();

            actionAuthorizationRepo.UpdateActionList();

            AppSettingRepository appSettingRepository = new AppSettingRepository();

            appSettingRepository.Reload();

            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);

            var copy = ViewEngines.Engines.ToList();

            ViewEngines.Engines.Clear();
            foreach (var item in copy)
            {
                ViewEngines.Engines.Add(new ProfilingViewEngine(item));
            }

            GlobalFilters.Filters.Add(new ProfilingActionFilter());

            ModelBinders.Binders.Add(typeof(decimal?), new NullableDecimalModelBinder());
            ModelBinders.Binders.Add(typeof(decimal), new NullableDecimalModelBinder());
        }
Exemple #2
0
        private void PopulateAppSettingsFromDataStore()
        {
            var asType = typeof(AppSetting);

            using (var repo = new AppSettingRepository())
            {
                foreach (var appSettingDto in repo.GetAll())
                {
                    var prop = asType.GetProperty(appSettingDto.SettingName);

                    if (prop == null)
                    {
                        throw new MissingMemberException(String.Format(CultureInfo.CurrentCulture, "Invalid application setting. An application setting named '{0}' was found in the data store, but no property by that name exists in the class '{1}'. Check the application settings in the data store to ensure they are correct.", appSettingDto.SettingName, asType));
                    }
                    else if (prop.PropertyType == typeof(bool))
                    {
                        prop.SetValue(this, Convert.ToBoolean(appSettingDto.SettingValue.Trim(), CultureInfo.InvariantCulture), null);
                    }
                    else if (prop.PropertyType == typeof(string))
                    {
                        prop.SetValue(this, Convert.ToString(appSettingDto.SettingValue.Trim(), CultureInfo.InvariantCulture), null);
                    }
                    else if (prop.PropertyType == typeof(int))
                    {
                        prop.SetValue(this, Convert.ToInt32(appSettingDto.SettingValue.Trim(), CultureInfo.InvariantCulture), null);
                    }
                    else
                    {
                        throw new ArgumentOutOfRangeException(String.Format(CultureInfo.CurrentCulture, "AppSetting.PopulateAppSettingsFromDataStore is not designed to process a property of type {0} (encountered in AppSetting.{1})", prop.PropertyType, prop.Name));
                    }
                }
            }
        }
        public UnitOfWork()
        {
            SqlConnection = new SqlCeConnection(sdfPath);
            Database      = new SqlCeDatabase(SqlConnection);
            Database.Init();

            AppSettingRepository = new AppSettingRepository(Database);
            MstItemRepository    = new MstItemRepository(Database);
        }
        private SmsConfig GetServerConfig()
        {
            var repo = new AppSettingRepository();

            return(new SmsConfig
            {
                ApiKey = repo.Get(ConfigKeys.SmsApiKey).Value,
                Sender = repo.Get(ConfigKeys.SmsSender).Value,
            });
        }
Exemple #5
0
 /// <summary>
 /// Persist the specified application settings to the data store.
 /// </summary>
 public void Save()
 {
     lock (_sharedLock)
     {
         using (var repo = new AppSettingRepository())
         {
             repo.Save(this);
         }
     }
 }
Exemple #6
0
 private EmailConfig GetServerConfig()
 {
     var repo = new AppSettingRepository();
     return new EmailConfig
     {
         ApiKey = repo.Get(ConfigKeys.EmailApiKey).Value,
         Sender = repo.Get(ConfigKeys.EmailSender).Value,
         AccountName = repo.Get(ConfigKeys.EmailAccountName).Value,
     };
 }
        protected void Application_Start()
        {
            ControllerActionRepository actionAuthorizationRepo = new ControllerActionRepository();
            actionAuthorizationRepo.UpdateActionList();

            AppSettingRepository appSettingRepository = new AppSettingRepository();
            appSettingRepository.Reload();

            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);

            var copy = ViewEngines.Engines.ToList();
            ViewEngines.Engines.Clear();
            foreach (var item in copy)
            {
                ViewEngines.Engines.Add(new ProfilingViewEngine(item));
            }

            GlobalFilters.Filters.Add(new ProfilingActionFilter());

            ModelBinders.Binders.Add(typeof(decimal?), new NullableDecimalModelBinder());
            ModelBinders.Binders.Add(typeof(decimal), new NullableDecimalModelBinder());
        }
 public AlarmScanJob()
 {
     deviceRepository     = new DeviceRepository();
     appSettingRepository = new AppSettingRepository();
     dtuDataService       = new DeviceDataService();
 }
Exemple #9
0
        /// <summary>
        /// Persist the specified application settings to the data store. Specify a null value for each parameter whose value is
        /// not changing.
        /// </summary>
        /// <param name="license">A license instance containing the product key for this installation of Gallery Server Pro. The
        /// product key must be validated before invoking this method.</param>
        /// <param name="skin">The name of the skin.</param>
        /// <param name="mediaObjectDownloadBufferSize">The size of each block of bytes when transferring files to streams and vice versa.</param>
        /// <param name="encryptMediaObjectUrlOnClient">Indicates whether security-sensitive portions of the URL to the media object are
        /// encrypted when it is sent to the client browser.</param>
        /// <param name="encryptionKey">The secret key used for the Triple DES algorithm.</param>
        /// <param name="jQueryScriptPath">The absolute or relative path to the jQuery script file.</param>
        /// <param name="jQueryMigrateScriptPath">The absolute or relative path to the jQuery Migrate script file.</param>
        /// <param name="jQueryUiScriptPath">The absolute or relative path to the jQuery UI script file.</param>
        /// <param name="membershipProviderName">The name of the Membership provider for the gallery users.</param>
        /// <param name="roleProviderName">The name of the Role provider for the gallery users.</param>
        /// <param name="enableCache">Indicates whether to store objects in a cache for quicker retrieval.</param>
        /// <param name="allowGalleryAdminToManageUsersAndRoles">Indicates whether gallery administrators are allowed to create, edit, and delete
        /// users and roles.</param>
        /// <param name="allowGalleryAdminViewAllUsersAndRoles">Indicates whether gallery administrators are allowed to see users and roles that
        /// do not have access to current gallery.</param>
        /// <param name="maxNumberErrorItems">The maximum number of error objects to persist to the data store.</param>
        /// <param name="emailFromName">The name associated with the <paramref name="emailFromAddress" /> email address. Emails sent from Gallery Server
        /// will appear to be sent from this person.</param>
        /// <param name="emailFromAddress">The email address associated with <paramref name="emailFromName" />. Emails sent from Gallery Server
        /// will appear to be sent from this email address.</param>
        /// <param name="smtpServer">Specifies the IP address or name of the SMTP server used to send emails. (Examples: 127.0.0.1,
        /// Godzilla, mail.yourisp.com)</param>
        /// <param name="smtpServerPort">Specifies the SMTP server port number used to send emails.</param>
        /// <param name="sendEmailUsingSsl">Specifies whether e-mail functionality uses Secure Sockets Layer (SSL) to encrypt the connection.</param>
        public void Save(ILicense license, string skin, int?mediaObjectDownloadBufferSize, bool?encryptMediaObjectUrlOnClient, string encryptionKey, string jQueryScriptPath, string jQueryMigrateScriptPath, string jQueryUiScriptPath, string membershipProviderName, string roleProviderName, bool?enableCache, bool?allowGalleryAdminToManageUsersAndRoles, bool?allowGalleryAdminViewAllUsersAndRoles, int?maxNumberErrorItems, string emailFromName, string emailFromAddress, string smtpServer, string smtpServerPort, bool?sendEmailUsingSsl)
        {
            bool productKeyWasChanged = false;

            lock (_sharedLock)
            {
                if (license != null)
                {
                    productKeyWasChanged = (License.ProductKey != license.ProductKey);
                    License = license;

                    ValidateLicenseTypeConfiguration();
                }

                if (!String.IsNullOrEmpty(skin))
                {
                    Skin = skin;
                }

                if (mediaObjectDownloadBufferSize.HasValue)
                {
                    MediaObjectDownloadBufferSize = mediaObjectDownloadBufferSize.Value;
                }

                if (encryptMediaObjectUrlOnClient.HasValue)
                {
                    EncryptMediaObjectUrlOnClient = encryptMediaObjectUrlOnClient.Value;
                }

                if (!String.IsNullOrEmpty(encryptionKey))
                {
                    EncryptionKey = encryptionKey;
                }

                if (jQueryScriptPath != null)
                {
                    JQueryScriptPath = jQueryScriptPath;
                }

                if (jQueryScriptPath != null)
                {
                    JQueryMigrateScriptPath = jQueryMigrateScriptPath;
                }

                if (jQueryUiScriptPath != null)
                {
                    JQueryUiScriptPath = jQueryUiScriptPath;
                }

                if (!String.IsNullOrEmpty(membershipProviderName))
                {
                    MembershipProviderName = membershipProviderName;
                }

                if (!String.IsNullOrEmpty(roleProviderName))
                {
                    RoleProviderName = roleProviderName;
                }

                if (enableCache.HasValue)
                {
                    EnableCache = enableCache.Value;
                }

                if (allowGalleryAdminToManageUsersAndRoles.HasValue)
                {
                    AllowGalleryAdminToManageUsersAndRoles = allowGalleryAdminToManageUsersAndRoles.Value;
                }

                if (allowGalleryAdminViewAllUsersAndRoles.HasValue)
                {
                    AllowGalleryAdminToViewAllUsersAndRoles = allowGalleryAdminViewAllUsersAndRoles.Value;
                }

                if (maxNumberErrorItems.HasValue)
                {
                    MaxNumberErrorItems = maxNumberErrorItems.Value;
                }

                if (emailFromName != null)
                {
                    EmailFromName = emailFromName;
                }

                if (emailFromAddress != null)
                {
                    EmailFromAddress = emailFromAddress;
                }

                if (smtpServer != null)
                {
                    SmtpServer = smtpServer;
                }

                if (smtpServerPort != null)
                {
                    SmtpServerPort = smtpServerPort;
                }

                if (sendEmailUsingSsl.HasValue)
                {
                    SendEmailUsingSsl = sendEmailUsingSsl.Value;
                }

                //Factory.GetDataProvider().AppSetting_Save(this);
                using (var repo = new AppSettingRepository())
                {
                    repo.Save(this);
                }

                if (productKeyWasChanged)
                {
                    Factory.ClearWatermarkCache();                     //Changing the product key might cause a different watermark to be rendered
                }
            }
        }
 public void Context()
 {
     _entities = new ConstructionEntities();
     _target = new AppSettingRepository(_entities);
     _results = _target.Retrieve(setting => setting.key == "ApplicationCaption").ToList();
 }
Exemple #11
0
        /// <summary>
        /// Persist the specified application settings to the data store. Specify a null value for each parameter whose value is
        /// not changing.
        /// </summary>
        /// <param name="license">A license instance containing the product key for this installation of Gallery Server Pro. The
        /// product key must be validated before invoking this method.</param>
        /// <param name="skin">The name of the skin.</param>
        /// <param name="mediaObjectDownloadBufferSize">The size of each block of bytes when transferring files to streams and vice versa.</param>
        /// <param name="encryptMediaObjectUrlOnClient">Indicates whether security-sensitive portions of the URL to the media object are
        /// encrypted when it is sent to the client browser.</param>
        /// <param name="encryptionKey">The secret key used for the Triple DES algorithm.</param>
        /// <param name="jQueryScriptPath">The absolute or relative path to the jQuery script file.</param>
        /// <param name="jQueryMigrateScriptPath">The absolute or relative path to the jQuery Migrate script file.</param>
        /// <param name="jQueryUiScriptPath">The absolute or relative path to the jQuery UI script file.</param>
        /// <param name="membershipProviderName">The name of the Membership provider for the gallery users.</param>
        /// <param name="roleProviderName">The name of the Role provider for the gallery users.</param>
        /// <param name="enableCache">Indicates whether to store objects in a cache for quicker retrieval.</param>
        /// <param name="allowGalleryAdminToManageUsersAndRoles">Indicates whether gallery administrators are allowed to create, edit, and delete
        /// users and roles.</param>
        /// <param name="allowGalleryAdminViewAllUsersAndRoles">Indicates whether gallery administrators are allowed to see users and roles that
        /// do not have access to current gallery.</param>
        /// <param name="maxNumberErrorItems">The maximum number of error objects to persist to the data store.</param>
        /// <param name="emailFromName">The name associated with the <paramref name="emailFromAddress" /> email address. Emails sent from Gallery Server
        /// will appear to be sent from this person.</param>
        /// <param name="emailFromAddress">The email address associated with <paramref name="emailFromName" />. Emails sent from Gallery Server
        /// will appear to be sent from this email address.</param>
        /// <param name="smtpServer">Specifies the IP address or name of the SMTP server used to send emails. (Examples: 127.0.0.1,
        /// Godzilla, mail.yourisp.com)</param>
        /// <param name="smtpServerPort">Specifies the SMTP server port number used to send emails.</param>
        /// <param name="sendEmailUsingSsl">Specifies whether e-mail functionality uses Secure Sockets Layer (SSL) to encrypt the connection.</param>
        public void Save(ILicense license, string skin, int? mediaObjectDownloadBufferSize, bool? encryptMediaObjectUrlOnClient, string encryptionKey, string jQueryScriptPath, string jQueryMigrateScriptPath, string jQueryUiScriptPath, string membershipProviderName, string roleProviderName, bool? enableCache, bool? allowGalleryAdminToManageUsersAndRoles, bool? allowGalleryAdminViewAllUsersAndRoles, int? maxNumberErrorItems, string emailFromName, string emailFromAddress, string smtpServer, string smtpServerPort, bool? sendEmailUsingSsl)
        {
            bool productKeyWasChanged = false;

            lock (_sharedLock)
            {
                if (license != null)
                {
                    productKeyWasChanged = (License.ProductKey != license.ProductKey);
                    License = license;

                    ValidateLicenseTypeConfiguration();
                }

                if (!String.IsNullOrEmpty(skin))
                    Skin = skin;

                if (mediaObjectDownloadBufferSize.HasValue)
                    MediaObjectDownloadBufferSize = mediaObjectDownloadBufferSize.Value;

                if (encryptMediaObjectUrlOnClient.HasValue)
                    EncryptMediaObjectUrlOnClient = encryptMediaObjectUrlOnClient.Value;

                if (!String.IsNullOrEmpty(encryptionKey))
                    EncryptionKey = encryptionKey;

                if (jQueryScriptPath != null)
                    JQueryScriptPath = jQueryScriptPath;

                if (jQueryScriptPath != null)
                    JQueryMigrateScriptPath = jQueryMigrateScriptPath;

                if (jQueryUiScriptPath != null)
                    JQueryUiScriptPath = jQueryUiScriptPath;

                if (!String.IsNullOrEmpty(membershipProviderName))
                    MembershipProviderName = membershipProviderName;

                if (!String.IsNullOrEmpty(roleProviderName))
                    RoleProviderName = roleProviderName;

                if (enableCache.HasValue)
                    EnableCache = enableCache.Value;

                if (allowGalleryAdminToManageUsersAndRoles.HasValue)
                    AllowGalleryAdminToManageUsersAndRoles = allowGalleryAdminToManageUsersAndRoles.Value;

                if (allowGalleryAdminViewAllUsersAndRoles.HasValue)
                    AllowGalleryAdminToViewAllUsersAndRoles = allowGalleryAdminViewAllUsersAndRoles.Value;

                if (maxNumberErrorItems.HasValue)
                    MaxNumberErrorItems = maxNumberErrorItems.Value;

                if (emailFromName != null)
                    EmailFromName = emailFromName;

                if (emailFromAddress != null)
                    EmailFromAddress = emailFromAddress;

                if (smtpServer != null)
                    SmtpServer = smtpServer;

                if (smtpServerPort != null)
                    SmtpServerPort = smtpServerPort;

                if (sendEmailUsingSsl.HasValue)
                    SendEmailUsingSsl = sendEmailUsingSsl.Value;

                //Factory.GetDataProvider().AppSetting_Save(this);
                using (var repo = new AppSettingRepository())
                {
                    repo.Save(this);
                }

                if (productKeyWasChanged)
                {
                    Factory.ClearWatermarkCache(); //Changing the product key might cause a different watermark to be rendered
                }
            }
        }
Exemple #12
0
        private void PopulateAppSettingsFromDataStore()
        {
            var asType = typeof(AppSetting);

            using (var repo = new AppSettingRepository())
            {
                foreach (var appSettingDto in repo.GetAll())
                {
                    var prop = asType.GetProperty(appSettingDto.SettingName);

                    if (prop == null)
                    {
                        throw new MissingMemberException(String.Format(CultureInfo.CurrentCulture, "Invalid application setting. An application setting named '{0}' was found in the data store, but no property by that name exists in the class '{1}'. Check the application settings in the data store to ensure they are correct.", appSettingDto.SettingName, asType));
                    }
                    else if (prop.PropertyType == typeof(bool))
                    {
                        prop.SetValue(this, Convert.ToBoolean(appSettingDto.SettingValue.Trim(), CultureInfo.InvariantCulture), null);
                    }
                    else if (prop.PropertyType == typeof(string))
                    {
                        prop.SetValue(this, Convert.ToString(appSettingDto.SettingValue.Trim(), CultureInfo.InvariantCulture), null);
                    }
                    else if (prop.PropertyType == typeof(int))
                    {
                        prop.SetValue(this, Convert.ToInt32(appSettingDto.SettingValue.Trim(), CultureInfo.InvariantCulture), null);
                    }
                    else
                    {
                        throw new ArgumentOutOfRangeException(String.Format(CultureInfo.CurrentCulture, "AppSetting.PopulateAppSettingsFromDataStore is not designed to process a property of type {0} (encountered in AppSetting.{1})", prop.PropertyType, prop.Name));
                    }
                }
            }
        }