Пример #1
0
        public ActionResult LoadAppointNewPatientPartialView()
        {
            var patientAppointNew = new PatientAppointmentNewViewModel()
            {
                GenderDictionary   = _appointmentServices.GetAllGender(),
                AppointDate        = DateTime.Now,
                PhysicianListItems = _appointmentServices.GetAllDoctors()
            };

            return(PartialView("_AppointNewPatientPartialView", patientAppointNew));
        }
Пример #2
0
        public ActionResult CreateAppointmentNew(PatientAppointmentNewViewModel newPatientAppointment)
        {
            if (!ModelState.IsValid)
            {
                var patientAppointNew = new PatientAppointmentNewViewModel()
                {
                    GenderDictionary   = _appointmentServices.GetAllGender(),
                    PhysicianListItems = _appointmentServices.GetAllDoctors()
                };

                return(PartialView("_AppointNewPatientPartialView", patientAppointNew));
            }

            var patientId = Utilities.GeneratePatientId();

            var basicPatientAppointInfo = new Patient()
            {
                Pat_Id        = patientId,
                Firstname     = newPatientAppointment.Firstname,
                Lastname      = newPatientAppointment.Lastname,
                Middle        = newPatientAppointment.Middle,
                DoB           = new DateTime(newPatientAppointment.yearint, newPatientAppointment.monthint, newPatientAppointment.dateint),
                AddStreetBrgy = newPatientAppointment.AddStreetBrgy,
                DateRegister  = DateTime.Now,
                Muncity       = newPatientAppointment.Municipality,
                Province      = newPatientAppointment.Province,
                Gender        = newPatientAppointment.Gender,
                ContactCell   = newPatientAppointment.ContactCell
            };

            var appointment = new Appointment()
            {
                AppointDate = newPatientAppointment.AppointDate,
                Pat_Id      = patientId,
                Phys_id     = newPatientAppointment.Phys_Id,
                PriorNo     = 1,
                Status      = false,
                IsCancelled = false
            };

            _patientServices.InsertPatient(basicPatientAppointInfo);
            _appointmentServices.InsertAppointment(appointment);
            _unitofwork.Commit();

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

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