Пример #1
0
 // Method to notify the Trainer of any Task completion.
 public bool Trainer_Notification(int id, bool done)
 {
     try
     {
         Task       data    = taskrepo.ReadById(id);
         Users      trainee = usersrepo.ReadById(data.TraineeId);
         Users      trainer = usersrepo.ReadById(data.TrainerId);
         EmailQueue email   = new EmailQueue();
         if (done)
         {
             email.ToAddress   = trainer.Email;
             email.FromAddress = "*****@*****.**";
             email.Subject     = trainee.Name + " Task Update";
             email.Body        = string.Format("Dear "
                                               + trainer.Name
                                               + ",<BR><BR>         The Task that you assigned to " + trainee.Name +
                                               " has been completed. Kindly check whether it is done properly or not.<BR><BR>Sincerely,<BR>Clanstech Team.");
             int r = emailrepo.Insert(email);
             if (r >= 1)
             {
                 return(true);
             }
         }
         else
         {
             email.ToAddress   = trainer.Email;
             email.FromAddress = "*****@*****.**";
             email.Subject     = trainee.Name + " Task Update";
             email.Body        = string.Format("Dear "
                                               + trainer.Name
                                               + ",<BR><BR>         The Task that you assigned to " + trainee.Name +
                                               " is not completed on time. Kindly take appropriate action.<BR><BR>Sincerely,<BR>Clanstech Team.");
             emailrepo.Insert(email);
         }
     }
     catch (Exception ex)
     {
         MethodBase method    = MethodBase.GetCurrentMethod();
         Exceptions exception = new Exceptions
         {
             Number  = ex.HResult.ToString(),
             Message = ex.Message,
             Method  = method.Name,
             Url     = System.Web.HttpContext.Current.Request.Url.AbsoluteUri
         };
         int r = exceptionrepo.Exception_Create(exception);
         if (r == 0)
         {
             exceptionrepo.Exception_InsertInLogFile(exception);
         }
         if (constr.State != ConnectionState.Open)
         {
             constr.Close();
             constr.Open();
         }
     }
     return(false);
 }
Пример #2
0
        // Method to prepare a E-mail to Activate a User's Account.
        public void AccountActivate(Users user)
        {
            EmailQueue email = new EmailQueue();

            email.ToAddress   = user.Email;
            email.FromAddress = "*****@*****.**";
            email.Subject     = "Registration Confirmation";
            email.Body        = string.Format("Dear " + user.UserName +
                                              ", <BR><BR>Please Click on the following link to Register your account<BR>                 <a href=http://"
                                              + Request.Url.Host + ":"
                                              + Request.Url.Port
                                              + Url.Action("Users_ActivateAccount", "Home", new { id = user.UserGuid })
                                              + ">Click Here</a><BR><BR>Sincerely,<BR>Clanstech Team.");
            emailrepo.Insert(email);
            return;
        }