Example #1
0
 private void ExportOutlook()
 {
     if (OutlookSettings.Export)
     {
         Outlook Out = new Outlook();
         try
         {
             Out.MessageResults += new InformationalMessage(MessageResults);
             Out.Export(OutlookSettings, myCourses);
         }
         catch //(Exception Ex)
         {
             throw;
         }
         finally
         {
             Out.MessageResults -= new InformationalMessage(MessageResults);
         }
     }
 }
Example #2
0
        public void Email_Usage()
        {
            if (ExportSuccessful)
            {
                Outlook MyOutlook = new Outlook();

                string Body = "Dear User,\r\n\r\nPlease send this email to me so I can keep track of usage.\r\n\r\nThank you very much.\r\n\r\nMike Jenck\r\n\r\n";

                Body += "From Username: "******"\r\nEmail: " + UserSettings.Email + "\r\n";
                if (ClickerSettings.Export)
                {
                    Body += "Clicker is selected for export.\r\n";
                }
                if (OutlookSettings.Export)
                {
                    Body += "Outlook is selected for export.\r\n";
                }
                if (WamapSettings.Export)
                {
                    Body += "Wamap is selected for export.\r\n";
                }
                if (WebAssignSettings.Export)
                {
                    Body += "WebAssign is selected for export.\r\n";
                }
                if (ExcelClassSettings.Export)
                {
                    Body += "ExcelClass is selected for export.\r\n";
                }
                if (ExcelRollSettings.Export)
                {
                    Body += "ExcelRoll is selected for export.\r\n";
                }
                if (MTGSettings.Export)
                {
                    Body += "MTG is selected for export.\r\n";
                }
                string Subject = "IBE Usage Report";

                if (Properties.Settings.Default.EmailUsage)
                {
                    DateTime NextEmailDate = Properties.Settings.Default.EmailDateAfter;
                    if (DateTime.Now >= NextEmailDate)
                    {
                        Properties.Settings.Default.EmailDateAfter = NextEmailDate.AddDays(60);
                        Properties.Settings.Default.Save();
                        Body += "\r\n\r\nNext email date will be on ar after: " + Properties.Settings.Default.EmailDateAfter.ToShortDateString() + ".";
                        if (MyOutlook != null)
                        {
                            bool Successful = MyOutlook.CreateEmail(Properties.Settings.Default.EmailTo, Subject, Body);
                            if (!Successful)
                            {
                                // Fall back if outlook does not work
                                Mail.EmailDeveloper(Properties.Settings.Default.EmailTo, Subject, Body);
                            }
                        }
                        else
                        {
                            Mail.EmailDeveloper(Properties.Settings.Default.EmailTo, Subject, Body);
                        }

                        Properties.Settings.Default.Save();
                    }
                }
            }
        }