Example #1
0
        private void SavePage()
        {
            try
            {
                SystemConfig sysConfig = CMSConfig.GetInstance().LoadConfig();

                sysConfig.Attachments.Directory                  = this.hideen_dirctory.Value.Trim();
                sysConfig.Attachments.HasAbbrImage               = this.chk_HashAbbrImage.Checked ? "1" : "0";
                sysConfig.Attachments.AbbrImageWidth             = this.txt_AbbrImageWidth.Value.Trim();
                sysConfig.Attachments.AbbrImageHeight            = this.txt_AbbrImageHeight.Value.Trim();
                sysConfig.Attachments.HasWaterMark               = this.chk_HasWaterMark.Checked ? "1" : "0";
                sysConfig.Attachments.HasAbbrImageWaterMark      = this.chk_HasAbbrImageWaterMark.Checked ? "1" : "0";
                sysConfig.Attachments.WaterImages.WaterCharater  = this.txt_WaterFont.Value.Trim();
                sysConfig.Attachments.WaterImages.CharColor      = this.txt_WaterFontColor.Value.Trim();
                sysConfig.Attachments.WaterImages.FontFamilyName = this.slt_WaterFontType.Value.Trim();
                sysConfig.Attachments.WaterImages.FontSize       = this.txt_WaterFontSize.Value.Trim();
                sysConfig.Attachments.WaterImages.WaterPicPath   = this.txt_WaterImageUrl.Value.Trim();
                sysConfig.Attachments.WaterImages.Transparence   = this.txt_WaterImageUrlTran.Value.Trim();
                sysConfig.Attachments.WaterImages.XPercent       = this.hidden_XPercent.Value.Trim();
                sysConfig.Attachments.WaterImages.YPercent       = this.hidden_YPercent.Value.Trim();
                sysConfig.Attachments.ImageFormat                = this.txt_ImageFormat.Value.Trim();
                sysConfig.Attachments.VideoFormat                = this.txt_VidoFormat.Value.Trim();
                sysConfig.Attachments.AudioFormat                = this.txt_AudioFormat.Value.Trim();
                sysConfig.Attachments.FlashFormat                = this.txt_Flash.Value.Trim();
                sysConfig.Attachments.AttachmentFormat           = this.txt_AttachmentFormat.Value.Trim();

                CMSConfig.GetInstance().SaveGobalConfig(sysConfig);

                Message.Dialog("附件配置保存成功", "-1", MessageIcon.Success, 0);
            }
            catch { }
        }
        private void SavePage()
        {
            SystemConfig sysConfig = CMSConfig.GetInstance().LoadConfig();

            sysConfig.SysInfoParams.SiteName    = txt_SiteName.Value.Trim();
            sysConfig.SysInfoParams.SiteDomain  = txt_SiteDomain.Value.Trim();
            sysConfig.SysInfoParams.HomeTemplet = txt_HomeTemplet.Value.Trim();
            sysConfig.SysInfoParams.HomeUrl     = txt_HomeUrl.Value.Trim();
            sysConfig.SysInfoParams.HomeName    = txt_HomeName.Value.Trim();

            sysConfig.SysInfoParams.ClassPath      = txt_ClassPath.Value.Trim();
            sysConfig.SysInfoParams.IndexTemplet   = txt_IndexTemplet.Value;
            sysConfig.SysInfoParams.ListTemplet    = txt_ListTemplet.Value.Trim();
            sysConfig.SysInfoParams.ArchiveTemplet = txt_ArchiveTemplet.Value.Trim();
            sysConfig.SysInfoParams.IndexRule      = txt_IndexRule.Value.Trim();
            sysConfig.SysInfoParams.ListRule       = txt_ListRule.Value.Trim();
            sysConfig.SysInfoParams.ArchiveRule    = txt_ArchiveRule.Value.Trim();

            sysConfig.SysInfoParams.MetaKey           = txt_Keywords.Value.Trim();
            sysConfig.SysInfoParams.MetaDescription   = txt_Description.Value.Trim();
            sysConfig.SysInfoParams.SiteCopyRightInfo = txt_SiteCopyRightInfo.Value.Trim();
            sysConfig.SysInfoParams.RecordNo          = txt_RecordNo.Value.Trim();
            sysConfig.SysInfoParams.AdminEmail        = txt_AdminEmail.Value.Trim();
            sysConfig.SysInfoParams.DefaultTemplet    = txt_DefaultTemplet.Value.Trim();
            sysConfig.SysInfoParams.CheckLevel        = slt_CheckLevel.Value.Trim();
            sysConfig.SysInfoParams.LoginValidate     = hidden_LoginValidate.Value.Trim();

            CMSConfig.GetInstance().SaveGobalConfig(sysConfig);
            Message.Dialog("系统配置保存成功", "-1", MessageIcon.Success, 0);
        }
