コード例 #1
0
        private void SaveSettings()
        {
            try
            {
                StringBuilder sbSettingKey   = new StringBuilder();
                StringBuilder sbSettingValue = new StringBuilder();
                StringBuilder sbSettingType  = new StringBuilder();

                //Collecting Setting Values
                sbSettingKey.Append(SageFrameSettingKeys.SuperUserPortalId + ",");
                sbSettingValue.Append(ddlHostPortal.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SuperUserTitle
                sbSettingKey.Append(SageFrameSettingKeys.SuperUserTitle + ",");
                sbSettingValue.Append(txtHostTitle.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SuperUserURL
                sbSettingKey.Append(SageFrameSettingKeys.SuperUserURL + ",");
                sbSettingValue.Append(txtHostUrl.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SuperUserEmail
                sbSettingKey.Append(SageFrameSettingKeys.SuperUserEmail + ",");
                sbSettingValue.Append(txtHostEmail.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SuperUserCopyright
                sbSettingKey.Append(SageFrameSettingKeys.SuperUserCopyright + ",");
                sbSettingValue.Append(chkCopyright.Checked + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.UseCustomErrorMessages
                sbSettingKey.Append(SageFrameSettingKeys.UseCustomErrorMessages + ",");
                sbSettingValue.Append(chkUseCustomErrorMessages.Checked + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SageFrameCSS
                sbSettingKey.Append(SageFrameSettingKeys.SageFrameCSS + ",");
                sbSettingValue.Append(ddlTemplate.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.PaymentProcessor
                //sbSettingKey.Append(SageFrameSettingKeys.PaymentProcessor + ",");
                //sbSettingValue.Append(ddlPaymentProcessor.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.ProcessorUserId
                //sbSettingKey.Append(SageFrameSettingKeys.ProcessorUserId + ",");
                //sbSettingValue.Append(txtPaymentProcessorUserID.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.ProcessorPassword
                //sbSettingKey.Append(SageFrameSettingKeys.ProcessorPassword + ",");
                //sbSettingValue.Append(txtPaymentProcessorPassword.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.SuperUserFee
                //sbSettingKey.Append(SageFrameSettingKeys.SuperUserFee + ",");
                //sbSettingValue.Append(txtHostingFee.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.SuperUserCurrency
                //sbSettingKey.Append(SageFrameSettingKeys.SuperUserCurrency + ",");
                //sbSettingValue.Append(ddlHostingCurrency.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.SuperUserSpace
                //sbSettingKey.Append(SageFrameSettingKeys.SuperUserSpace + ",");
                //sbSettingValue.Append(txtHostingSpace.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.PageQuota
                //sbSettingKey.Append(SageFrameSettingKeys.PageQuota + ",");
                //sbSettingValue.Append(txtPageQuota.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.UserQuota
                //sbSettingKey.Append(SageFrameSettingKeys.UserQuota + ",");
                //sbSettingValue.Append(txtUserQuota.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.DemoPeriod
                //sbSettingKey.Append(SageFrameSettingKeys.DemoPeriod + ",");
                //sbSettingValue.Append(txtDemoPeriod.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.DemoSignup
                //sbSettingKey.Append(SageFrameSettingKeys.DemoSignup + ",");
                //sbSettingValue.Append(chkAnonymousDemoSignup.Checked + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.UseFriendlyUrls
                sbSettingKey.Append(SageFrameSettingKeys.UseFriendlyUrls + ",");
                sbSettingValue.Append(chkUseFriendlyUrls.Checked + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.ProxyServer
                //sbSettingKey.Append(SageFrameSettingKeys.ProxyServer + ",");
                //sbSettingValue.Append(txtProxyServer.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.ProxyPort
                //sbSettingKey.Append(SageFrameSettingKeys.ProxyPort + ",");
                //sbSettingValue.Append(txtProxyPort.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.ProxyUsername
                //sbSettingKey.Append(SageFrameSettingKeys.ProxyUsername + ",");
                //sbSettingValue.Append(txtProxyUsername.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.ProxyPassword
                //sbSettingKey.Append(SageFrameSettingKeys.ProxyPassword + ",");
                //sbSettingValue.Append(txtProxyPassword.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.WebRequestTimeout
                //sbSettingKey.Append(SageFrameSettingKeys.WebRequestTimeout + ",");
                //sbSettingValue.Append(txtWebRequestTimeOut.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SMTPServer
                sbSettingKey.Append(SageFrameSettingKeys.SMTPServer + ",");
                sbSettingValue.Append(txtSMTPServerAndPort.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SMTPAuthentication
                sbSettingKey.Append(SageFrameSettingKeys.SMTPAuthentication + ",");
                sbSettingValue.Append(rblSMTPAuthentication.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SMTPEnableSSL
                sbSettingKey.Append(SageFrameSettingKeys.SMTPEnableSSL + ",");
                sbSettingValue.Append(chkSMTPEnableSSL.Checked + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SMTPUsername
                sbSettingKey.Append(SageFrameSettingKeys.SMTPUsername + ",");
                sbSettingValue.Append(txtSMTPUserName.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.SMTPPassword
                sbSettingKey.Append(SageFrameSettingKeys.SMTPPassword + ",");
                sbSettingValue.Append(txtSMTPPassword.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.jQueryDebug
                //sbSettingKey.Append(SageFrameSettingKeys.jQueryDebug + ",");
                //sbSettingValue.Append(chkUseJQueryDebugVersion.Checked + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.jQuerySuperUsered
                //sbSettingKey.Append(SageFrameSettingKeys.jQuerySuperUsered + ",");
                //sbSettingValue.Append(chkUseHostedJQueryVersion.Checked + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                ////SageFrameSettingKeys.jQueryUrl
                //sbSettingKey.Append(SageFrameSettingKeys.jQueryUrl + ",");
                //sbSettingValue.Append(txtHostedJQueryURL.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.FileExtensions
                sbSettingKey.Append(SageFrameSettingKeys.FileExtensions + ",");
                sbSettingValue.Append(txtFileExtensions.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                //SageFrameSettingKeys.HelpURL
                sbSettingKey.Append(SageFrameSettingKeys.HelpURL + ",");
                sbSettingValue.Append(txtHelpUrl.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SuperUser + ",");

                string SettingTypes = sbSettingType.ToString();
                if (SettingTypes.Contains(","))
                {
                    SettingTypes = SettingTypes.Remove(SettingTypes.LastIndexOf(","));
                }
                string SettingKeys = sbSettingKey.ToString();
                if (SettingKeys.Contains(","))
                {
                    SettingKeys = SettingKeys.Remove(SettingKeys.LastIndexOf(","));
                }
                string SettingValues = sbSettingValue.ToString();
                if (SettingValues.Contains(","))
                {
                    SettingValues = SettingValues.Remove(SettingValues.LastIndexOf(","));
                }
                SettingProvider sageSP = new SettingProvider();
                sageSP.SaveSageSettings(SettingTypes, SettingKeys, SettingValues, GetUsername, "1");
                HttpContext.Current.Cache.Remove("SageSetting");
                BindData();
                ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("PortalSettings", "SettingUpdatedSuccessfully"), "", SageMessageType.Success);
            }
            catch (Exception ex)
            {
                ProcessException(ex);
                lblError.Text = ex.Message;
            }
        }
コード例 #2
0
        private void SavePortalSettings()
        {
            try
            {
                SettingProvider sageSP = new SettingProvider();
                //Add Single Key Values that may contain Comma values so need to be add sepratly
                #region "Single Key Value Add/Updatge"

                //SageFrameSettingKeys.PageTitle
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.PageTitle,
                                       txtPortalTitle.Text.Trim(), GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.MetaDescription
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.MetaDescription,
                                       txtDescription.Text, GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.MetaKeywords
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.MetaKeywords,
                                       txtKeyWords.Text, GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.PortalLogoTemplate
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.PortalLogoTemplate,
                                       txtLogoTemplate.Text.Trim(), GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.PortalCopyright
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.PortalCopyright,
                                       txtCopyright.Text.Trim(), GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.PortalTimeZone
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.PortalTimeZone,
                                       ddlPortalTimeZone.SelectedItem.Value, GetUsername, GetPortalID.ToString());

                #endregion

                //For Multiple Keys and Values
                #region "Multiple Key Value Add/Update"

                StringBuilder sbSettingKey   = new StringBuilder();
                StringBuilder sbSettingValue = new StringBuilder();
                StringBuilder sbSettingType  = new StringBuilder();

                //Collecting Setting Values


                //SageFrameSettingKeys.SiteAdminEmailAddress
                sbSettingKey.Append(SageFrameSettingKeys.SiteAdminEmailAddress + ",");
                sbSettingValue.Append(txtSiteAdminEmailAddress.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalUserProfileMaxImageSize
                //sbSettingKey.Append(SageFrameSettingKeys.PortalUserProfileMaxImageSize + ",");
                //sbSettingValue.Append(txtPortalUserProfileMaxImageSize.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");

                ////SageFrameSettingKeys.PortalUserProfileMediumImageSize
                //sbSettingKey.Append(SageFrameSettingKeys.PortalUserProfileMediumImageSize + ",");
                //sbSettingValue.Append(txtPortalUserProfileMediumImageSize.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");

                ////SageFrameSettingKeys.PortalUserProfileSmallImageSize
                //sbSettingKey.Append(SageFrameSettingKeys.PortalUserProfileSmallImageSize + ",");
                //sbSettingValue.Append(txtPortalUserProfileSmallImageSize.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");


                ////SageFrameSettingKeys.PortalSearchEngine
                //sbSettingKey.Append(SageFrameSettingKeys.PortalSearchEngine + ",");
                //sbSettingValue.Append(ddlSearchEngine.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalGoogleAdSenseID
                sbSettingKey.Append(SageFrameSettingKeys.PortalGoogleAdSenseID + ",");
                sbSettingValue.Append(txtPortalGoogleAdSenseID.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalCssTemplate
                sbSettingKey.Append(SageFrameSettingKeys.PortalCssTemplate + ",");
                sbSettingValue.Append(ddlTemplate.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalShowProfileLink
                sbSettingKey.Append(SageFrameSettingKeys.PortalShowProfileLink + ",");
                sbSettingValue.Append(rblPortalShowProfileLink.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.RememberCheckbox
                sbSettingKey.Append(SageFrameSettingKeys.RememberCheckbox + ",");
                sbSettingValue.Append(chkEnableRememberme.Checked + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //CssJs Optimization
                sbSettingKey.Append(SageFrameSettingKeys.OptimizeCss + ",");
                sbSettingValue.Append(chkOptCss.Checked + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                sbSettingKey.Append(SageFrameSettingKeys.OptimizeJs + ",");
                sbSettingValue.Append(chkOptJs.Checked + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");



                ////SageFrameSettingKeys.PortalShowSubscribe
                //sbSettingKey.Append(SageFrameSettingKeys.PortalShowSubscribe + ",");
                //sbSettingValue.Append(rblPortalShowSubscribe.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalShowLogo
                //sbSettingKey.Append(SageFrameSettingKeys.PortalShowLogo + ",");
                //sbSettingValue.Append(rblPortalShowLogo.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalShowFooterLink
                //sbSettingKey.Append(SageFrameSettingKeys.PortalShowFooterLink + ",");
                //sbSettingValue.Append(rblPortalShowFooterLink.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");


                ////SageFrameSettingKeys.PortalShowFooter
                //sbSettingKey.Append(SageFrameSettingKeys.PortalShowFooter + ",");
                //sbSettingValue.Append(rblPortalShowFooter.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");


                ////SageFrameSettingKeys.PortalShowBreadCrum
                //sbSettingKey.Append(SageFrameSettingKeys.PortalShowBreadCrum + ",");
                //sbSettingValue.Append(rblPortalShowBreadCrum.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");


                ////SageFrameSettingKeys.PortalShowCopyRight
                //sbSettingKey.Append(SageFrameSettingKeys.PortalShowCopyRight + ",");
                //sbSettingValue.Append(rblPortalShowCopyRight.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");


                ////SageFrameSettingKeys.PortalShowLoginStatus
                //sbSettingKey.Append(SageFrameSettingKeys.PortalShowLoginStatus + ",");
                //sbSettingValue.Append(rblPortalShowLoginStatus.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalUserRegistration
                sbSettingKey.Append(SageFrameSettingKeys.PortalUserRegistration + ",");
                sbSettingValue.Append(rblUserRegistration.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.IsPortalMenuIsImage
                sbSettingKey.Append(SageFrameSettingKeys.IsPortalMenuIsImage + ",");
                sbSettingValue.Append(rblIsPortalMenuIsImage.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalMenuImageExtension
                sbSettingKey.Append(SageFrameSettingKeys.PortalMenuImageExtension + ",");
                sbSettingValue.Append(txtPortalMenuImageExtension.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");



                //SageFrameSettingKeys.PortalLoginpage
                sbSettingKey.Append(SageFrameSettingKeys.PortalLoginpage + ",");
                sbSettingValue.Append(ddlLoginPage.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalUserActivation
                sbSettingKey.Append(SageFrameSettingKeys.PortalUserActivation + ",");
                sbSettingValue.Append(ddlPortalUserActivation.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalRegistrationPage
                sbSettingKey.Append(SageFrameSettingKeys.PortalRegistrationPage + ",");
                sbSettingValue.Append(ddlUserRegistrationPage.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalForgotPassword
                sbSettingKey.Append(SageFrameSettingKeys.PortalForgotPassword + ",");
                sbSettingValue.Append(ddlPortalForgotPassword.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalPageNotAccessible
                sbSettingKey.Append(SageFrameSettingKeys.PortalPageNotAccessible + ",");
                sbSettingValue.Append(ddlPortalPageNotAccessible.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalPageNotFound
                sbSettingKey.Append(SageFrameSettingKeys.PortalPageNotFound + ",");
                sbSettingValue.Append(ddlPortalPageNotFound.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalPasswordRecovery
                sbSettingKey.Append(SageFrameSettingKeys.PortalPasswordRecovery + ",");
                sbSettingValue.Append(ddlPortalPasswordRecovery.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //PortalUserProfilePage
                sbSettingKey.Append(SageFrameSettingKeys.PortalUserProfilePage + ",");
                sbSettingValue.Append(ddlPortalUserProfilePage.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //PortalDefaultPage
                sbSettingKey.Append(SageFrameSettingKeys.PortalDefaultPage + ",");
                sbSettingValue.Append(ddlPortalDefaultPage.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                ////SageFrameSettingKeys.PortalCurrency
                //sbSettingKey.Append(SageFrameSettingKeys.PortalCurrency + ",");
                //sbSettingValue.Append(ddlCurrency.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");

                ////SageFrameSettingKeys.PortalPaymentProcessor
                //sbSettingKey.Append(SageFrameSettingKeys.PortalPaymentProcessor + ",");
                //sbSettingValue.Append(ddlPaymentProcessor.SelectedItem.Value + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");

                ////SageFrameSettingKeys.PortalProcessorUserId
                //sbSettingKey.Append(SageFrameSettingKeys.PortalProcessorUserId + ",");
                //sbSettingValue.Append(txtProcessorUserId.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");

                ////SageFrameSettingKeys.PortalProcessorPassword
                //sbSettingKey.Append(SageFrameSettingKeys.PortalProcessorPassword + ",");
                //sbSettingValue.Append(txtProcessorPassword.Text.Trim() + ",");
                //sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalDefaultLanguage
                sbSettingKey.Append(SageFrameSettingKeys.PortalDefaultLanguage + ",");
                sbSettingValue.Append(ddlDefaultLanguage.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                string SettingTypes = sbSettingType.ToString();
                if (SettingTypes.Contains(","))
                {
                    SettingTypes = SettingTypes.Remove(SettingTypes.LastIndexOf(","));
                }
                string SettingKeys = sbSettingKey.ToString();
                if (SettingKeys.Contains(","))
                {
                    SettingKeys = SettingKeys.Remove(SettingKeys.LastIndexOf(","));
                }
                string SettingValues = sbSettingValue.ToString();
                if (SettingValues.Contains(","))
                {
                    SettingValues = SettingValues.Remove(SettingValues.LastIndexOf(","));
                }


                sageSP.SaveSageSettings(SettingTypes, SettingKeys, SettingValues, GetUsername, GetPortalID.ToString());
                HttpContext.Current.Cache.Remove("SageSetting");
                BindData();

                #endregion

                ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("PortalSettings", "PortalSettingIsSavedSuccessfully"), "", SageMessageType.Success);
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
コード例 #3
0
        private void SavePortalSettings()
        {
            try
            {
                SettingProvider sageSP = new SettingProvider();
                //Add Single Key Values that may contain Comma values so need to be add sepratly
                #region "Single Key Value Add/Updatge"

                //SageFrameSettingKeys.PageTitle
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.PageTitle,
                                       txtPortalTitle.Text.Trim(), GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.MetaDescription
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.MetaDescription,
                                       txtDescription.Text, GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.MetaKeywords
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.MetaKeywords,
                                       txtKeyWords.Text, GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.PortalLogoTemplate
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.PortalLogoTemplate,
                                       txtLogoTemplate.Text.Trim(), GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.PortalCopyright
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.PortalCopyright,
                                       txtCopyright.Text.Trim(), GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.PortalTimeZone
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.PortalTimeZone,
                                       ddlPortalTimeZone.SelectedItem.Value, GetUsername, GetPortalID.ToString());

                //SageFrameSettingKeys.Message Setting
                string mt = rdbDefault.Checked == true ? rdbDefault.Value : rdbCustom.Value;
                sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.MessageTemplate,
                                       mt, GetUsername, GetPortalID.ToString());

                #endregion

                //For Multiple Keys and Values
                #region "Multiple Key Value Add/Update"

                StringBuilder sbSettingKey   = new StringBuilder();
                StringBuilder sbSettingValue = new StringBuilder();
                StringBuilder sbSettingType  = new StringBuilder();

                //Collecting Setting Values
                ///Super user settings
                StringBuilder sbSettingKey_super   = new StringBuilder();
                StringBuilder sbSettingValue_super = new StringBuilder();
                StringBuilder sbSettingType_super  = new StringBuilder();


                //SageFrameSettingKeys.SiteAdminEmailAddress
                sbSettingKey.Append(SageFrameSettingKeys.SiteAdminEmailAddress + ",");
                sbSettingValue.Append(txtSiteAdminEmailAddress.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalGoogleAdSenseID
                sbSettingKey.Append(SageFrameSettingKeys.PortalGoogleAdSenseID + ",");
                sbSettingValue.Append(txtPortalGoogleAdSenseID.Text.Trim() + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalShowProfileLink
                sbSettingKey.Append(SageFrameSettingKeys.PortalShowProfileLink + ",");
                sbSettingValue.Append(rblPortalShowProfileLink.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.RememberCheckbox
                sbSettingKey.Append(SageFrameSettingKeys.RememberCheckbox + ",");
                sbSettingValue.Append(chkEnableRememberme.Checked + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //CssJs Optimization
                sbSettingKey.Append(SageFrameSettingKeys.OptimizeCss + ",");
                sbSettingValue.Append(chkOptCss.Checked + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                sbSettingKey.Append(SageFrameSettingKeys.OptimizeJs + ",");
                sbSettingValue.Append(chkOptJs.Checked + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                sbSettingKey.Append(SageFrameSettingKeys.EnableLiveFeeds + ",");
                sbSettingValue.Append(chkLiveFeeds.Checked + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.ShowSideBar
                sbSettingKey.Append(SageFrameSettingKeys.ShowSideBar + ",");
                sbSettingValue.Append(chkShowSidebar.Checked + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalUserRegistration
                sbSettingKey.Append(SageFrameSettingKeys.PortalUserRegistration + ",");
                sbSettingValue.Append(rblUserRegistration.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalLoginpage
                sbSettingKey.Append(SageFrameSettingKeys.PortalLoginpage + ",");
                sbSettingValue.Append(ddlLoginPage.SelectedItem.Value.StartsWith("sf") ? string.Format("sf/{0},", ddlLoginPage.SelectedItem.Value) : string.Format("{0},", ddlLoginPage.SelectedItem.Value));
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalUserActivation
                sbSettingKey.Append(SageFrameSettingKeys.PortalUserActivation + ",");
                sbSettingValue.Append(ddlPortalUserActivation.SelectedItem.Value.StartsWith("sf") ? string.Format("sf/{0},", ddlPortalUserActivation.SelectedItem.Value) : string.Format("{0},", ddlPortalUserActivation.SelectedItem.Value));
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalRegistrationPage
                sbSettingKey.Append(SageFrameSettingKeys.PortalRegistrationPage + ",");
                sbSettingValue.Append(ddlUserRegistrationPage.SelectedItem.Value.StartsWith("sf") ? string.Format("sf/{0},", ddlUserRegistrationPage.SelectedItem.Value) : string.Format("{0},", ddlUserRegistrationPage.SelectedItem.Value));
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalForgotPassword
                sbSettingKey.Append(SageFrameSettingKeys.PortalForgotPassword + ",");
                sbSettingValue.Append(ddlPortalForgotPassword.SelectedItem.Value.StartsWith("sf") ? string.Format("sf/{0},", ddlPortalForgotPassword.SelectedItem.Value) : string.Format("{0},", ddlPortalForgotPassword.SelectedItem.Value));
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalPageNotAccessible
                sbSettingKey.Append(SageFrameSettingKeys.PortalPageNotAccessible + ",");
                sbSettingValue.Append(ddlPortalPageNotAccessible.SelectedItem.Value.StartsWith("sf") ? string.Format("sf/{0},", ddlPortalPageNotAccessible.SelectedItem.Value) : string.Format("{0},", ddlPortalPageNotAccessible.SelectedItem.Value));
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.PortalPageNotFound
                sbSettingKey.Append(SageFrameSettingKeys.PortalPageNotFound + ",");
                sbSettingValue.Append(ddlPortalPageNotFound.SelectedItem.Value.StartsWith("sf") ? string.Format("sf/{0},", ddlPortalPageNotFound.SelectedItem.Value) : string.Format("{0},", ddlPortalPageNotFound.SelectedItem.Value));
                sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalPasswordRecovery
                sbSettingKey.Append(SageFrameSettingKeys.PortalPasswordRecovery + ",");
                sbSettingValue.Append(ddlPortalPasswordRecovery.SelectedItem.Value.StartsWith("sf") ? string.Format("sf/{0},", ddlPortalPasswordRecovery.SelectedItem.Value) : string.Format("{0},", ddlPortalPasswordRecovery.SelectedItem.Value));
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //PortalUserProfilePage
                sbSettingKey.Append(SageFrameSettingKeys.PortalUserProfilePage + ",");
                sbSettingValue.Append(ddlPortalUserProfilePage.SelectedItem.Value.StartsWith("sf") ? string.Format("sf/{0},", ddlPortalUserProfilePage.SelectedItem.Value) : string.Format("{0},", ddlPortalUserProfilePage.SelectedItem.Value));
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //PortalDefaultPage
                sbSettingKey.Append(SageFrameSettingKeys.PortalDefaultPage + ",");
                sbSettingValue.Append(ddlPortalDefaultPage.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");


                //SageFrameSettingKeys.PortalDefaultLanguage
                sbSettingKey.Append(SageFrameSettingKeys.PortalDefaultLanguage + ",");
                sbSettingValue.Append(ddlDefaultLanguage.SelectedItem.Value + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //Added by Bj for OpenID conumer key and Secret key

                //SageFrameSettingKeys.FaceBookConsumerKey
                sbSettingKey.Append(SageFrameSettingKeys.ShowOpenID + ",");
                sbSettingValue.Append(chkOpenID.Checked + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.FaceBookConsumerKey
                sbSettingKey.Append(SageFrameSettingKeys.FaceBookConsumerKey + ",");
                sbSettingValue.Append(txtFacebookConsumerKey.Text + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.FaceBokkSecretkey
                sbSettingKey.Append(SageFrameSettingKeys.FaceBookSecretkey + ",");
                sbSettingValue.Append(txtFaceBookSecretKey.Text + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.LinkedInConsumerKey
                sbSettingKey.Append(SageFrameSettingKeys.LinkedInConsumerKey + ",");
                sbSettingValue.Append(txtLinkedInConsumerKey.Text + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                //SageFrameSettingKeys.LinkedInSecretKey
                sbSettingKey.Append(SageFrameSettingKeys.LinkedInSecretKey + ",");
                sbSettingValue.Append(txtLinkedInSecretKey.Text + ",");
                sbSettingType.Append(SettingType.SiteAdmin + ",");

                RoleController _role = new RoleController();
                string[]       roles = _role.GetRoleNames(GetUsername, GetPortalID).ToLower().Split(',');
                if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()))
                {
                    ///Superuser Settings
                    //Collecting Setting Values
                    sbSettingKey_super.Append(SageFrameSettingKeys.SuperUserPortalId + ",");
                    sbSettingValue_super.Append(ddlHostPortal.SelectedItem.Value + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.SuperUserTitle
                    sbSettingKey_super.Append(SageFrameSettingKeys.SuperUserTitle + ",");
                    sbSettingValue_super.Append(txtHostTitle.Text.Trim() + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.SuperUserURL
                    sbSettingKey_super.Append(SageFrameSettingKeys.SuperUserURL + ",");
                    sbSettingValue_super.Append(txtHostUrl.Text.Trim() + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.SuperUserEmail
                    sbSettingKey_super.Append(SageFrameSettingKeys.SuperUserEmail + ",");
                    sbSettingValue_super.Append(txtHostEmail.Text.Trim() + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.SuperUserCopyright
                    sbSettingKey_super.Append(SageFrameSettingKeys.SuperUserCopyright + ",");
                    sbSettingValue_super.Append(chkCopyright.Checked + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.UseCustomErrorMessages
                    sbSettingKey_super.Append(SageFrameSettingKeys.UseCustomErrorMessages + ",");
                    sbSettingValue_super.Append(chkUseCustomErrorMessages.Checked + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");


                    //SageFrameSettingKeys.UseFriendlyUrls
                    sbSettingKey_super.Append(SageFrameSettingKeys.UseFriendlyUrls + ",");
                    sbSettingValue_super.Append(true + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");



                    //SageFrameSettingKeys.SMTPServer
                    sbSettingKey_super.Append(SageFrameSettingKeys.SMTPServer + ",");
                    sbSettingValue_super.Append(txtSMTPServerAndPort.Text.Trim() + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.SMTPAuthentication
                    sbSettingKey_super.Append(SageFrameSettingKeys.SMTPAuthentication + ",");
                    sbSettingValue_super.Append(rblSMTPAuthentication.SelectedItem.Value + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.SMTPEnableSSL
                    sbSettingKey_super.Append(SageFrameSettingKeys.SMTPEnableSSL + ",");
                    sbSettingValue_super.Append(chkSMTPEnableSSL.Checked + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.SMTPUsername
                    sbSettingKey_super.Append(SageFrameSettingKeys.SMTPUsername + ",");
                    sbSettingValue_super.Append(txtSMTPUserName.Text.Trim() + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.SMTPPassword
                    sbSettingKey_super.Append(SageFrameSettingKeys.SMTPPassword + ",");
                    sbSettingValue_super.Append(txtSMTPPassword.Text.Trim() + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");


                    //SageFrameSettingKeys.FileExtensions
                    sbSettingKey_super.Append(SageFrameSettingKeys.FileExtensions + ",");
                    sbSettingValue_super.Append(txtFileExtensions.Text.Trim() + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.HelpURL
                    sbSettingKey_super.Append(SageFrameSettingKeys.HelpURL + ",");
                    sbSettingValue_super.Append(txtHelpUrl.Text.Trim() + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.SettingPageExtension
                    sbSettingKey_super.Append(SageFrameSettingKeys.SettingPageExtension + ",");
                    sbSettingValue_super.Append(txtPageExtension.Text.Trim() + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");

                    //SageFrameSettingKeys.Scheduler
                    sbSettingKey_super.Append(SageFrameSettingKeys.Scheduler + ",");
                    sbSettingValue_super.Append(txtScheduler.Checked + ",");
                    sbSettingType_super.Append(SettingType.SuperUser + ",");
                }
                string SettingTypes = sbSettingType.ToString();
                if (SettingTypes.Contains(","))
                {
                    SettingTypes = SettingTypes.Remove(SettingTypes.LastIndexOf(","));
                }
                string SettingKeys = sbSettingKey.ToString();
                if (SettingKeys.Contains(","))
                {
                    SettingKeys = SettingKeys.Remove(SettingKeys.LastIndexOf(","));
                }
                string SettingValues = sbSettingValue.ToString();
                if (SettingValues.Contains(","))
                {
                    SettingValues = SettingValues.Remove(SettingValues.LastIndexOf(","));
                }
                string SettingTypes_super = sbSettingType_super.ToString();
                if (SettingTypes_super.Contains(","))
                {
                    SettingTypes_super = SettingTypes_super.Remove(SettingTypes_super.LastIndexOf(","));
                }
                string SettingKeys_super = sbSettingKey_super.ToString();
                if (SettingKeys_super.Contains(","))
                {
                    SettingKeys_super = SettingKeys_super.Remove(SettingKeys_super.LastIndexOf(","));
                }
                string SettingValues_super = sbSettingValue_super.ToString();
                if (SettingValues_super.Contains(","))
                {
                    SettingValues_super = SettingValues_super.Remove(SettingValues_super.LastIndexOf(","));
                }

                sageSP.SaveSageSettings(SettingTypes, SettingKeys, SettingValues, GetUsername, GetPortalID.ToString());
                if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()))
                {
                    sageSP.SaveSageSettings(SettingTypes_super, SettingKeys_super, SettingValues_super, GetUsername, "1");
                }
                HttpRuntime.Cache.Remove(CacheKeys.SageSetting);
                BindData();
                #endregion
                ShowMessage("", GetSageMessage("PortalSettings", "PortalSettingIsSavedSuccessfully"), "", SageMessageType.Success);
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }