Ejemplo n.º 1
0
        private void Inital()
        {
            dgv_addrList.MultiSelect  = false;
            tb_senderPWD.PasswordChar = '*';
            btn_delAddress.Enabled    = false;
            btn_alterAddress.Enabled  = false;
            //tb_senderPWD.UseSystemPasswordChar = true;
            timer           = new System.Timers.Timer((double)nud_checkSpan.Value * 1000);
            timer.Elapsed  += new System.Timers.ElapsedEventHandler(timerPro);
            timer.AutoReset = true;
            sendM           = new sendMail();
            //timer.Start();
            dgv_addrList.RowPostPaint += new DataGridViewRowPostPaintEventHandler(dgvRowRepaint);
            canEditRowIndex            = 0;
            using (ksoaContext db = new ksoaContext())
            {
                addr_List = (List <alarm_mailaddr>)(from q in db.alarm_MailAddr where q.IsDeleted == false select q).ToList();
                dgv_addrList.DataSource             = addr_List;// (from q in db.alarm_MailAddr where q.IsDeleted==false   select q).ToList();
                dgv_addrList.Columns["ID"].ReadOnly = true;
                dgv_addrList.Columns["ID"].Visible  = false;
            }
            dgv_addrList.SelectionChanged += new EventHandler(dgv_addrList_selectChanged);
            (btn_startWork).Text           = bol_running ? "暂停" : "启动";

            if (!bol_running)
            {
                timer.Stop();
                nud_checkSpan.Enabled = true;
            }
            else
            {
                timer.Start(); nud_checkSpan.Enabled = false;
            }
            timerPro(null, null);
        }
Ejemplo n.º 2
0
 private bool sendMail(alarm_mailaddr model)
 {
     if (sendM == null)
     {
         sendM = new sendMail();
     }
     return(sendM.sendmail(model.senderAddr, model.senderName, model.mailAddress, model.toer, model.subject, model.mailBody, new string[] { model.sendFile?model.fileBasePath: "" }, model.SMTPHost, model.SMTPPuser, model.SMTPPass));
 }
Ejemplo n.º 3
0
        private void Inital()
        {
            //log_operate.writeLog(string.Format(logFile, DateTime.Now.ToString("yyyy-MM-dd")), DateTime.Now.ToString());


            cb_isLimitSend.Checked = true;
            dtp_timeLimit.Format   = DateTimePickerFormat.Time;
            //dtp_timeLimit.CustomFormat = "HH:mm:ss";
            dtp_timeLimit.ShowUpDown = true;

            //MessageBox.Show(DateTime.Parse( dtp_timeLimit.Value.ToLongTimeString()).ToString());
            dgv_addrList.MultiSelect  = false;
            tb_senderPWD.PasswordChar = '*';
            btn_delAddress.Enabled    = false;
            btn_alterAddress.Enabled  = false;
            //tb_senderPWD.UseSystemPasswordChar = true;
            timer           = new System.Timers.Timer((double)nud_checkSpan.Value * 1000);
            timer.Elapsed  += new System.Timers.ElapsedEventHandler(timerPro);
            timer.AutoReset = true;
            sendM           = new sendMail();
            //timer.Start();
            dgv_addrList.RowPostPaint += new DataGridViewRowPostPaintEventHandler(dgvRowRepaint);
            canEditRowIndex            = 0;


            ArrayList precision = new ArrayList();

            precision.Add(new DictionaryEntry("时", DatePart.HOUR));
            precision.Add(new DictionaryEntry("分", DatePart.MINUTE));
            precision.Add(new DictionaryEntry("秒", DatePart.SECEND));
            cb_precision.DataSource    = precision;
            cb_precision.ValueMember   = "Value";
            cb_precision.DisplayMember = "Key";
            cb_precision.SelectedItem  = cb_precision.Items[0];
            cb_precision.DropDownStyle = ComboBoxStyle.DropDownList;

            using (ksoaContext db = new ksoaContext())
            {
                addr_List = (List <alarm_mailaddr>)(from q in db.alarm_MailAddr where q.IsDeleted == false select q).ToList();
                dgv_addrList.DataSource             = addr_List;// (from q in db.alarm_MailAddr where q.IsDeleted==false   select q).ToList();
                dgv_addrList.Columns["ID"].ReadOnly = true;
                dgv_addrList.Columns["ID"].Visible  = false;
            }
            dgv_addrList.SelectionChanged += new EventHandler(dgv_addrList_selectChanged);
            (btn_startWork).Text           = bol_running ? "暂停" : "启动";

            if (!bol_running)
            {
                timer.Stop();
                nud_checkSpan.Enabled = true;
            }
            else
            {
                timer.Start(); nud_checkSpan.Enabled = false;
            }
            //timerPro(null,null);
        }
Ejemplo n.º 4
0
 private bool sendMail(sendMailAddr model, string sfrom = null, string sfromer = null, string sSubject = null, string sBody = null, string[] sfile = null, string sSMTPHost = null, string sSMTPuser = null, string sSMTPpass = null)
 {
     if (model.list_Toer.Count <= 0)
     {
         throw new Exception("model list have no member!");
     }
     if (sendM == null)
     {
         sendM = new sendMail();
     }
     return(sendM.sendmail2Many(model.from, model.list_Toer,
                                string.IsNullOrEmpty(sSubject)?model.subject:sSubject,
                                string.IsNullOrEmpty(sBody) ? model.mailBody:sBody,
                                (sfile == null || sfile.Length <= 0) ? model.list_files.ToArray():sfile,
                                string.IsNullOrEmpty(sSMTPHost) ? model.SMTPHost:sSMTPHost,
                                string.IsNullOrEmpty(sSMTPuser) ? model.SMTPPuser:sSMTPuser,
                                string.IsNullOrEmpty(sSMTPpass) ? model.SMTPPass:sSMTPpass));
 }