Exemple #1
0
        private static void SendEmails(IEnumerable<string> bcc, TaskInfo task)
        {
            using (var email = new MailMessage())
            {
                foreach (var address in bcc)
                    email.Bcc.Add(address);
                email.From = new MailAddress("*****@*****.**");
                email.Subject = String.Format("Alert! '%s' SLA not met", task.task.TaskName);
                email.Body = String.Format(@"

                            <html>
                            <head></head>
                            <body>
                               <h2>%s</h2>
                               <h5>%s</h5>
                               <br />
                            </body>
                            </html>", task.task.TaskName, task.task.TaskDesc);
                email.IsBodyHtml = true;
                using (var smtp = new SmtpClient(ConfigurationManager.AppSettings.Get("SMTPAddress")))
                {
                    smtp.Credentials = new NetworkCredential(ConfigurationManager.AppSettings.Get("SMTPUser"), ConfigurationManager.AppSettings.Get("SMTPPassword"));
                    smtp.Send(email);
                }
            }
        }
Exemple #2
0
        public static TaskInfo GetTaskInfo(int  TaskId)
        {
            var taskInfo = new TaskInfo();
            using (var db = new SqlConnection(ConnectionString))
            {
                // get the task tags
                var q = @"SELECT Tags.* FROM [collect2000].[ERCTasks].[TaskTags]
                            JOIN [collect2000].[ERCTasks].[Tags] ON Tags.TagId = TaskTags.TagId
                            WHERE TaskTags.TaskId = @taskId";
                var tags = db.Query<Tag>(q, new { taskId = TaskId });
                taskInfo.tags = tags.ToArray();

                // get the users assigned this task
                q = @"SELECT ETU.* FROM [Collect2000].[ERCTasks].[TaskUsers]
                        JOIN [collect2000].[ERCTasks].[Users] ETU ON ETU.UserId = TaskUsers.UserId
                        WHERE TaskUsers.TaskId = @taskId";
                var users = db.Query<User>(q, new { taskId = TaskId }).ToArray<User>();
                taskInfo.AssignedTo = users;
            }
            return taskInfo;
        }
Exemple #3
0
 private static void EmailAlerts(TaskInfo task)
 {
     var emailList = task.AssignedTo.Select(p => p.Email);
     SendEmails(emailList, task);
 }
 /// <summary>
 /// Assigns the task details.
 /// </summary>
 /// <param name="retrieveTask">The retrieve task.</param>
 /// <returns>returns task details</returns>
 public TaskPresenter AssignTaskDetails(TaskInfo retrieveTask)
 {
     this.taskDetails = retrieveTask;
     return this;
 }