Пример #1
0
    private void Save()
    {
        Session["TrySqlPassword"] = null;
        try
        {
            WebmailSettings settings = new WebMailSettingsCreator().CreateWebMailSettings(AdminPanelUtils.GetWebMailDataFolder());

            if (intDbTypeMsAccess.Checked)
            {
                settings.DbType = SupportedDatabase.MsAccess;
            }
            else if (intDbTypeMySql.Checked)
            {
                settings.DbType = SupportedDatabase.MySql;
            }
            else
            {
                settings.DbType = SupportedDatabase.MsSqlServer;
            }

            string rrr = Request[txtSqlLogin.ClientID];

            if (useDSN.Checked)
            {
                settings.DbDsn = txtSqlDsn.Value;
            }
            else if (useCS.Checked)
            {
                settings.DbCustomConnectionString = odbcConnectionString.Value;
            }
            else
            {
                if (settings.DbType == SupportedDatabase.MsAccess)
                {
                    settings.DbPathToMdb = txtAccessFile.Value;
                }
                else
                {
                    settings.DbLogin    = txtSqlLogin.Value;
                    settings.DbPassword = txtSqlPassword.Text;
                    settings.DbName     = txtSqlName.Value;
                    settings.DbHost     = txtSqlSrc.Value;
                }
            }
            settings.UseCustomConnectionString = useCS.Checked;
            settings.UseDSN = useDSN.Checked;

            settings.SaveWebmailSettings(AdminPanelUtils.GetWebMailDataFolder());
            this.Session.Remove(Constants.sessionDbManager);
            this.Context.Application.Remove(Constants.sessionSettings);
        }
        catch (Exception error)
        {
            Log.WriteException(error);
            AdminPanelUtils.SetPageErrorMessage(this.Page, Constants.mailAdmSaveUnsuccess);
        }
    }
Пример #2
0
    protected void SaveButton_Click(object sender, System.EventArgs e)
    {
        try
        {
            WebmailSettings settings = new WebMailSettingsCreator().CreateWebMailSettings(AdminPanelUtils.GetWebMailDataFolder());

            if (standartLoginRadio.Checked)
            {
                settings.HideLoginMode = LoginMode.Default;
            }
            else if (hideLoginRadio.Checked)
            {
                if (hideLoginSelect.SelectedIndex == 0)
                {
                    settings.HideLoginMode = LoginMode.HideLoginFieldLoginIsEmail;
                }
                else
                {
                    settings.HideLoginMode = LoginMode.HideLoginFieldLoginIsAccount;
                }
            }
            else
            {
                if ((intDisplayDomainAfterLoginField.Checked) && (intLoginAsConcatination.Checked))
                {
                    settings.HideLoginMode = LoginMode.HideEmailFieldDisplayDomainAfterLoginAndLoginIsLoginAndDomain;
                }
                else if (intDisplayDomainAfterLoginField.Checked)
                {
                    settings.HideLoginMode = LoginMode.HideEmailFieldDisplayDomainAfterLogin;
                }
                else if (intLoginAsConcatination.Checked)
                {
                    settings.HideLoginMode = LoginMode.HideEmailFieldLoginIsLoginAndDomain;
                }
                else
                {
                    settings.HideLoginMode = LoginMode.HideEmailField;
                }
            }
            settings.DefaultDomainOptional = txtUseDomain.Value;

            settings.AllowAdvancedLogin            = intAllowAdvancedLogin.Checked;
            settings.AutomaticCorrectLoginSettings = intAutomaticCorrectLogin.Checked;
            settings.AllowLanguageOnLogin          = intAllowLangOnLogin.Checked;

            settings.SaveWebmailSettings(AdminPanelUtils.GetWebMailDataFolder());
            Context.Application.Remove(Constants.sessionSettings);
            AdminPanelUtils.SetPageReportMessage(Page, Constants.mailAdmSaveSuccess);
        }
        catch (Exception error)
        {
            Log.WriteException(error);
            AdminPanelUtils.SetPageErrorMessage(Page, Constants.mailAdmSaveUnsuccess);
        }
    }
Пример #3
0
    protected void SubmitButton_Click(object sender, System.EventArgs e)
    {
        try
        {
            WebmailSettings settings = new WebMailSettingsCreator().CreateWebMailSettings(AdminPanelUtils.GetWebMailDataFolder());

            try
            {
                settings.MailsPerPage = short.Parse(intMailsPerPage.Value, CultureInfo.InvariantCulture);
                if (settings.MailsPerPage < 0)
                {
                    settings.MailsPerPage = Math.Abs(settings.MailsPerPage);
                }
            }
            catch (Exception error)
            {
                Log.WriteException(error);
            }

            settings.DefaultSkin              = txtDefaultSkin.Value;
            settings.DefaultLanguage          = txtDefaultLanguage.Value;
            settings.AllowUsersChangeSkin     = intAllowUsersChangeSkin.Checked;
            settings.AllowUsersChangeLanguage = intAllowUsersChangeLanguage.Checked;
            settings.ShowTextLabels           = intShowTextLabels.Checked;
            settings.AllowDhtmlEditor         = intAllowDHTMLEditor.Checked;
            settings.AllowContacts            = intAllowContacts.Checked;
            settings.AllowCalendar            = intAllowCalendar.Checked;

            ViewMode mode = ViewMode.WithoutPreviewPane;
            if (intRightMessagePane.Checked)
            {
                mode |= ViewMode.WithPreviewPane;
            }
            if (intAlwaysShowPictures.Checked)
            {
                mode |= ViewMode.AlwaysShowPictures;
            }
            settings.ViewMode = mode;

            settings.SaveWebmailSettings(AdminPanelUtils.GetWebMailDataFolder());
            this.Context.Application.Remove(Constants.sessionSettings);

            AdminPanelUtils.SetPageReportMessage(this.Page, Constants.mailAdmSaveSuccess);
        }
        catch (Exception error)
        {
            Log.WriteException(error);
            AdminPanelUtils.SetPageErrorMessage(this.Page, Constants.mailAdmSaveUnsuccess);
        }
    }
