Exemplo n.º 1
0
        public ActionResult GetLoggedPhysician()
        {
            appointHub = new AppointHub();

            var loggedUsers = appointHub.GetAllLoggedUsers();

            //var userlist = loggedUsers.Select(t => t.UserId).ToList();

            var dashboard = new DashBoardViewModel {
                loggedPhysician = loggedUsers.Count
            };

            return(PartialView("_GetLoggedPhysician", dashboard));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> CreateAppointmentOld(PatientAppointmentOldViewModel appointmentold)
        {
            bool success = false;



            if (!ModelState.IsValid)
            {
                var patientAppointment =
                    new PatientAppointmentOldViewModel
                {
                    PhysicianListItems = _appointmentServices.GetAllDoctors()
                };

                return(PartialView("_CreateAppointment", patientAppointment));
            }

            //var context = GlobalHost.ConnectionManager.GetHubContext<AppointHub>();

            var appointment = new Appointment()
            {
                AppointDate = appointmentold.AppointDate,
                Pat_Id      = appointmentold.PatientId,
                Phys_id     = appointmentold.PhysId,
                PriorNo     = 1,
                Status      = false,
                IsCancelled = false
            };


            var hasAppointmentExist =
                _appointmentServices.CheckAppointment(appointmentold.PatientId, appointmentold.PhysId, appointmentold.AppointDate);



            if (!hasAppointmentExist)
            {
                success = true;

                _appointmentServices.InsertAppointment(appointment);

                appointHub = new AppointHub();



                _unitofwork.Commit();

                var appointSchedulebydoctor = await _appointmentServices.GetAllAppointmentList();

                if (appointment.Phys_id != null)
                {
                    appointHub.SendAppointment(appointment.Phys_id, appointSchedulebydoctor.Where(t => t.PhyId == appointment.Phys_id && t.AppointDate == appointment.AppointDate && !t.BlStat).ToList());
                }
            }


            var url = Url.Action("GetAppointment_By_Doctor", "Appointment", new { id = appointment.Phys_id, appdate = appointment.AppointDate });


            return(Json(new { success = success, url = url }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> AppointmentOptions(AppointmentOptionsViewModel appointmentoption)
        {
            bool success = false;

            if (!ModelState.IsValid)
            {
                return(PartialView("_AppointmentOptions", appointmentoption));
            }

            var appointment = await _appointmentServices.GetAppointment(appointmentoption.AppNo);

            string   phyId   = appointment.Phys_id;
            DateTime appdate = (DateTime)appointment.AppointDate;


            switch (appointmentoption.AppOptions)
            {
            case AppointOptions.Cancel:

                appointment.IsCancelled = true;
                _appointmentServices.ModifyAppointment(appointment);
                success = true;
                break;

            case AppointOptions.Remove:
                _appointmentServices.RemoveAppointment(appointment);
                success = true;
                break;

            case AppointOptions.Replace:
                if (appointment.Pat_Id != appointmentoption.RepIdNo)
                {
                    //get medical record
                    var medicalRecord = _patientRecordServices.GetMedicalRecordByAppointment(appointment.No);

                    if (medicalRecord != null)
                    {
                        //remove medical record
                        _patientRecordServices.RemoveMedicalRecord(medicalRecord);
                    }


                    //update appointment
                    appointment.Pat_Id = appointmentoption.RepIdNo;
                    _appointmentServices.ModifyAppointment(appointment);

                    success = true;
                }

                break;

            case AppointOptions.Serve:

                appointment.Status = true;
                _appointmentServices.ModifyAppointment(appointment);

                success = true;
                break;
            }

            if (success == true)
            {
                appointHub = new AppointHub();

                //var id = _userPhysicianService.GetPhysicianUserId(phyId);

                _unitofwork.Commit();

                var appointSchedulebydoctor = await _appointmentServices.GetAllAppointmentList();

                appointHub.SendAppointment(phyId, appointSchedulebydoctor.Where(t => t.PhyId == phyId && t.AppointDate == appdate).ToList());
            }


            var url = Url.Action("GetAppointment_By_Doctor", "Appointment", new { id = phyId, appdate = appdate });

            return(Json(new { success = success, url = url }, JsonRequestBehavior.AllowGet));
        }