コード例 #1
0
 /// <summary>
 /// Overrides the behaviour of the Equals method.
 /// </summary>
 /// <param name="obj">The object to check for equality.</param>
 /// <returns>Whether they can be considered equal.</returns>
 public override bool Equals(object obj)
 {
     if (obj is CancelledClass)
     {
         CancelledClass c = obj as CancelledClass;
         if (this.CourseID.Equals(c.CourseID) &&
             this.DateCancelled.Equals(c.DateCancelled))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
        }         //end of method

        /// <summary>
        /// This sends an email for a cancelled class.
        /// </summary>
        /// <param name="email">The email address</param>
        /// <param name="cancelled">The cancelled course</param>
        private static void sendEmail(string email, CancelledClass cancelled)
        {
            Debug.WriteLine("\nSending email to: " + email + " for class: \n" + cancelled);
            string body = "<b>You have a cancelled class:</b><br><br>" + cancelled.CourseID +
                          " " + cancelled.Title + "<br>Date cancelled: " + cancelled.DateCancelled +
                          "<br>Teacher: " + cancelled.Teacher + "<br>Notes: " + cancelled.Notes +
                          "<br><br><br>To unsubscribe from this course, visit: " +
                          "<a href='http://waldo.dawsoncollege.qc.ca/0932340/cancel'>http://waldo.dawsoncollege.qc.ca/0932340/cancel</a>";

            Debug.WriteLine("\nBody of email message:\n" + body);

            MailMessage message = new MailMessage("*****@*****.**", email,
                                                  "Cancelled Class " + cancelled.Title, body);

            message.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();

            smtp.Send(message);
            message.Dispose();
            smtp.Dispose();
        }
コード例 #3
0
        /// <summary>
        /// This sends an email for a cancelled class.
        /// </summary>
        /// <param name="email">The email address</param>
        /// <param name="cancelled">The cancelled course</param>
        private static void sendEmail(string email, CancelledClass cancelled)
        {
            Debug.WriteLine("\nSending email to: " + email + " for class: \n" + cancelled);
            string body = "<b>You have a cancelled class:</b><br><br>" + cancelled.CourseID +
                " " + cancelled.Title + "<br>Date cancelled: " + cancelled.DateCancelled +
                "<br>Teacher: " + cancelled.Teacher + "<br>Notes: " + cancelled.Notes +
                "<br><br><br>To unsubscribe from this course, visit: " +
            "<a href='http://waldo.dawsoncollege.qc.ca/0932340/cancel'>http://waldo.dawsoncollege.qc.ca/0932340/cancel</a>";
            Debug.WriteLine("\nBody of email message:\n" + body);

            MailMessage message = new MailMessage("*****@*****.**", email,
                "Cancelled Class " + cancelled.Title , body );
            message.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Send(message);
            message.Dispose();
            smtp.Dispose();
        }