Exemplo n.º 1
0
        /////////////////////////////////////////////////////////////////////
        private void ServiceTimer_Tick(object sender, System.Timers.ElapsedEventArgs e)
        {
            List <BOL.HelpModel.SendEmailEndProject> workerNotFinish = BLL.LogicProjects.SendEmailDateProjectEnd();

            foreach (var item in workerNotFinish)
            {
                string message = $"Hi {item.UserName}<br/> the project {item.nameProject} the deadline tommorow You did {item.HourDo} from {item.hoursForProject}, You stay to do {item.stayToDo} hours ";
                SendMailService.SendEmail(item.EmailUser, "end dead line", message);
            }
            var group = workerNotFinish.GroupBy(p => p.EmailManager);

            foreach (var item in group)
            {
                string message = "";
                item.ToList().ForEach(user =>
                {
                    message += user.UserName + " ";
                });
                SendMailService.SendEmail(item.Key, "end dead line", message += "not finish their work");
            }

            if (getCallType == 1)
            {
                timer1.Stop();
                System.Threading.Thread.Sleep(1000000);
                SetTimer();
            }
        }
Exemplo n.º 2
0
 /////////////////////////////////////////////////////////////////////
 protected override void OnStop()
 {
     timer1.AutoReset = false;
     timer1.Enabled   = false;
     SendMailService.WriteErrorLog("Service stopped");
 }
Exemplo n.º 3
0
 /////////////////////////////////////////////////////////////////////
 protected override void OnStart(string[] args)
 {
     timer1.AutoReset = true;
     timer1.Enabled   = true;
     SendMailService.WriteErrorLog("Service started");
 }