Example #3
0
        private void InitPage()
        {
            InitFontType();
            SystemConfig sysConfig = CMSConfig.GetInstance().LoadConfig();

            this.hideen_dirctory.Value = sysConfig.Attachments.Directory;
            InitDirctory(this.hideen_dirctory.Value.Trim());
            this.chk_HashAbbrImage.Checked         = (sysConfig.Attachments.HasAbbrImage.Trim() == "1");
            this.txt_AbbrImageWidth.Value          = sysConfig.Attachments.AbbrImageWidth;
            this.txt_AbbrImageHeight.Value         = sysConfig.Attachments.AbbrImageHeight;
            this.chk_HasWaterMark.Checked          = sysConfig.Attachments.HasWaterMark.Trim() == "1";
            this.chk_HasAbbrImageWaterMark.Checked = sysConfig.Attachments.HasAbbrImageWaterMark == "1";
            this.txt_WaterFont.Value         = sysConfig.Attachments.WaterImages.WaterCharater;
            this.txt_WaterFontColor.Value    = sysConfig.Attachments.WaterImages.CharColor;
            this.slt_WaterFontType.Value     = sysConfig.Attachments.WaterImages.FontFamilyName;
            this.txt_WaterFontSize.Value     = sysConfig.Attachments.WaterImages.FontSize;
            this.txt_WaterImageUrl.Value     = sysConfig.Attachments.WaterImages.WaterPicPath;
            this.txt_WaterImageUrlTran.Value = sysConfig.Attachments.WaterImages.Transparence;
            this.hidden_XPercent.Value       = sysConfig.Attachments.WaterImages.XPercent;
            this.hidden_YPercent.Value       = sysConfig.Attachments.WaterImages.YPercent;
            this.txt_ImageFormat.Value       = sysConfig.Attachments.ImageFormat;
            this.txt_VidoFormat.Value        = sysConfig.Attachments.VideoFormat;
            this.txt_AudioFormat.Value       = sysConfig.Attachments.AudioFormat;
            this.txt_Flash.Value             = sysConfig.Attachments.FlashFormat;
            this.txt_AttachmentFormat.Value  = sysConfig.Attachments.AttachmentFormat;
        }
        private string ExistsFormat()
        {
            SystemConfig sysConfig = CMSConfig.GetInstance().LoadConfig();

            StringBuilder sb = new StringBuilder();

            sb.Append("<script>\r\n");
            sb.Append("function hasImage(ext) { return (");
            foreach (string img in sysConfig.Attachments.ImageFormat.Split('|'))
            {
                sb.Append("ext == '" + img + "'");
                sb.Append(" || ");
            }
            sb.Remove(sb.ToString().Length - 4, 4);
            sb.Append("); }\r\n");

            sb.Append("function hasVideo(ext) { return(");
            foreach (string video in sysConfig.Attachments.VideoFormat.Split('|'))
            {
                sb.Append("ext == '" + video + "'");
                sb.Append(" || ");
            }
            sb.Remove(sb.ToString().Length - 4, 4);
            sb.Append("); }\r\n");

            sb.Append("function hasAudio(ext) { return(");
            foreach (string audio in sysConfig.Attachments.AudioFormat.Split('|'))
            {
                sb.Append("ext == '" + audio + "'");
                sb.Append(" || ");
            }
            sb.Remove(sb.ToString().Length - 4, 4);
            sb.Append("); }\r\n");

            sb.Append("function hasFlash(ext) { return(");
            foreach (string flash in sysConfig.Attachments.FlashFormat.Split('|'))
            {
                sb.Append("ext == '" + flash + "'");
                sb.Append(" || ");
            }
            sb.Remove(sb.ToString().Length - 4, 4);
            sb.Append("); }\r\n");

            sb.Append("function hasAttachment(ext) { return(");
            foreach (string attachment in sysConfig.Attachments.AttachmentFormat.Split('|'))
            {
                sb.Append("ext == '" + attachment + "'");
                sb.Append(" || ");
            }
            sb.Remove(sb.ToString().Length - 4, 4);
            sb.Append("); }\r\n");
            sb.Append("</script>");
            return(sb.ToString());
        }
