Esempio n. 1
0
        //load the message screen with assigned patient's and their messages with particular user
        // GET: /<controller>/
        public IActionResult Index(string patientid = "")
        {
            List <PatientMessage> lpatientList = new List <PatientMessage>();

            if (!string.IsNullOrEmpty(HttpContext.Session.GetString("UserId")) && !string.IsNullOrEmpty(HttpContext.Session.GetString("UserType")) && HttpContext.Session.GetString("UserType") != "0")
            {
                if (HttpContext.Session.GetString("UserType") == ConstantsVar.Therapist.ToString())
                {
                    lpatientList = IPatient.GetPatientWithStatusByTherapistId(HttpContext.Session.GetString("UserId")).OrderBy(x => x.Patient.PatientName).ToList();
                }
                else if (HttpContext.Session.GetString("UserType") == ConstantsVar.Provider.ToString())
                {
                    lpatientList = IPatient.GetPatientWithStatusByProviderId(HttpContext.Session.GetString("UserId")).OrderBy(x => x.Patient.PatientName).ToList();
                }
                else if (HttpContext.Session.GetString("UserType") == ConstantsVar.Installer.ToString())
                {
                    lpatientList = IPatient.GetPatientWithStatusByInstallerId(HttpContext.Session.GetString("UserId")).OrderBy(x => x.Patient.PatientName).ToList();
                }
                else if (HttpContext.Session.GetString("UserType") == ConstantsVar.Support.ToString())
                {
                    lpatientList = IPatient.GetAllPatientStatus(HttpContext.Session.GetString("UserId")).OrderBy(x => x.Patient.PatientName).ToList();
                }
                if (lpatientList != null && lpatientList.Count > 0)
                {
                    PatientMessage lpatient = (!string.IsNullOrEmpty(patientid) ? lpatientList.FirstOrDefault(x => x.Patient.PatientLoginId == patientid) : lpatientList.FirstOrDefault());
                    ViewBag.Patient   = lpatient.Patient.PatientName;
                    ViewBag.PatientId = lpatient.Patient.PatientLoginId;
                    List <MessageView> lmessages = lIMessageRepository.getMessagesbyTimeZone(lpatient.Patient.PatientLoginId, HttpContext.Session.GetString("UserId"), HttpContext.Session.GetString("timezoneid"));

                    ViewBag.Messages = lmessages.OrderBy(x => x.Datetime);
                }
                ViewBag.PatientList = lpatientList;
            }
            return(View());
        }