Пример #1
0
 internal static void SendReport(string from_email, string to_email, string subject, string message, DateTime today)
 {
     try
     {
         TaskSettings settings = new TaskSettings();
         settings = settings.Load();
         MailAddress from_address = new MailAddress(from_email, settings.name);
         MailAddress to_address = new MailAddress(to_email);
         MailMessage mail = new MailMessage(from_address, to_address);
         string date = today.Year + "-" + today.Month + "-" + today.Day;
         mail.Subject = subject.Replace("<Date>", date);
         mail.Body = message;
         SmtpClient smtpclient = new SmtpClient(settings.smtpServer);
         smtpclient.Credentials = new NetworkCredential(settings.email, settings.password);
         smtpclient.EnableSsl = true;
         smtpclient.Port = Convert.ToInt32(settings.smtpport);
         smtpclient.Send(mail);
     }
     catch (Exception e)
     {
         Notification notify = new Notification("Task Tracker: " + e.Message, "");
         notify.Urgency = Urgency.Critical;
         notify.Show();
     }
 }
Пример #2
0
 internal void LoadSettings(DateTime end)
 {
     settings = new TaskSettings();
     settings = settings.Load();
     destination_email_address.Text = settings.weeklyDestination;
     email_subject.Text = "Work Report for week " + (int)(end.DayOfYear*0.142857143) + ", " + end.Year;
     Reports report = new Reports();
     email_body.Buffer.Text = report.CompileWeeklyReport(end);
 }
Пример #3
0
 public Dialog_Settings()
 {
     this.Build ();
     TaskSettings settings = new TaskSettings();
     settings = settings.Load();
     interval.Text = (settings.interval/1000/60).ToString();
     name.Text = settings.name;
     email_address.Text = settings.email;
     email_subject.Text = settings.subject;
     email_destination.Text = settings.destination;
     smtp_server.Text = settings.smtpServer;
     email_password.Text = settings.password;
 }
Пример #4
0
 public static void Main(string[] args)
 {
     Application.Init();
     icon = StatusIcon.NewFromStock(Stock.ZoomIn);
     icon.Visible = true;
     icon.Tooltip = "Task Tracker";
     icon.PopupMenu += OnStatusIconPopupMenu;
     icon.Activate += MenuViewTaskActivated;
     TaskSettings settings = new TaskSettings();
     settings = settings.Load();
     watch = new Timer(settings.interval);
     watch.Elapsed += HandleWatchElapsed;
     watch.Start();
     RequestWork.DisplayMessage();
     Application.Run();
 }
Пример #5
0
 protected void OnButtonOkClicked(object sender, System.EventArgs e)
 {
     TaskSettings settings = new TaskSettings();
     string data = interval.Text;
     try
     {
         settings.interval = Int32.Parse(data)*1000*60; //Convert Minutes into milliseconds.
         settings.name = name.Text;
         settings.email = email_address.Text;
         settings.subject = email_subject.Text;
         settings.destination = email_destination.Text;
         settings.smtpServer = smtp_server.Text;
         settings.smtpport = smtp_port.Text;
         settings.password = email_password.Text;
         settings.Save();
         this.Destroy();
     }
     catch (Exception i)
     {
         Notification error = new Notification("Error", i.Message, Stock.Stop);
         error.Show();
     }
 }
Пример #6
0
 internal static void SendReport(string message, DateTime date)
 {
     TaskSettings settings = new TaskSettings();
     settings = settings.Load();
     SendReport(settings.email, settings.destination, settings.subject, message, date);
 }
Пример #7
0
 internal string CompileWeeklyReport(DateTime end)
 {
     DateTime last_monday = FindLastMonday(end);
     last_monday.AddHours(-(last_monday.Hour));
     string finished = "";
     string in_progress = "";
     foreach (Task task in finishedTasks)
     {
         if (task.Finished >= last_monday && task.Finished <= end)
         {
             finished += "- " + task.Summary + "\n";
         }
     }
     foreach (Task task in tasks.tasks)
     {
         bool was_worked = false;
         foreach (DateTime day in task.Worked)
         {
             if (day >= last_monday && day <= end)
             {
                 was_worked = true;
             }
         }
         if (was_worked)
         {
             in_progress += "- " + task.Summary + "\n";
         }
     }
     TaskSettings settings = new TaskSettings();
     settings = settings.Load();
     return settings.name + "\n\nRED Issues:\n\nAMBER Issues:\n\nGREEN Issues:\n" + finished + in_progress + "\nPlan for next week:\n" + in_progress + GetPlanned(end);
 }