private void UpdateSmtpListSendCount(int smtpIndex, int smtps, int smtps2) { smtpList[smtpIndex].Sends += smtps; smtpList[smtpIndex].SendFails += smtps2; smtpInfo.Sends = smtpList[smtpIndex].Sends; smtpInfo.SendFails = smtpList[smtpIndex].SendFails; smtpInfo.CreateTime = null; SmtpListHelper.Update(smtpInfo); }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtSmtpServer.Text)) { MessageBox.Show("SMTP服务器不能为空", "系统提示"); return; } if (string.IsNullOrEmpty(this.txtSmtpPort.Text)) { MessageBox.Show("SMTP服务器端口不能为空", "系统提示"); return; } if (string.IsNullOrEmpty(this.txtUserName.Text)) { MessageBox.Show("登录用户名不能为空", "系统提示"); return; } SmtpList info = new SmtpList(); info.SmtpServer = this.txtSmtpServer.Text; info.SmtpPort = this.txtSmtpPort.Text.ToInt(25); info.UserName = this.txtUserName.Text; info.SPassword = this.txtSPassword.Text; info.SSL = this.checkBoxSSL.Checked; info.Status = this.checkBoxStatus.Checked == true ? 0 : 1; //bool isTrue = NetHelper.CheckSMTP(info.UserName, info.SPassword, info.SmtpServer); //if (!isTrue) { // MessageBox.Show("无法连接SMTP服务器,请检查用户名和密码是否正确和账号是否被封。", " 系统提示"); // return; //} DialogResult = System.Windows.Forms.DialogResult.OK; if (!smtp.IsNullEmpty() || SmtpListHelper.IsExistByID(info.SmtpServer, info.SmtpPort.Value, info.UserName)) { SmtpListHelper.Update(info); } else { info.CreateTime = DateTime.Now.ToDateTime().ToDateTime(); SmtpListHelper.Insert(info); } SmtpListHelper.ClearCacheAll(); MessageBox.Show("保存数据成功!", " 系统提示"); this.Close(); }
private void mnuDisable_Click(object sender, EventArgs e) { switch (type) { case 1: EmailListHelper.ClearCacheAll(); break; case 2: SmtpListHelper.ClearCacheAll(); foreach (ListViewItem item in listView1.Items) { if (item.Checked) { string[] list = item.Tag.ToString().Split(','); SmtpList info = new SmtpList(); info.SmtpServer = list[0].ToString(); info.SmtpPort = list[1].ToString().ToInt(25); info.UserName = list[2].ToString(); info.SPassword = list[3].ToString(); info.Status = 1; SmtpListHelper.Update(info); //if (!info.SmtpServer.IsNullEmpty() || SmtpListHelper.IsExistByID(info.SmtpServer, info.SmtpPort.Value, info.UserName)) { // SmtpListHelper.Update(info); //} } } break; case 3: IpHistoryHelper.ClearCacheAll(); break; } BindData(); }