예제 #1
0
 /// <summary>
 /// 清理缓存
 /// </summary>
 private void clear()
 {
     SmtpListHelper.ClearCacheAll(); smtpList         = null;
     EmailListHelper.ClearCacheAll(); emailList       = null;
     SendSettingHelper.ClearCacheAll(); sendSetting   = null;
     HtmlTemplateHelper.ClearCacheAll(); templateList = null;
     IpHistoryHelper.ClearCacheAll();
 }
예제 #2
0
        private void mnuEdit_Click(object sender, EventArgs e)
        {
            if (this.cboTemplate.SelectedIndex < 0)
            {
                MessageBox.Show("发送主题为空,保存失败", "系统提示");
                return;
            }
            SendSetting info = new SendSetting();

            info.TemplateID     = (long)this.cboTemplate.SelectedValue;
            info.ConnectType    = rdoRoute.Checked ? 0 : rdoModel.Checked ? 1 : 2;
            info.IPInterval     = txtIPInterval.Text == "0" ? 0 : txtIPInterval.Text.ToInt(1000);
            info.SendInterval   = txtSendInterval.Text.ToInt(10);
            info.SmtpInterval   = txtSmtpInterval.Text == "0" ? 0 : txtSmtpInterval.Text.ToInt(20);
            info.Status         = this.cboStatus.SelectedValue.ToString().ToInt(0);
            info.MaxRetryCount  = txtMaxRetryCount.Text.ToInt(10);
            info.SendRetryCount = txtSendRetryCount.Text.ToInt(10);
            info.DeleteInterval = txtDeleteInterval.Text.ToInt(60);

            if (sendSetting.IsNull() || sendSetting.SettingID.IsNull())
            {
                info.SettingID = 1;
                SendSettingHelper.Insert(info);
            }
            else
            {
                info.SettingID = sendSetting.SettingID;
                SendSettingHelper.Update(info);
            }
            SendSettingHelper.ClearCacheAll();

            if (info.Status == 0 && (int)cboStatus.Tag != info.Status)
            {
                new SQL()
                .Update(EmailList._)
                .Set("LastSendStatus", 0)
                .Set("LastSendError", "")
                .Set("LastSendTime", null, true)
                .Set("LastSendSmtp", "")
                .Set("SendCount", 0)
                .ToExec();

                new SQL().Update(SmtpList._)
                .Set("Sends", 0)
                .Set("SendFails", 0)
                .ToExec();

                new SQL().Delete(IpHistory._)
                .ToExec();
            }

            MessageBox.Show("保存数据成功!", " 系统提示");
            this.Close();
        }