Пример #4
0
    protected void SaveButton_Click(object sender, System.EventArgs e)
    {
        try
        {
            WebmailSettings settings = new WebMailSettingsCreator().CreateWebMailSettings(AdminPanelUtils.GetWebMailDataFolder());

            settings.EnableLogging = intEnableLogging.Checked;
            settings.SaveWebmailSettings(AdminPanelUtils.GetWebMailDataFolder());
            this.Context.Application.Remove(Constants.sessionSettings);

            AdminPanelUtils.SetPageReportMessage(this.Page, Constants.mailAdmSaveSuccess);
        }
        catch (Exception error)
        {
            Log.WriteException(error);
            AdminPanelUtils.SetPageErrorMessage(this.Page, Constants.mailAdmSaveUnsuccess);
        }
    }
Пример #5
0
    protected void SaveButton_Click(object sender, System.EventArgs e)
    {
        try
        {
            WebmailSettings settings = new WebMailSettingsCreator().CreateWebMailSettings(AdminPanelUtils.GetWebMailDataFolder());

            settings.SiteName = txtSiteName.Value;

            settings.IncomingMailServer = txtIncomingMail.Value;
            try
            {
                settings.IncomingMailPort = int.Parse(intIncomingMailPort.Value, CultureInfo.InvariantCulture);
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                AdminPanelUtils.SetPageReportMessage(this.Page, ex.Message);
            }

            switch (intIncomingMailProtocol.Value.ToLower(CultureInfo.InvariantCulture))
            {
            case "pop3":
                settings.IncomingMailProtocol = IncomingMailProtocol.Pop3;
                break;

            case "imap4":
                settings.IncomingMailProtocol = IncomingMailProtocol.Imap4;
                break;

            case "xmail":
                settings.IncomingMailProtocol = IncomingMailProtocol.WMServer;
                break;
            }

            settings.OutgoingMailServer = txtOutgoingMail.Value;
            try
            {
                settings.OutgoingMailPort = int.Parse(intOutgoingMailPort.Value, CultureInfo.InvariantCulture);
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                AdminPanelUtils.SetPageReportMessage(this.Page, ex.Message);
            }

            settings.ReqSmtpAuth         = intReqSmtpAuthentication.Checked;
            settings.AllowDirectMode     = intAllowDirectMode.Checked;
            settings.DirectModeIsDefault = intDirectModeIsDefault.Checked;

            try
            {
                settings.AttachmentSizeLimit = long.Parse(intAttachmentSizeLimit.Value, CultureInfo.InvariantCulture) * 1024;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                AdminPanelUtils.SetPageReportMessage(this.Page, ex.Message);
            }
            settings.EnableAttachmentSizeLimit = intEnableAttachmentSizeLimit.Checked;
            try
            {
                settings.MailboxSizeLimit = long.Parse(intMailboxSizeLimit.Value, CultureInfo.InvariantCulture) * 1024;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                AdminPanelUtils.SetPageReportMessage(this.Page, ex.Message);
            }
            settings.EnableMailboxSizeLimit = intEnableMailboxSizeLimit.Checked;

            settings.AllowUsersChangeEmailSettings = intAllowUsersChangeEmailSettings.Checked;
            settings.AllowUsersAddNewAccounts      = intAllowUsersAddNewAccounts.Checked;
            settings.AllowUsersChangeAccountsDef   = intAllowUsersChangeAccountsDef.Checked;

            try
            {
                settings.DefaultUserCharset = int.Parse(txtDefaultUserCharset.Value, CultureInfo.InvariantCulture);
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                AdminPanelUtils.SetPageReportMessage(this.Page, ex.Message);
            }
            settings.AllowUsersChangeCharset = intAllowUsersChangeCharset.Checked;

            settings.DefaultTimeZone          = (short)txtDefaultTimeZone.SelectedIndex;
            settings.AllowUsersChangeTimeZone = intAllowUsersChangeTimeOffset.Checked;
            settings.TakeImapQuota            = intTakeImapQuota.Checked;

            settings.SaveWebmailSettings(AdminPanelUtils.GetWebMailDataFolder());
            this.Context.Application.Remove(Constants.sessionSettings);

            AdminPanelUtils.SetPageReportMessage(this.Page, Constants.mailAdmSaveSuccess);
        }
        catch (Exception error)
        {
            Log.WriteException(error);
            AdminPanelUtils.SetPageErrorMessage(this.Page, Constants.mailAdmSaveUnsuccess);
        }
    }