public JPStudentRundown BuildRundownObj(int id)//this is to create a JPStudentRundown object out of a JPStudent keyte { var student = db.JPStudents.Find(id); var LatestContact = db.JPLatestContacts.Where(a => a.ApplicationUserId == student.ApplicationUserId).FirstOrDefault(); var studentApps = db.JPApplications.Where(a => a.ApplicationUserId == student.ApplicationUserId).ToList(); var applicationCount = studentApps.Count(); var thisWeekCount = studentApps.Where(a => a.IsAppliedDateWithinOneWeekOfCurrentDate == true).Count(); var checkListStatus = CheckListStatusCount(id); JPChecklist checklist = db.JPChecklists.Where(a => a.ApplicationUserid == student.ApplicationUserId).FirstOrDefault(); var studentRundown = new JPStudentRundown(student, checklist, applicationCount, thisWeekCount, LatestContact.CalculateLastContactDate, checkListStatus); return(studentRundown); }
public JPStudentRundown BuildRundownObj(int id)//this is to create a JPStudentRundown object out of a JPStudent keyte { var student = db.JPStudents.Find(id); var LatestContact = db.JPLatestContacts.Where(a => a.ApplicationUserId == student.ApplicationUserId).FirstOrDefault(); var studentApps = db.JPApplications.Where(a => a.ApplicationUserId == student.ApplicationUserId).ToList(); var applicationCount = studentApps.Count(); var thisWeekCount = studentApps.Where(a => a.IsAppliedDateWithinOneWeekOfCurrentDate == true).Count(); var checkListStatus = CheckListStatusCount(id); JPChecklist checklist = db.JPChecklists.Where(a => a.ApplicationUserid == student.ApplicationUserId).FirstOrDefault(); checklist.JPBusinessCards = false; checklist.JPMeetups = false; checklist.JPUpdatedLinkedIn = false; checklist.JPUpdatedPortfolioSite = false; checklist.JPCleanGitHub = false; checklist.JpRoundTables = false; var studentRundown = new JPStudentRundown(student, checklist, applicationCount, thisWeekCount, LatestContact.CalculateLastContactDate, checkListStatus); return(studentRundown); }
public ActionResult _Checklist(string applicationUserId) { JPChecklist checklist = db.JPChecklists.Where(a => a.ApplicationUserid == applicationUserId).FirstOrDefault(); return(PartialView("_Checklist", checklist)); }
public ActionResult Create([Bind(Include = "JPStudentId,JPName,JPEmail,JPStudentLocation,JPStartDate," + "JPLinkedIn,JPPortfolio,JPGithubLink,JPContact,JPGraduated,JPHired")] JPStudent jPStudent) { //if (ModelState.IsValid) //{ // db.JPStudents.Add(jPStudent); // db.SaveChanges(); // return RedirectToAction("Index"); //} //return View(jPStudent); if (ModelState.IsValid) { // Test to see if URL provided has http or https in it. // If not, then save as is. If it does, strip the protocol. string linkedInUrl = jPStudent.JPLinkedIn; Regex regexLI = new Regex(@"^http(s)?://"); Match matchLI = regexLI.Match(linkedInUrl); if (matchLI.Success) { Uri linkedInNewURL = new Uri(linkedInUrl); string linkedInOutput = linkedInNewURL.Host + linkedInNewURL.PathAndQuery; jPStudent.JPLinkedIn = linkedInOutput; } else { jPStudent.JPLinkedIn = linkedInUrl; } // Test to see if URL provided has http or https in it. If not, // then save as is. If it does, strip the protocol. string portfolioUrl = jPStudent.JPPortfolio; Regex regexP = new Regex(@"^http(s)?://"); Match matchP = regexP.Match(portfolioUrl); if (matchP.Success) { Uri portfolioNewURL = new Uri(portfolioUrl); string portfolioOutput = portfolioNewURL.Host + portfolioNewURL.PathAndQuery; jPStudent.JPPortfolio = portfolioOutput; } else { jPStudent.JPPortfolio = portfolioUrl; } JPLatestContact jPLatestContact = new JPLatestContact { JPLatestContactDate = DateTime.Now, ApplicationUserId = User.Identity.GetUserId(), JPLatestContactId = Guid.NewGuid() }; db.JPLatestContacts.Add(jPLatestContact); db.SaveChanges(); jPStudent.JPStartDate = DateTime.Now; jPStudent.JPGraduated = false; jPStudent.JPHired = false; jPStudent.ApplicationUserId = User.Identity.GetUserId(); db.JPStudents.Add(jPStudent); db.SaveChanges(); var checklist = new JPChecklist(); checklist.ApplicationUserid = User.Identity.GetUserId(); checklist.JPBusinessCards = checklist.JPCleanGitHub = checklist.JPMeetups = checklist.JpRoundTables = checklist.JPUpdatedLinkedIn = checklist.JPUpdatedPortfolioSite = false; db.JPChecklists.Add(checklist); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jPStudent)); }