Example #5
0
        /// <summary>
        /// 默认设置
        /// </summary>
        private void InitDefaultData()
        {
            SystemConfig sysConfig = CMSConfig.GetInstance().LoadConfig();

            txt_ClassPath.Value          = sysConfig.SysInfoParams.ClassPath.Trim();
            slt_CheckLevel.SelectedIndex = slt_CheckLevel.Items.IndexOf(slt_CheckLevel.Items.FindByValue(sysConfig.SysInfoParams.CheckLevel));
            txt_IndexTemplet.Value       = sysConfig.SysInfoParams.IndexTemplet.Trim();
            txt_ListTemplet.Value        = sysConfig.SysInfoParams.ListTemplet.Trim();
            txt_ArchiveTemplet.Value     = sysConfig.SysInfoParams.ArchiveTemplet.Trim();
            txt_IndexRule.Value          = sysConfig.SysInfoParams.IndexRule.Trim();
            txt_ListRule.Value           = sysConfig.SysInfoParams.ListRule.Trim();
            txt_ArchiveRule.Value        = sysConfig.SysInfoParams.ArchiveRule.Trim();
            txt_Keywords.Value           = sysConfig.SysInfoParams.MetaKey.Trim();
            txt_Description.Value        = sysConfig.SysInfoParams.MetaDescription.Trim();
        }
Example #6
0
        protected void Button4_Click(object sender, EventArgs e)
        {
            long execTime = 0;

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            for (int i = 0; i < 100000; i++)
            {
                string path = CMSConfig.GetInstance().LoadConfig().Attachments.Path;
            }

            sw.Stop();
            execTime = sw.ElapsedMilliseconds;

            JScript.ShowMessage(this, string.Format("用时{0}毫秒", execTime.ToString()));
        }
Example #7
0
        private string AttachmentListToJson()
        {
            StringBuilder sbJson    = new StringBuilder();
            SystemConfig  sysConfig = CMSConfig.GetInstance().LoadConfig();

            sbJson.Append("{");
            sbJson.Append("'HasWaterMark':'" + sysConfig.Attachments.HasWaterMark + "'");
            sbJson.Append(",");
            sbJson.Append("'HasAbbrImage':'" + sysConfig.Attachments.HasAbbrImage + "'");
            sbJson.Append(",");
            sbJson.Append("'HasHasAbbrImageWaterMarkWaterMark':'" + sysConfig.Attachments.HasAbbrImageWaterMark + "'");
            sbJson.Append(",");
            sbJson.Append("'AbbrImageWidth':'" + sysConfig.Attachments.AbbrImageWidth + "'");
            sbJson.Append(",");
            sbJson.Append("'AbbrImageHeight':'" + sysConfig.Attachments.AbbrImageHeight + "'");
            sbJson.Append(",");

            DataTable dtAttachmentType = bllSelectionConfig.GetSectionListAttachmentType();

            if (dtAttachmentType != null && dtAttachmentType.Rows.Count > 0)
            {
                sbJson.Append("'attachmentType':'");
                int rdo_count = 1;
                foreach (DataRow dr in dtAttachmentType.Rows)
                {
                    sbJson.Append("<span>");
                    if (rdo_count == 1)
                    {
                        sbJson.Append("<input type=\"radio\" id=\"rdo_" + rdo_count.ToString() + "\" name=\"rdo\" checked=\"checked\" value=\"" + dr["key"].ToString() + "\" onclick=\"setAttr(this)\" />");
                    }
                    else
                    {
                        sbJson.Append("<input type=\"radio\" id=\"rdo_" + rdo_count.ToString() + "\" name=\"rdo\" value=\"" + dr["key"].ToString() + "\" onclick=\"setAttr(this)\" />");
                    }
                    sbJson.Append("<label for=\"rdo_" + rdo_count.ToString() + "\">" + dr["value"].ToString() + "</label>");
                    sbJson.Append("</span>");
                    rdo_count++;
                }
            }
            sbJson.Append("'}");
            return(sbJson.ToString());
        }
        private void InitPage()
        {
            InitCheckLevel();
            SystemConfig sysConfig = CMSConfig.GetInstance().LoadConfig();

            txt_SiteName.Value    = sysConfig.SysInfoParams.SiteName.Trim();
            txt_SiteDomain.Value  = sysConfig.SysInfoParams.SiteDomain.Trim();
            txt_HomeTemplet.Value = sysConfig.SysInfoParams.HomeTemplet.Trim();
            txt_HomeUrl.Value     = sysConfig.SysInfoParams.HomeUrl.Trim();
            txt_HomeName.Value    = sysConfig.SysInfoParams.HomeName.Trim();

            txt_ClassPath.Value      = sysConfig.SysInfoParams.ClassPath.Trim();
            txt_IndexTemplet.Value   = sysConfig.SysInfoParams.IndexTemplet.Trim();
            txt_ListTemplet.Value    = sysConfig.SysInfoParams.ListTemplet.Trim();
            txt_ArchiveTemplet.Value = sysConfig.SysInfoParams.ArchiveTemplet.Trim();
            txt_IndexRule.Value      = sysConfig.SysInfoParams.IndexRule.Trim();
            txt_ListRule.Value       = sysConfig.SysInfoParams.ListRule.Trim();
            txt_ArchiveRule.Value    = sysConfig.SysInfoParams.ArchiveRule.Trim();

            txt_Keywords.Value           = sysConfig.SysInfoParams.MetaKey.Trim();
            txt_Description.Value        = sysConfig.SysInfoParams.MetaDescription.Trim();
            txt_SiteCopyRightInfo.Value  = sysConfig.SysInfoParams.SiteCopyRightInfo.Trim();
            txt_RecordNo.Value           = sysConfig.SysInfoParams.RecordNo.Trim();
            txt_AdminEmail.Value         = sysConfig.SysInfoParams.AdminEmail.Trim();
            txt_DefaultTemplet.Value     = sysConfig.SysInfoParams.DefaultTemplet.Trim();
            slt_CheckLevel.SelectedIndex = slt_CheckLevel.Items.IndexOf(slt_CheckLevel.Items.FindByValue(sysConfig.SysInfoParams.CheckLevel));
            hidden_LoginValidate.Value   = sysConfig.SysInfoParams.LoginValidate.Trim();
            if (hidden_LoginValidate.Value.ToString() == "1")
            {
                rdo_yes.Checked = true;
            }
            else
            {
                rdo_no.Checked = true;
            }
        }
