private void Save() { string validationResult = new Validator() .NotEmpty(txtServerName.Text, rfvServerName.ErrorMessage) .Result; if (!string.IsNullOrEmpty(validationResult)) { ShowError(validationResult); return; } try { SMTPServerPriorityEnum priority = (SMTPServerPriorityEnum)Enum.Parse(typeof(SMTPServerPriorityEnum), ddlPriorities.SelectedValue); SMTPServerInfo smtpServer = SMTPServerInfoProvider.CreateSMTPServer(txtServerName.Text, txtUserName.Text, txtPassword.Text, chkUseSSL.Checked, priority); if (chkAssign.Checked && currentSite != null) { SMTPServerSiteInfoProvider.AddSMTPServerToSite(smtpServer.ServerID, currentSite.SiteID); } URLHelper.Redirect(string.Format("Frameset.aspx?smtpserverid={0}&saved=1", smtpServer.ServerID)); } catch (Exception e) { ShowError(e.Message); return; } }
/// <summary> /// Add sites to SMTP server. /// </summary> private void AddNewRecords(string newValues, string currentValues) { string items = DataHelper.GetNewItemsInList(currentValues, newValues); if (!String.IsNullOrEmpty(items)) { string[] modifiedItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (modifiedItems != null) { foreach (string item in modifiedItems) { SMTPServerSiteInfoProvider.AddSMTPServerToSite(smtpServerId, ValidationHelper.GetInteger(item, 0)); } } } }