示例#1
0
        public JPStudentRundown Find(int id)//this is to create a JPStudentRundown object out of a primary key for a JPStudent, I used this logic to hook up the Delete and the Edit method calls and don't like repeating it a bunch so I put it into
        //a method down here.
        {
            var student          = db.JPStudents.Find(id);
            var applicationCount = db.JPApplications.Where(a => a.JPStudentId == student.JPStudentId).Count();
            var dateCriteria     = DateTime.Now.AddDays(-7);
            var thisWeek         = db.JPApplications.Where(a => a.JPStudentId == student.JPStudentId && a.JPApplicationDate >= dateCriteria).Count();
            var jPStudent        = new JPStudentRundown(student, applicationCount, thisWeek);

            return(jPStudent);
        }
示例#2
0
        /*
         *      // GET: JPStudentRundown/Delete/5
         *      public ActionResult Delete(int id)
         *      {
         *          //JPStudentRundown jpstudent = BuildRundownObj(id);
         *          JPStudent jpStudent = db.JPStudents.Find(id);
         *          if (jpStudent == null)
         *          {
         *              return HttpNotFound();
         *          }
         *          return View(jpStudent);
         *      }
         *
         *      // POST: JPStudentRundown/Delete/5
         *      [HttpPost, ActionName("Delete")]
         *      [ValidateAntiForgeryToken]
         *      public ActionResult DeleteConfirmed(int id)
         *      {
         *          JPStudent jPStudent = db.JPStudents.Find(id);
         *          db.JPStudents.Remove(jPStudent);
         *          db.SaveChanges();
         *          return RedirectToAction("Index");
         *      }
         */

        public JPStudentRundown BuildRundownObj(int id)//this is to create a JPStudentRundown object out of a JPStudent key
        {
            var student          = db.JPStudents.Find(id);
            var studentApps      = db.JPApplications.Where(a => a.ApplicationUserId == student.ApplicationUserId).ToList();
            var applicationCount = studentApps.Count();
            var thisWeekCount    = studentApps.Where(a => a.IsAppliedDateWithinOneWeekOfCurrentDate == true).Count();
            // Logan - this should return a count of every true result in the JPChecklists table specific to the current ApplicationUserid.
            var checkListStatus = db.JPChecklists.Where(a => a.ApplicationUserid == student.ApplicationUserId == true).Count();
            var studentRundown  = new JPStudentRundown(student.JPName, student.JPEmail, student.JPStudentLocation.ToString(), student.DaysSinceStart, student.JPLinkedIn, student.JPPortfolio, applicationCount, thisWeekCount, id, student.JPGraduated, 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();
            var         studentRundown   = new JPStudentRundown(student, checklist, applicationCount, thisWeekCount, LatestContact.CalculateLastContactDate, checkListStatus);

            return(studentRundown);
        }
示例#4
0
        // GET: JPStudentRundown/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JPStudent        jpstudent        = db.JPStudents.Find(id);
            JPStudentRundown jPStudentRundown = new JPStudentRundown(jpstudent);

            if (jPStudentRundown == null)
            {
                return(HttpNotFound());
            }
            return(View(jPStudentRundown));
        }
        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);
        }
