Ejemplo n.º 1
0
        public void SendMessageLater(IQueryable <Emails> emails, Smtp selectedSmtp, DateTime selectedSendDate, string selectedSendTime)
        {
            if (IsFillError())
            {
                return;
            }
            AuthorizationWindow authWindow = new AuthorizationWindow();

            _scheduler = new SchedulerClass();
            TimeSpan tsSendTime = _scheduler.GetSendTime(selectedSendTime);

            if (tsSendTime == new TimeSpan())
            {
                MessageBox.Show("Некорректный формат даты", "ВНИМАНИЕ!");
                return;
            }
            DateTime dtSendDateTime = selectedSendDate.Add(tsSendTime);

            if (dtSendDateTime < DateTime.Now)
            {
                MessageBox.Show("Дата и время отправи не могут быть раньше настоящего времени", "ВНИМАНИЕ!");
                return;
            }
            if (authWindow.ShowDialog() == true)
            {
                _sendService = new EmailSendServiceClass(selectedSmtp, authWindow.authSettings, mailSettings);
                _sendService.SendMails(emails);
            }
        }
Ejemplo n.º 2
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     if (_dtSend.ToShortTimeString() == DateTime.Now.ToShortTimeString())
     {
         _emailSenderService.SendMails(_emails);
         _timer.Stop();
         MessageBox.Show("Письма отправлены");
     }
 }
Ejemplo n.º 3
0
        public void SendMessage(IQueryable <Emails> emails, Smtp selectedSmtp)
        {
            if (IsFillError())
            {
                return;
            }
            AuthorizationWindow authWindow = new AuthorizationWindow();

            if (authWindow.ShowDialog() == true)
            {
                _sendService = new EmailSendServiceClass(selectedSmtp, authWindow.authSettings, mailSettings);
                _sendService.SendMails(emails);
            }
        }