/// <summary> /// Updates the specified SMPT box. /// </summary> /// <param name="smptBox">The SMPT box.</param> public static void Update(SmtpBox smptBox) { // [IN SP] Check that exists element with IsDefault = 1 // Reset Check params smptBox.SourceRow.Checked = false; smptBox.SourceRow.CheckUid = Guid.NewGuid(); smptBox.SourceRow.Update(); }
/// <summary> /// Creates the specified SMPT box. /// </summary> /// <param name="smptBox">The SMPT box.</param> /// <returns></returns> public static int Create(SmtpBox smptBox) { // [IN SP] Check that exists element with IsDefault = 1 // Reset Check params smptBox.SourceRow.Checked = false; smptBox.SourceRow.CheckUid = Guid.NewGuid(); smptBox.SourceRow.Update(); return(smptBox.PrimaryKeyId.Value); }
/// <summary> /// Finds the Smtp box. /// </summary> /// <param name="serviceType">Type of the service.</param> /// <param name="key">The key.</param> /// <param name="returnDefault">if set to <c>true</c> [return default].</param> /// <returns></returns> public static SmtpBox FindSmtpBox(OutgoingEmailServiceType serviceType, int?key, bool returnDefault) { OutgoingEmailServiceConfigRow config = FindConfigRow(serviceType, key); if (config != null) { return(SmtpBox.Load(config.SmtpBoxId)); } // Return Default if (returnDefault) { return(SmtpBox.GetDefault()); } return(null); }
/// <summary> /// Deletes the specified SMTP box id. /// </summary> /// <param name="smtpBoxId">The SMTP box id.</param> public static void Delete(int smtpBoxId) { using (TransactionScope tran = DataContext.Current.BeginTransaction()) { // TODO: Check that exists element with IsDefault = 1 SmtpBoxRow row = new SmtpBoxRow(smtpBoxId); row.Delete(); if (row.IsDefault) { // Set First SMTP Box As Default SmtpBox newDefaultBox = GetDefault(); if (newDefaultBox != null) { newDefaultBox.SourceRow.IsDefault = true; newDefaultBox.SourceRow.Update(); } } tran.Commit(); } }
/// <summary> /// Creates the specified SMPT box. /// </summary> /// <param name="smptBox">The SMPT box.</param> /// <returns></returns> public static int Create(SmtpBox smptBox) { // [IN SP] Check that exists element with IsDefault = 1 // Reset Check params smptBox.SourceRow.Checked = false; smptBox.SourceRow.CheckUid = Guid.NewGuid(); smptBox.SourceRow.Update(); return smptBox.PrimaryKeyId.Value; }