public IActionResult AppointmentWithDoctorSetAppointment()
        {
            AppointmentWithDoctorViewModel appointmentViewModel = GetFilledAppointmentWithDoctorViewModel(null, null);
            var resultSetAppointment = netricaHelper.SetAppointment(appointmentViewModel);

            if (resultSetAppointment.Length == 0)
            {
                using (DataBaseContext db = new DataBaseContext())
                {
                    AppointmentQualityDBModel appointmentQualityModel = FillAppointmentQualityModel();

                    try
                    {
                        db.AppointmentQuality.Add(appointmentQualityModel);
                        db.SaveChanges();
                        return(Ok("OK"));
                    }
                    catch (Exception ex)
                    {
                        ErrorModel errorModel = new ErrorModel();
                        errorModel.IdError   = "m1";
                        errorModel.TextError = ex.Message;
                        return(Ok(ex.Message));
                    }
                }
            }
            else
            {
                ErrorModel errorModel = new ErrorModel();
                errorModel.IdError   = resultSetAppointment[0].IdError.ToString();
                errorModel.TextError = resultSetAppointment[0].ErrorDescription;
                return(Ok(errorModel.TextError));
            }
        }
Ejemplo n.º 2
0
        public void ViewingAndCancelRecordingCancelRecording()
        {
            string idAppointment = HttpContext.Session.GetString("idSelectAppointment");

            using (DataBaseContext db = new DataBaseContext())
            {
                try
                {
                    var appointment = db.AppointmentQuality.Where(a => a.IdAppointment == idAppointment).FirstOrDefault();
                    if (appointment != null)
                    {
                        var resultCancelAppointment = netricaHelper.CreateClaimForRefusalAsync(appointment.IdSelectLpu,
                                                                                               appointment.IdPatient,
                                                                                               appointment.IdAppointment);
                        if (resultCancelAppointment.Length == 0)
                        {
                            AppointmentQualityDBModel newCancelAppointment = new AppointmentQualityDBModel
                            {
                                IdAppointment   = "Cancel" + DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToShortTimeString() + "_" + appointment.IdAppointment,
                                DateAppointment = appointment.DateAppointment,
                                TimeAppointment = appointment.TimeAppointment,
                                NameDoctor      = appointment.NameDoctor,
                                IdDoctor        = appointment.IdDoctor,
                                NameSpeciality  = appointment.NameSpeciality,
                                IdPatient       = appointment.IdPatient,
                                FioPatient      = appointment.FioPatient,
                                BirthdayPatient = appointment.BirthdayPatient,
                                RoomNumber      = appointment.RoomNumber,
                                Rating          = appointment.Rating,
                                DateRating      = appointment.DateRating,
                                IdSelectLpu     = appointment.IdSelectLpu,
                                IdCurrentLpu    = appointment.IdCurrentLpu,
                                RecordingCancel = true
                            };
                            db.AppointmentQuality.Remove(appointment);
                            db.AppointmentQuality.Add(newCancelAppointment);
                            db.SaveChanges();
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
        private AppointmentQualityDBModel FillAppointmentQualityModel()
        {
            AppointmentQualityDBModel appointmentQualityModel = new AppointmentQualityDBModel
            {
                IdAppointment   = HttpContext.Session.GetString("idSelectAppointment"),
                IdCurrentLpu    = int.Parse(HttpContext.Session.GetString("idCurrentLpu")),
                IdSelectLpu     = int.Parse(HttpContext.Session.GetString("idSelectLpu")),
                IdDoctor        = HttpContext.Session.GetString("idSelectDoctor"),
                IdPatient       = HttpContext.Session.GetString("idPatient"),
                FioPatient      = HttpContext.Session.GetString("fioPatient"),
                BirthdayPatient = HttpContext.Session.GetString("birthdayPatient"),
                DateAppointment = DateTime.Parse(HttpContext.Session.GetString("selectDayDate")),
                NameDoctor      = HttpContext.Session.GetString("nameSelectDoctor"),
                NameSpeciality  = HttpContext.Session.GetString("nameSelectSpesiality"),
                RoomNumber      = HttpContext.Session.GetString("roomNumber"),
                TimeAppointment = HttpContext.Session.GetString("selectTime")
            };

            return(appointmentQualityModel);
        }