Exemplo n.º 1
0
 public void PlanSendEmails(DateTime dtSend, EmailSendServiceClass emailSender, IEnumerable <T> emails, IResult result)
 {
     this.EmailSender    = emailSender;
     this.EmailDateTime  = dtSend; this.Emails = emails; EmailTimer.Tick += Timer_Tick;
     EmailTimer.Interval = new TimeSpan(0, 0, 1); EmailTimer.Start();
     this.ResultWindow   = result;
 }
Exemplo n.º 2
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            config = ConfigurationManager.OpenExeConfiguration
                         (ConfigurationUserLevel.None);
            string branchnum = config.AppSettings.Settings["BranchNum"].Value;
            string period    = config.AppSettings.Settings["Period"].Value;

            _intBranchnum = 0;
            int.TryParse(branchnum, out _intBranchnum);
            int intPeriod = 1;

            int.TryParse(period, out intPeriod);
            intPeriod           = intPeriod * 60 * 1000;
            intPeriod           = (intPeriod == 0) ? 100 : intPeriod;
            EmailTimer.Interval = intPeriod;//intPeriod;
            EmailTimer.Start();

            _status  = "START";
            _inStart = 0;

            _send = new Thread(new ThreadStart(SendEmail));
            _send.Start();
            btnSend.Enabled = false;

            _spysender = new Thread(new ThreadStart(SpyEmail));
            if (!_spysender.IsAlive)
            {
                _spysender = new Thread(new ThreadStart(SpyEmail));
                _spysender.Start();
            }
        }
Exemplo n.º 3
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            config = ConfigurationManager.OpenExeConfiguration
                         (ConfigurationUserLevel.None);
            string branchnum  = config.AppSettings.Settings["BranchNum"].Value;
            string periodfrom = config.AppSettings.Settings["PeriodFrom"].Value;
            string periodto   = config.AppSettings.Settings["PeriodTo"].Value;

            _intBranchnum = 0;
            int.TryParse(branchnum, out _intBranchnum);
            int intPeriodFrom = 1;
            int intPeriodTo   = 2;

            int.TryParse(periodfrom, out intPeriodFrom);
            int.TryParse(periodto, out intPeriodTo);
            intPeriodFrom = intPeriodFrom * 60 * 1000;
            intPeriodTo   = intPeriodTo * 60 * 1000;
            Random r         = new Random();
            int    intPeriod = r.Next(intPeriodFrom, intPeriodTo);

            intPeriodFrom       = (intPeriod == 0) ? 100 : intPeriod;
            EmailTimer.Interval = intPeriodFrom;//intPeriod;
            EmailTimer.Start();

            _status  = "START";
            _counter = 0;

            _send = new Thread(new ThreadStart(SendEmail));
            _send.Start();
            btnSend.Enabled = false;

            //_spysender = new Thread(new ThreadStart(SpyEmail));
            //if (!_spysender.IsAlive)
            //{
            //    _spysender = new Thread(new ThreadStart(SpyEmail));
            //    _spysender.Start();
            //}
        }