public ActionResult Create(CreateViewModel model, User user, string btnSaveSend) { Student student = (Student)user; if (ModelState.IsValid) { try { var suggestion = new Suggestion { Title = model.Suggestion.Title, Keywords = model.Suggestion.Keywords, Context = model.Suggestion.Context, Subject = model.Suggestion.Subject, Goal = model.Suggestion.Goal, ResearchQuestion = model.Suggestion.ResearchQuestion, Motivation = model.Suggestion.Motivation, References = model.Suggestion.References, Student = student }; var coPromotor = new CoPromotor { FirstName = model.CoPromotor.FirstName, LastName = model.CoPromotor.LastName, Email = model.CoPromotor.Email, Company = model.CoPromotor.Organisation }; //researchdomains if (btnSaveSend != null) { student.GiveInSuggestion(student, suggestion); TempData["Success"] = "Uw voorstel werd aangemaakt en ingediend!"; } else { TempData["Success"] = "Uw voorstel werd aangemaakt!"; } student.CoPromotor = coPromotor; student.Suggestions.Add(suggestion); _userRepository.SaveChanges(); _suggestionRepository.SaveChanges(); return RedirectToAction("DashBoard", "Home"); } catch (ApplicationException e) { ModelState.AddModelError("", e.Message); // shows in summary } } return View(); }
public ActionResult Index(User user) { Promotor promotor = (Promotor)userRepository.FindBy(user.Id); ; //Student student1 = new Student(); //student1.FirstName = "Roy"; //student1.LastName = "Hollanders"; //student1.Email = "*****@*****.**"; //student1.Id = 4; //promotor.Students.Add(student1); IEnumerable<Student> studenten = promotor.Students; return View(studenten); }
public static void NotifyStudentGivenSuggestion(User user) { var fromAddress = new MailAddress("*****@*****.**"); const string fromPassword = "******"; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; var toAddress = new MailAddress(user.Email); using (var message = new MailMessage(fromAddress, toAddress) { Subject = "Voorstel ingeven", Body = "Een student heeft zijn voorstel ingegeven." }) smtp.Send(message); }
//People to notify: Student and Promotor public static void NotifyStakeholdersBpcHasGivenAdvice(User user) { var fromAddress = new MailAddress("*****@*****.**"); const string fromPassword = "******"; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; var users = new List<User>(); Student student = (Student) user; users.Add(student); users.Add(student.Promotor); foreach (var aUser in users) { var toAddress = new MailAddress(aUser.Email); using (var message = new MailMessage(fromAddress, toAddress) { Subject = "BPC advies", Body = "De BPC heeft advies gegeven." }) { smtp.Send(message); } } }
//People to notify: Student public static void NotifyStakeholderSuggestionAcceptedWithRemarks(User user) { var fromAddress = new MailAddress("*****@*****.**"); const string fromPassword = "******"; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; var toAddress = new MailAddress(user.Email); using (var message = new MailMessage(fromAddress, toAddress) { Subject = "Voorstel geaccepteerd met opmerkingen", Body = "Uw voorstel is geaccepteerd maar er zijn opmerkingen." }) smtp.Send(message); }
//People to notify: BPC public static void NotifyStakeholderAdviceBpcNeeded(User user) { var fromAddress = new MailAddress("*****@*****.**"); const string fromPassword = "******"; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; var toAddress = new MailAddress(user.Email); using (var message = new MailMessage(fromAddress, toAddress) { Subject = "Advies gevraagd", Body = "Er wordt gevraagd voor advies." }) smtp.Send(message); }
//public ActionResult SubmitSuggestion() //{ // return View("SubmitSuggestion"); //} public ViewResult Create(User user) { var student = (Student)user; return View(); }
public ActionResult Advice(int id, AdviceViewModel model, User user, string btnGive) { Suggestion suggestion = _suggestionRepository.FindBy(id); var bpCoordinator = (BPCoordinator)user; if (btnGive != null) { bpCoordinator.GiveAdvice(suggestion, model.Suggestion.Advice); TempData["Success"] = "Het advies is verzonden"; _suggestionRepository.SaveChanges(); } return RedirectToAction("Index", "Suggestion"); }
public ActionResult Detail(int id, User user, DetailViewModel model) { Student student = (Student)user; Suggestion suggestion = _suggestionRepository.FindBy(id); DetailViewModel suggestionViewModel = new DetailViewModel() { Suggestion = new SuggestionViewModel() { Id = suggestion.Id, Context = suggestion.Context, Goal = suggestion.Goal, Keywords = suggestion.Keywords, Motivation = suggestion.Motivation, References = suggestion.References, Subject = suggestion.Subject, ResearchQuestion = suggestion.ResearchQuestion, Title = suggestion.Title } }; String feedback = suggestion.Student.GetFeedbackStudent(); return View(suggestionViewModel); }
public ActionResult Evaluate(int id, EvaluateViewModel model, User user, string btnSend, string btnAccept, string btnDecline, string btnBack) { Suggestion suggestion = _suggestionRepository.FindBy(id); var student = suggestion.Student; if (ModelState.IsValid) { try { var promotor = (Promotor)user; if (btnSend != null) { promotor.GiveFeedback(model.Suggestion.Feedback, student, suggestion, ""); TempData["Success"] = "Uw feedback is verzonden"; } if (btnAccept != null) { promotor.GiveFeedback(model.Suggestion.Feedback, student, suggestion, btnAccept); //notifieer stakeholder TempData["Success"] = "Het voorstel is geaccepteerd"; } if (btnDecline != null) { promotor.SuggestionDoesNotComply(student, suggestion); //notifieer stakeholder TempData["Success"] = "Het voorstel is afgekeurd"; } _suggestionRepository.SaveChanges(); if (btnBack != null) { return RedirectToAction("Index", "Suggestion"); } } catch (ApplicationException e) { ModelState.AddModelError("", e.Message); // shows in summary } } TempData["Error"] = "Uw verzoek is niet gelukt"; return View(); }
public ActionResult Edit(int id, EditViewModel model, User user, string btnSaveSend) { Suggestion suggestion = _suggestionRepository.FindBy(id); if (ModelState.IsValid) { try { var student = (Student)user; suggestion.Title = model.Suggestion.Title; suggestion.Keywords = model.Suggestion.Keywords; suggestion.Context = model.Suggestion.Context; suggestion.Subject = model.Suggestion.Subject; suggestion.Goal = model.Suggestion.Goal; suggestion.ResearchQuestion = model.Suggestion.ResearchQuestion; suggestion.Motivation = model.Suggestion.Motivation; suggestion.References = model.Suggestion.References; suggestion.Student = student; //researchdomains if (btnSaveSend != null) { student.GiveInSuggestion(student, suggestion); TempData["Success"] = "Uw voorstel werd aangepast en ingediend!"; } else { TempData["Success"] = "Uw voorstel werd aangepast!"; } _userRepository.SaveChanges(); return RedirectToAction("DashBoard", "Home"); } catch (ApplicationException e) { ModelState.AddModelError("", e.Message); // shows in summary } } return View(); }