示例#6
0
        public ViewResult Index(string sortOrder, string searchString)
        {
            ViewBag.NameSortParm     = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.DateSortParm     = sortOrder == "Date" ? "date_desc" : "Date";
            ViewBag.LocationSortParm = sortOrder == "Location" ? "location_desc" : "Location";
            ViewBag.GraduateSortParm = sortOrder == "Graduate" ? "graduate_desc" : "Graduate";


            List <JPStudentRundown> jPStudentRundownList = new List <JPStudentRundown>();


            var students = from s in db.JPStudents
                           select s;


            if (!String.IsNullOrEmpty(searchString))
            {
                string searchStringNoSpaces = Regex.Replace(searchString, @"\s+", "");
                students = students.Where(s => s.JPStudentLocation.ToString().Contains(searchString) || s.JPStudentLocation.ToString().Contains(searchStringNoSpaces) || s.JPName.Contains(searchString));
            }

            switch (sortOrder)
            {
            case "Graduate":
                students = students.Where(s => (s.JPApplications.Count() >= 30));
                break;

            case "graduate_desc":
                students = students.Where(s => (s.JPApplications.Count() >= 30));
                break;

            case "name_desc":
                students = students.OrderByDescending(s => s.JPName);
                break;

            case "Date":
                students = students.OrderBy(s => s.JPStartDate);
                break;

            case "date_desc":
                students = students.OrderByDescending(s => s.JPStartDate);
                break;

            case "Location":
                students = students.OrderBy(s => s.JPStudentLocation);
                break;

            case "location_desc":
                students = students.OrderByDescending(s => s.JPStudentLocation);
                break;

            default:     //Name ascending
                students = students.OrderBy(s => s.JPName);
                break;
            }



            foreach (var student in students)
            {
                var applicationCount = db.JPApplications.Where(a => a.JPStudentId == student.JPStudentId).Count();
                var dateCriteria     = DateTime.Now.AddDays(-7);
                var thisWeek         = db.JPApplications.Where(a => a.JPStudentId == student.JPStudentId && a.JPApplicationDate >= dateCriteria).Count();
                var jPStudent        = new JPStudentRundown(student, applicationCount, thisWeek);
                jPStudentRundownList.Add(jPStudent);
            }



            return(View(jPStudentRundownList));
        }
示例#7
0
        public ViewResult Index(string sortOrder, string searchString)
        {
            ViewBag.NameSortParm     = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.DateSortParm     = sortOrder == "Date" ? "date_desc" : "Date";
            ViewBag.LocationSortParm = sortOrder == "Location" ? "location_desc" : "Location";
            ViewBag.GraduateSortParm = sortOrder == "Graduate" ? "graduate_desc" : "Graduate";


            List <JPStudentRundown> jPStudentRundownList = new List <JPStudentRundown>();


            var students = from s in db.JPStudents where s.JPHired == false //setting the logic here so we can skip the whole passing of the object into the list, and then not have to look at it in the view at all. Before it would still have to hit all the information below
                                                                            //where as now it will skip the following and not even be there in the view
                           select s;



            if (!String.IsNullOrEmpty(searchString))
            {
                string searchStringNoSpaces = Regex.Replace(searchString, @"\s+", "");
                students = students.Where(s => s.JPStudentLocation.ToString().Contains(searchString) || s.JPStudentLocation.ToString().Contains(searchStringNoSpaces) || s.JPName.Contains(searchString));
            }

            switch (sortOrder)
            {
            case "Graduate":
                students = students.Where(s => (s.JPApplications.Count() >= 30));
                break;

            case "graduate_desc":
                students = students.Where(s => (s.JPApplications.Count() >= 30));
                break;

            case "name_desc":
                students = students.OrderByDescending(s => s.JPName);
                break;

            case "Date":
                students = students.OrderBy(s => s.JPStartDate);
                break;

            case "date_desc":
                students = students.OrderByDescending(s => s.JPStartDate);
                break;

            case "Location":
                students = students.OrderBy(s => s.JPStudentLocation);
                break;

            case "location_desc":
                students = students.OrderByDescending(s => s.JPStudentLocation);
                break;

            default:     //Name ascending
                students = students.OrderBy(s => s.JPName);
                break;
            }



            foreach (var student in students)
            {
                var applicationCount = db.JPApplications.Where(a => a.JPStudentId == student.JPStudentId).Count();
                var dateCriteria     = DateTime.Now.AddDays(-7);
                var thisWeek         = db.JPApplications.Where(a => a.JPStudentId == student.JPStudentId && a.JPApplicationDate >= dateCriteria).Count();
                var jPStudent        = new JPStudentRundown(student, applicationCount, thisWeek);
                jPStudentRundownList.Add(jPStudent);
            }



            return(View(jPStudentRundownList));
        }