/* * _FSForward * * When forward button is clicked, move the flow sheets * table forward by 12 hours. * */ public ActionResult _FSForward(FlowSheetsModel model) { model = verifyModel(model); //change hours and days to add 12 hours to current time model.forwardTime(); Session["fs_date"] = model.curDate; Session["fs_am"] = model.am; model = verifyModel(model); int id = Convert.ToInt32(Session["patientId"].ToString()); var db_logic = new DatabaseLogic(connection, id); db_logic.DatabaseIntegrityCheck(Session["mrn"].ToString(), model); Session["fs_date"] = model.curDate; Session["fs_am"] = model.am; //reload the page so that the correct data is filled in for new time return(RedirectToAction("FlowSheets", model)); }
/* * _FSBackward * * When back button is clicked, move the flow sheets * table back by 12 hours. * */ public ActionResult _FSBackward(FlowSheetsModel model) { model = verifyModel(model); //move all times back by 12 hours, update AM/PM accordingly model.backwardTime(); Session["fs_date"] = model.curDate; Session["fs_am"] = model.am; model = verifyModel(model); int id = Convert.ToInt32(Session["patientId"].ToString()); var db_logic = new DatabaseLogic(connection, id); db_logic.DatabaseIntegrityCheck(Session["mrn"].ToString(), model); Session["fs_date"] = model.curDate; Session["fs_am"] = model.am; //reload the page so that the correct data is filled in for new time return(RedirectToAction("FlowSheets", model)); }
public ActionResult FlowSheets() { var model = new FlowSheetsModel(); var db_logic = new DatabaseLogic(connection); // get the mrn of the current patient to display correct flow // sheets data string patient_mrn = Session["mrn"].ToString(); model.databaseId = Convert.ToInt32(Session["patientId"].ToString()); //if it's the first time the patient is visiting the page, //display the current day and time if ((Session["fs_am"]) == null) { model.curDate = DateTime.Today.Date; //for SQL query, set the first datetime of the page range if (model.am) { model.sqlTime = model.curDate.ToString("MM:dd:yyyy") + ":" + model.amTimes[0].Substring(0, 2); } else { model.sqlTime = model.curDate.ToString("MM:dd:yyyy") + ":" + model.pmTimes[0].Substring(0, 2); } Session["fs_date"] = model.curDate; Session["fs_am"] = model.am; //verify that the model has all correct data model = verifyModel(model); //verify that all the flowsheets boxes are correct db_logic.DatabaseIntegrityCheck(patient_mrn, model); model = db_logic.GetFlowSheetsInputData(patient_mrn, model); // set the correct hours to display based on time of day if (DateTime.Now.Hour < 12) { model.am = true; string[] temp = new string[12]; model.displayTimes = temp; for (int i = 0; i < model.displayTimes.Length; i++) { model.displayTimes[i] = model.amTimes[i]; } } else { model.am = false; model.displayTimes = new string[12]; for (int i = 0; i < model.displayTimes.Length; i++) { model.displayTimes[i] = model.pmTimes[i]; } } } // if the patient has already visited the page, display // the last day/time where they left off else { model.am = Convert.ToBoolean(Session["fs_am"]); model.curDate = Convert.ToDateTime(Session["fs_date"]); if (model.am) { model.sqlTime = model.curDate.ToString("MM:dd:yyyy") + ":" + model.amTimes[0].Substring(0, 2); } else { model.sqlTime = model.curDate.ToString("MM:dd:yyyy") + ":" + model.pmTimes[0].Substring(0, 2); } model = verifyModel(model); db_logic.DatabaseIntegrityCheck(patient_mrn, model); model = db_logic.GetFlowSheetsInputData(patient_mrn, model); } return(View(model)); }