public ActionResult All(string page) { ActionResult returnResult; // *** Get proper page, default to 1 *** //int pageVal; //if (!int.TryParse(page, out pageVal)) // pageVal = 1; int pageNum = this.GetPage(page); // *** Get entries *** TrackingHistoryResult result = this.DashboardRepository.TrackingHistory.GetHistoryEntries(pageNum, ItemsPerPage); // *** Create model *** TrackingEntryList model = new TrackingEntryList(); // *** Add data to model *** model.Entries = result.TrackingEntries; model.ShowPatientLinks = true; // *** Add paging data *** model.Paging.SetPagingData(ItemsPerPage, pageNum, result.TotalEntries); model.Paging.BaseUrl = Url.Action("All", "TrackingHistory", new { page = "" }); TempData[ReturnUrl] = Url.Action("All", "TrackingHistory", new { page = page }); returnResult = View(model); return(returnResult); }
public ActionResult ByPatient(string dfn, string page) { // *** Show tracking history by patient and page *** ActionResult returnResult; // *** Get proper page, default to 1 *** //int pageVal; //if (!int.TryParse(page, out pageVal)) // pageVal = 1; int pageNum = this.GetPage(page); // *** Create model *** TrackingEntryList model = new TrackingEntryList(); // *** Get current page of data from repository *** TrackingHistoryResult result = this.DashboardRepository.TrackingHistory.GetPatientEntries(dfn, pageNum, ItemsPerPage); // *** Check result *** if (result.Success) { // *** Old code to manually filter by patient *** //model.Entries = new List<TrackingEntry>(); //if (result.TrackingEntries != null) // if (result.TrackingEntries.Count > 0) // foreach (TrackingEntry entry in result.TrackingEntries) // if (entry.PatientDfn == dfn) // model.Entries.Add(entry); model.Entries = result.TrackingEntries; // *** Hide patient link *** model.ShowPatientLinks = false; // *** Set paging data *** model.Paging.SetPagingData(ItemsPerPage, pageNum, result.TotalEntries); model.Paging.BaseUrl = Url.Action("ByPatient", "TrackingHistory", new { page = "" }); } else { this.Error(result.Message); } // *** Set return url *** if (TempData.ContainsKey(ReturnUrl)) { model.ReturnUrl = TempData[ReturnUrl].ToString(); TempData[ReturnUrl] = TempData[ReturnUrl]; } returnResult = View(model); return(returnResult); }
public ActionResult Details(string dfn, string page) { // *** Show details of a flagged patient *** FlaggedPatientDetail model = new FlaggedPatientDetail(); // *** Get patient demographics *** model.Patient = this.CurrentPatient; // *** Check for success *** if (!model.Patient.NotFound) { // *** Get patient flags *** TrackingHistoryResult trackingResult = this.DashboardRepository.TrackingHistory.GetPatientEntries(dfn); // *** Set tracking entries if successful *** if (trackingResult.Success) { model.TrackingEntries = trackingResult.TrackingEntries; } NoteListResult notesResult = this.DashboardRepository.Notes.GetList(dfn); int pageNum = this.GetPage(page); if (notesResult.Success) { // *** Add current page's patients *** int startIdx = (pageNum - 1) * ProgNotesPerPage; int endIdx = startIdx + ProgNotesPerPage - 1; if (endIdx >= notesResult.Notes.Count) { endIdx = notesResult.Notes.Count - 1; } for (int i = startIdx; i <= endIdx; i++) { model.ProgressNotes.Add(notesResult.Notes[i]); } model.ProgressNotePaging.SetPagingData(ProgNotesPerPage, pageNum, notesResult.Notes.Count); model.ProgressNotePaging.BaseUrl = Url.Action("Details", "FlaggedPatients", new { dfn = dfn, page = "" }); } else { model.ProgressNotes = new List <TiuNote>(); } } // *** Set return url *** if (TempData.ContainsKey(ReturnUrl)) { model.ReturnUrl = TempData[ReturnUrl].ToString(); TempData[ReturnUrl] = TempData[ReturnUrl]; } // *** Indicate proper action for details link *** model.DetailAction = "ProgressNote"; return(View(model)); }