Exemple #1
0
        /// <summary>
        /// Generates and sends email to the newly accepted student asynchronously
        /// </summary>
        /// <param name="data"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        private async Task GenerateEmail(StudentData data, string password)
        {
            StaticVariables.StudentDetails = ContactApi.GetDataFromApi <UCMStudent>("getStudents");
            UCMStudent student = StaticVariables.StudentDetails.FirstOrDefault(p => p.AlternateEmail == data.NonUCMOEmailId);

            data.Id = student.Id;
            MailMessage mail = new MailMessage();

            mail.To.Add(new MailAddress(student.AlternateEmail));
            mail.From       = new MailAddress("*****@*****.**");
            mail.Subject    = "Congratulations";
            mail.IsBodyHtml = false;
            mail.Body       = EmailBody(data, password);
            using (var client = new SmtpClient())
            {
                client.Port        = 587;
                client.Credentials = new NetworkCredential
                {
                    UserName = "******",
                    Password = "******"
                };
                client.EnableSsl = true;
                client.Host      = "smtp.gmail.com";
                await client.SendMailAsync(mail);
            }
        }
Exemple #2
0
 /// <summary>
 /// Redirects to advisor home page
 /// </summary>
 /// <returns></returns>
 public ActionResult Advisor()
 {
     StaticVariables.StudentDetails   = ContactApi.GetDataFromApi <UCMStudent>("getStudents");
     StaticVariables.AdvisorDetails   = ContactApi.GetDataFromApi <UCMModerator>("getAdvisors");
     StaticVariables.Programs         = ContactApi.GetDataFromApi <Program>("getPrograms");
     StaticVariables.Courses          = ContactApi.GetDataFromApi <Models.Course>("getCourses");
     StaticVariables.Roles            = ContactApi.GetDataFromApi <Role>("getRoles");
     StaticVariables.TrainingStatuses = ContactApi.GetDataFromApi <Student_TrainingStatus>("getStudentTrainingStatus");
     StaticVariables.Trainings        = ContactApi.GetDataFromApi <Training>("getTrainingRepo");
     StaticVariables.AcademicStatuses = ContactApi.GetDataFromApi <Student_AcademicStatus>("getStudentAcademicStatus");
     ViewBag.Title = StaticVariables.AdvisorDetails.FirstOrDefault(p => p.Id == int.Parse(User.Identity.Name)).FirstName;
     return(View());
 }
Exemple #3
0
 /// <summary>
 /// Redirects to director home page
 /// </summary>
 /// <returns></returns>
 public ActionResult Director()
 {
     StaticVariables.StudentDetails   = ContactApi.GetDataFromApi <UCMStudent>("getStudents");
     StaticVariables.AdvisorDetails   = ContactApi.GetDataFromApi <UCMModerator>("getAdvisors");
     StaticVariables.Programs         = ContactApi.GetDataFromApi <Program>("getPrograms");
     StaticVariables.Courses          = ContactApi.GetDataFromApi <Models.Course>("getCourses");
     StaticVariables.Roles            = ContactApi.GetDataFromApi <Role>("getRoles");
     StaticVariables.TrainingStatuses = ContactApi.GetDataFromApi <Student_TrainingStatus>("getStudentTrainingStatus");
     StaticVariables.Trainings        = ContactApi.GetDataFromApi <Training>("getTrainingRepo");
     StaticVariables.AcademicStatuses = ContactApi.GetDataFromApi <Student_AcademicStatus>("getStudentAcademicStatus");
     StaticVariables.Majors           = ContactApi.GetDataFromApi <Major>("getMajors");
     ViewBag.Title = "Mr. Director";
     return(View());
 }
Exemple #4
0
        /// <summary>
        /// Redirects to home page of students,
        /// </summary>
        /// <returns></returns>
        public ActionResult Student()
        {
            StaticVariables.StudentDetails   = ContactApi.GetDataFromApi <UCMStudent>("getStudents");
            StaticVariables.Roles            = ContactApi.GetDataFromApi <Role>("getRoles");
            StaticVariables.TrainingStatuses = ContactApi.GetDataFromApi <Student_TrainingStatus>("getStudentTrainingStatus");
            StaticVariables.Trainings        = ContactApi.GetDataFromApi <Training>("getTrainingRepo");
            StaticVariables.AcademicStatuses = ContactApi.GetDataFromApi <Student_AcademicStatus>("getStudentAcademicStatus");
            ViewBag.Title = StaticVariables.StudentDetails.FirstOrDefault(p => p.Id == int.Parse(User.Identity.Name)).FirstName;
            UCMStudent student             = StaticVariables.StudentDetails.FirstOrDefault(p => p.Id == int.Parse(User.Identity.Name));
            bool       questionnaireStatus = checkQuestionnaire(Convert.ToInt32(User.Identity.Name));

            if (!questionnaireStatus)
            {
                return(RedirectToAction("FillQuestionnaire", "Questionnaire"));
            }
            if (StaticVariables.TrainingStatuses.FirstOrDefault(p => p.Id == student.StudentTrainingStatusId).TrainingStatus.ToLower().Equals("Due".ToLower()))
            {
                return(RedirectToAction("AcademicCodeOfConduct"));
            }
            return(View());
        }
Exemple #5
0
 /// <summary>
 /// Returns View with list of Courses to choose from drop down
 /// </summary>
 /// <returns></returns>
 public ActionResult GetCourse()
 {
     StaticVariables.Courses = ContactApi.GetDataFromApi <Models.Course>("getCourses");
     return(View(StaticVariables.Courses));
 }