/// <summary> /// Gets the instance. /// </summary> /// <param name="context">The context.</param> /// <returns></returns> public static ClinicRegistryManager GetInstance(HPCareDBContext context) { Patient patient = context.Users.Find(HttpContext.Current.Session["patientId"]) as Patient; //get information about the current clinic logged in CurrentUserId currentStaff = new CurrentUserId(); int currentIdStaff = currentStaff.AccessDatabase(HttpContext.Current.User.Identity.Name); //Users staff = currentStaff.ReturnCurrentUser(currentIdStaff); Staff staff = context.Users.Find(currentIdStaff) as Staff; if (singletonInstance == null) { // singletonInstance = new ClinicRegistryManager { ClinicRegistryManagerId = AccessDatabase(patient, staff, context).ClinicRegistryManagerId }; singletonInstance = new ClinicRegistryManager { Clinic_patient = patient, Staff_doctor = staff }; Visit visit = new Visit { Visit_Date = DateTime.Today.Date, Visit_Hour = DateTime.Now.TimeOfDay }; context.VisitManagers.Add(new VisitManager { visit = visit, PatientVisitRegistry = singletonInstance }); context.SaveChanges(); } return(context.ClinicRegistryManagers.Find(singletonInstance.ClinicRegistryManagerId)); }
public JsonResult GetPatientMcdtsJson() { CurrentUserId current = new CurrentUserId(); Patient patient = db.Users.Find(current.AccessDatabase(User.Identity.GetUserName())) as Patient; var list = impPatient.GetPatientMcdtsHistory(patient.User_id); return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult GetStaffInformation() { Staff staff = db.Users.Find(current.AccessDatabase(User.Identity.Name)) as Staff; return Json(impStaff.GetStaffInformations(staff.User_id), JsonRequestBehavior.AllowGet); }
public JsonResult GetPatientTemplateInformation() { return(Json(impPatient.GetPatientInformation(current.AccessDatabase(User.Identity.Name)), JsonRequestBehavior.AllowGet)); }