示例#1
0
        /// <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();
        }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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();
            }
        }
示例#5
0
文件: SmtpBox.cs 项目: 0anion0/IBN
        /// <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();
        }
示例#6
0
文件: SmtpBox.cs 项目: 0anion0/IBN
        /// <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;
        }