Example #9
0
 public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder, CMSConfig config)
 {
     builder.RegisterType <FacebookProviderAuthorizer>().As <IOAuthProviderFacebookAuthorizer>().InstancePerLifetimeScope();
 }
Example #10
0
        // This method gets called by the runtime. Use this method to add services to the container
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

            services.AddLogging(builder => {
                builder.AddILoggingBuilderInstance();
            });

            services.TryAddSingleton <ISeriLogger, SeriLogger>();
            services.TryAddSingleton <IStaticWebsiteService, S3StaticWebsiteService>();
            services.TryAddSingleton <IViewRenderer, ViewRenderer>();
            services.TryAddTransient <IMailService, MailService>();
            services.TryAddTransient <IContentService, ContentService>();
            services.TryAddTransient <IBankHolidayService, BankHolidayService>();

            EnvironmentConfig environmentConfig = new EnvironmentConfig();
            AWSConfig         awsConfig         = new AWSConfig();
            CloudFrontConfig  cloudFrontConfig  = new CloudFrontConfig();
            CMSConfig         cmsConfig         = new CMSConfig();
            MailChimpConfig   mailChimpConfig   = new MailChimpConfig();
            MailConfig        mailConfig        = new MailConfig();

            Configuration.Bind("AppSettings:Environment", environmentConfig);
            Configuration.Bind("AWS", awsConfig);
            Configuration.Bind("AWS:CloudFront", cloudFrontConfig);
            Configuration.Bind("CMS", cmsConfig);
            Configuration.Bind("MailChimp", mailChimpConfig);
            Configuration.Bind("Mail", mailConfig);

            services.AddSingleton(environmentConfig)
            .AddSingleton(awsConfig)
            .AddSingleton(cloudFrontConfig)
            .AddSingleton(cmsConfig)
            .AddSingleton(mailChimpConfig)
            .AddSingleton(mailConfig);

            services.AddMailChimpClient(mailChimpConfig.ApiKey);

            AmazonS3Config s3config;

            if (environmentConfig.Name == "local")  //TODO: Should use Environment.IsDevelopment() here. When running tests it returns "Production"
            {
                s3config = new AmazonS3Config()
                {
                    RegionEndpoint = Region,
                    ServiceURL     = awsConfig.ServiceURL,
                    ForcePathStyle = true
                };
            }
            else
            {
                s3config = new AmazonS3Config()
                {
                    RegionEndpoint = Region
                };
            }
            services.AddTransient <IAmazonS3>((sP) =>
            {
                return(new AmazonS3Client(awsConfig.AccessKey, awsConfig.SecretKey, s3config));
            });

            var cloudfrontConfig = new AmazonCloudFrontConfig()
            {
                RegionEndpoint = Region
            };

            services.AddTransient <IAmazonCloudFront>((acf) =>
            {
                return(new AmazonCloudFrontClient(awsConfig.AccessKey, awsConfig.SecretKey, cloudfrontConfig));
            });

            services.AddControllers();
        }
 /// <summary>
 /// Replace the existing CMS config with a new instance
 /// </summary>
 /// <param name="cmsConfig"></param>
 /// <returns></returns>
 public MASWebApplicationFactory WithCMSConfig(CMSConfig cmsConfig)
 {
     serviceCollectionsActions.Add(services => services.ReplaceService(cmsConfig));
     return(this);
 }
