コード例 #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.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());
        }
コード例 #2
0
        public IActionResult SendMessage(string id = "")
        {
            try
            {
                ViewBag.PatientId  = id;
                ViewBag.HeaderName = "Message";
                User luser1 = lIUserRepository.getUser(HttpContext.Session.GetString("UserId"));

                User luser = lIUserRepository.getUser(id);

                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 (luser.Type == 2)
                    {
                        lpatientList = lIPatient.GetPatientWithStatusByTherapistId(luser.UserId).OrderBy(x => x.Patient.PatientName).ToList();
                    }
                    else if (luser.Type == 3)
                    {
                        lpatientList = lIPatient.GetPatientWithStatusByProviderId(luser.UserId).OrderBy(x => x.Patient.PatientName).ToList();
                    }
                    else if (HttpContext.Session.GetString("UserType") == ConstantsVar.Support.ToString())
                    {
                        lpatientList = lIPatient.GetAllPatientStatus(HttpContext.Session.GetString("UserId")).OrderBy(x => x.Patient.PatientName).ToList();
                    }

                    ViewBag.UserType     = luser.Type;
                    ViewBag.ChatUserName = luser.Name;

                    if (lpatientList != null && lpatientList.Count >= 0 && (luser.Type == 2 || luser.Type == 3))
                    {
                        PatientMessage lpatient = (!string.IsNullOrEmpty(id) ? lpatientList.FirstOrDefault(x => x.Patient.PatientLoginId == luser1.UserId) : lpatientList.FirstOrDefault());
                        ViewBag.Patient   = lpatient.Patient.PatientName;
                        ViewBag.PatientId = lpatient.Patient.PatientLoginId;
                        List <MessageView> lmessages1 = lIMessageRepository.getMessagesbyTimeZone(lpatient.Patient.PatientLoginId, luser.UserId, DateTime.Now.ToString());

                        ViewBag.Messages = lmessages1.OrderBy(x => x.Datetime);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(View());
        }