Example #12
0
 public InstallController(CMSConfig config)
 {
     this._config = config;
 }
Example #13
0
 public ContentService(ILogger <ContentService> logger, CMSConfig cmsConfig)
 {
     _logger    = logger;
     _cmsConfig = cmsConfig;
 }
Example #14
0
 public CMSConfig()
 {
     Current = this;
 }
        public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder, CMSConfig config)
        {
            //HTTP context and other related stuff
            builder.Register(c =>
                             //register FakeHttpContext when HttpContext is not available
                             HttpContext.Current != null ?
                             (new HttpContextWrapper(HttpContext.Current) as HttpContextBase) :
                             (new AutoHttpContext("~/") as HttpContextBase))
            .As <HttpContextBase>().InstancePerRequest();

            builder.Register(c => c.Resolve <HttpContextBase>().Request)
            .As <HttpRequestBase>()
            .InstancePerLifetimeScope();

            builder.Register(c => c.Resolve <HttpContextBase>().Response)
            .As <HttpResponseBase>()
            .InstancePerRequest();

            builder.Register(c => c.Resolve <HttpContextBase>().Server)
            .As <HttpServerUtilityBase>()
            .InstancePerRequest();

            //builder.Register(c => c.Resolve<HttpContextBase>().Session)
            //    .As<HttpSessionStateBase>()
            //    .InstancePerRequest();

            builder.RegisterType <UrlHelper>().As <IUrlHelper>().InstancePerLifetimeScope();

            //controllers
            builder.RegisterControllers(typeFinder.GetAssemblies().ToArray());

            // Data-Layer
            var dataSettingsManager  = new DataSettingsContext();
            var dataProviderSettings = dataSettingsManager.LoadSettings();

            builder.Register(c => dataSettingsManager.LoadSettings()).As <DatabaseSettings>();
            builder.Register(x => new EfDataProviderManager(x.Resolve <DatabaseSettings>())).As <DataManager>().InstancePerDependency();

            builder.Register(x => x.Resolve <DataManager>().LoadDataProvider()).As <IDataProvider>().InstancePerDependency();

            if (dataProviderSettings != null && dataProviderSettings.IsValid())
            {
                var efDataProviderManager = new EfDataProviderManager(dataSettingsManager.LoadSettings());
                var dataProvider          = efDataProviderManager.LoadDataProvider();
                dataProvider.InitConnectionFactory();

                builder.Register <EF.Data.IDbContext>(c => new EFDbContext(dataProviderSettings.DataConnectionString)).InstancePerLifetimeScope();
                builder.Register <ITrackerContext>(c => new EFDbContext(dataProviderSettings.DataConnectionString)).InstancePerLifetimeScope();
            }
            else
            {
                builder.Register <EF.Data.IDbContext>(c => new EFDbContext(dataSettingsManager.LoadSettings().DataConnectionString)).InstancePerLifetimeScope();
                builder.Register <ITrackerContext>(c => new EFDbContext(dataSettingsManager.LoadSettings().DataConnectionString)).InstancePerLifetimeScope();

                //builder.Register<IDbContext>(c => new EFDbContext(dataSettingsManager.LoadSettings().DataConnectionString == null ? "..." : dataSettingsManager.LoadSettings().DataConnectionString)).InstancePerLifetimeScope();
            }

            builder.RegisterGeneric(typeof(EFRepository <>)).As(typeof(IRepository <>)).InstancePerLifetimeScope();
            // Register Services
            builder.RegisterType <WebContext>().As <IWebContext>().InstancePerLifetimeScope();
            builder.RegisterType <SocialSettingService>().As <ISocialSettingService>().InstancePerLifetimeScope();
            builder.RegisterSource(new SettingsSource());

            builder.RegisterType <SystemLogService>().As <ISystemLogService>().InstancePerLifetimeScope();
            builder.RegisterType <AuditService>().As <IAuditService>().InstancePerLifetimeScope();
            builder.RegisterType <BlogService>().As <IBlogService>().InstancePerLifetimeScope();
            builder.RegisterType <CommentService>().As <ICommentService>().InstancePerLifetimeScope();
            builder.RegisterType <EventService>().As <IEventService>().InstancePerLifetimeScope();
            builder.RegisterType <PictureService>().As <IPictureService>().InstancePerLifetimeScope();
            builder.RegisterType <ReplyService>().As <IReplyService>().InstancePerLifetimeScope();
            builder.RegisterType <RoleService>().As <IRoleService>().InstancePerLifetimeScope();
            builder.RegisterType <PermissionService>().As <IPermissionService>().InstancePerLifetimeScope();
            builder.RegisterType <UserService>().As <IUserService>().InstancePerLifetimeScope();
            builder.RegisterType <VideoService>().As <IVideoService>().InstancePerLifetimeScope();
            builder.RegisterType <FormsAuthenticationService>().As <IAuthenticationService>().InstancePerLifetimeScope();
            builder.RegisterType <UserContext>().As <IUserContext>().InstancePerLifetimeScope();
            builder.RegisterType <SliderService>().As <ISliderService>().InstancePerLifetimeScope();
            builder.RegisterType <SettingService>().As <ISettingService>().InstancePerLifetimeScope();

            builder.RegisterType <ProductService>().As <IProductService>().InstancePerLifetimeScope();
            builder.RegisterType <FileService>().As <IFileService>().InstancePerLifetimeScope();
            builder.RegisterType <FeedbackService>().As <IFeedbackService>().InstancePerLifetimeScope();
            builder.RegisterType <EmailService>().As <IEmailService>().InstancePerLifetimeScope();
            builder.RegisterType <TemplateService>().As <ITemplateService>().InstancePerLifetimeScope();
            builder.RegisterType <CustomPageService>().As <ICustomPageService>().InstancePerLifetimeScope();
            builder.RegisterType <NewsService>().As <INewsService>().InstancePerLifetimeScope();
            builder.RegisterType <UrlService>().As <IUrlService>().InstancePerLifetimeScope();
            builder.RegisterType <SMSService>().As <ISMSService>().InstancePerLifetimeScope();
            builder.RegisterType <RouteRegistrar>().As <IRouteRegistrar>().InstancePerLifetimeScope();
            builder.RegisterType <SocialModelFactory>().As <ISocialModelFactory>().InstancePerLifetimeScope();
            builder.RegisterType <SocialPluginService>().As <ISocialPluginService>().InstancePerLifetimeScope();
            builder.RegisterType <SocialAuthorizer>().As <ISocialAuthorizer>().InstancePerLifetimeScope();
            builder.RegisterType <OpenAuthenticationService>().As <IOpenAuthenticationService>().InstancePerLifetimeScope();
            builder.RegisterType <LicenseService>().As <ILicenseService>().InstancePerLifetimeScope();

            builder.RegisterType <CountryReverseGeocodeService>().As <ICountryReverseGeocodeService>().InstancePerLifetimeScope();
            if (!DatabaseHelper.DatabaseIsInstalled())
            {
                builder.RegisterType <InstallationService>().As <IInstallationService>().InstancePerLifetimeScope();
            }

            builder.RegisterType <CultureHelper>().As <ICultureHelper>().InstancePerLifetimeScope();

            // Scheduled Tasks
            builder.RegisterType <ScheduleTaskService>().As <IScheduleTaskService>().InstancePerLifetimeScope();
            builder.RegisterType <DefaultMachineNameProvider>().As <IMachineNameProvider>().InstancePerLifetimeScope();

            builder.Register(c => c.Resolve <HttpContextBase>().Session).As <HttpSessionStateBase>().InstancePerLifetimeScope();
        }