Example #1
0
        public TurnoDto Update(TurnoDto dto)
        {
            var obj = _turnoRepository.GetById(dto.Id);

            if (obj != null)
            {
                obj.FechaTurno         = dto.FechaTurno;
                obj.Dia                = dto.Dia;
                obj.Hora               = dto.Hora;
                obj.Descripcion        = dto.Descripcion;
                obj.Ocupado            = dto.Ocupado;
                obj.CancelacionEmpresa = dto.CancelacionEmpresa;
                obj.EmpresaId          = dto.EmpresaId;
                obj.CategoriaId        = dto.CategoriaId;

                _turnoRepository.Update(obj);
                Save();

                return(dto);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        internal override DtoBase PopulateDto(OracleDataReader reader)
        {
            var turno = new TurnoDto();

            //
            if (!reader.IsDBNull(_ordTrnId))
            {
                turno.TrnId = reader.GetInt32(_ordTrnId);
            }
            //
            if (!reader.IsDBNull(_ordTrnFecha))
            {
                turno.TrnFecha = reader.GetString(_ordTrnFecha);
            }
            //
            if (!reader.IsDBNull(_ordTrnHora))
            {
                turno.TrnHora = reader.GetString(_ordTrnHora);
            }
            //
            if (!reader.IsDBNull(_ordTrnMontoCobrado))
            {
                turno.TrnMontoCobrado = reader.GetInt32(_ordTrnMontoCobrado);
            }
            //
            if (!reader.IsDBNull(_ordTrnEstId))
            {
                turno.TrnEstId = reader.GetInt32(_ordTrnEstId);
            }
            //
            if (!reader.IsDBNull(_ordTrnProId))
            {
                turno.TrnProId = reader.GetInt32(_ordTrnProId);
            }
            //
            if (!reader.IsDBNull(_ordTrnSesId))
            {
                turno.TrnSesId = reader.GetInt32(_ordTrnSesId);
            }
            //
            if (!reader.IsDBNull(_ordTrnPaeId))
            {
                turno.TrnPaeId = reader.GetInt32(_ordTrnPaeId);
            }
            //
            if (!reader.IsDBNull(_ordTrnDatId))
            {
                turno.TrnDatId = reader.GetInt32(_ordTrnDatId);
            }
            //
            if (!reader.IsDBNull(_ordTrnOspId))
            {
                turno.TrnOspId = reader.GetInt32(_ordTrnOspId);
            }
            // IsNew
            turno.IsNew = false;

            return(turno);
        }
 public DatosEnLinea(OrdenDeProduccionDto op, UsuarioDto supervisorLinea, List <DefectoDto> observados, List <DefectoDto> Reproceso, TurnoDto t)
 {
     this.op = op;
     this.supervisorLinea = supervisorLinea;
     this.observados      = observados;
     this.Reproceso       = Reproceso;
     this.t = t;
     inspeccionPresentador = new InspeccionPresentador(op);
     InitializeComponent();
 }
Example #4
0
 public VistaInspeccion(OrdenDeProduccionDto op, UsuarioDto supervisorCalidad, List <DefectoDto> observados, List <DefectoDto> Reproceso, TurnoDto t)//List<int> horasTurno)
 {
     this.op = op;
     this.supervisorCalidad = supervisorCalidad;
     this.observados        = observados;
     this.Reproceso         = Reproceso;
     this.t = t;
     inspeccionPresentador = new InspeccionPresentador(op);
     InitializeComponent();
 }
Example #5
0
 public static TurnoEntity TurnoToEntity(TurnoDto dto)
 {
     return(new TurnoEntity
     {
         FechaFinTurno = dto.FechaFinRegistro,
         FechaInicioTurno = dto.FechaInicioRegistro,
         FechaRegistro = dto.FechaRegistro,
         PersonaId = dto.PersonaId,
         TipoRegistro = dto.TipoRegistro,
         TurnoId = dto.TurnoId
     });
 }
Example #6
0
        public void ActualizarTurno(TurnoDto turno)
        {
            _turno = turno;
            int i = 0;

            foreach (var h in turno.Horas)
            {
                IzquierdaDerechaPorHora izqDerPorHora = new IzquierdaDerechaPorHora();
                izqDerPorHora.SetHora(h);
                izqDerPorHora.Location = new Point(izquierdaDerechaPorHora.Location.X + izquierdaDerechaPorHora.Size.Width * i, izquierdaDerechaPorHora.Location.Y);

                pDefectos.Controls.Add(izqDerPorHora);
                _pHorasHead.Add(izqDerPorHora);
                i++;
            }
            DefectoCelda AcumuladoHead = new DefectoCelda();

            AcumuladoHead.SetTexto("Acumulado");
            AcumuladoHead.Location = new Point(izquierdaDerechaPorHora.Location.X + izquierdaDerechaPorHora.Size.Width * i, izquierdaDerechaPorHora.Location.Y);
            pDefectos.Controls.Add(AcumuladoHead);

            // cargar primera

            var sumatoria     = 0.0;
            var cantidadHoras = turno.Horas.Length;

            i = 0;
            foreach (var h in turno.Horas)
            {
                var tupla = CargarContadoresPares(h);


                DefectoIzqDerHora contador = new DefectoIzqDerHora();
                contador.SetContadores(tupla.Item2, tupla.Item1);
                sumatoria        += tupla.Item2;
                contador.Location = new Point(RelacionObjetivoPrimera.Location.X + RelacionObjetivoPrimera.Size.Width * i, RelacionObjetivoPrimera.Location.Y);
                pPares.Controls.Add(contador);
                _pContadorespares.Add(contador);


                IzquierdaDerechaPorHora izqDerPorHora = new IzquierdaDerechaPorHora();
                izqDerPorHora.SetHora(h);
                izqDerPorHora.CambiarCabecera();
                izqDerPorHora.Location = new Point(PrimeraObjetivoHora.Location.X + PrimeraObjetivoHora.Size.Width * i, PrimeraObjetivoHora.Location.Y);

                pPares.Controls.Add(izqDerPorHora);
                _pHorasParesHead.Add(izqDerPorHora);
                i++;
            }
            Promedio.SetTexto(string.Format("{0:0.00}", (sumatoria / cantidadHoras)));
        }
Example #7
0
        public Turno CreateTurno(TurnoDto turno)
        {
            var entity = new Turno {
                PacienteId         = turno.PacienteId,
                MedicoDerivacionId = turno.MedicoDerivacionId,
                Estado             = turno.Estado,
                FechaHoraTurno     = turno.FechaHoraTurno,
                AgendaId           = turno.AgendaId
            };

            _repository.Add <Turno>(entity);

            return(entity);
        }
Example #8
0
        public bool Add(TurnoDto turno)
        {
            if (Object.ReferenceEquals(turno, null) || Object.ReferenceEquals(turno.Paciente, null))
            {
                throw new Exception("No se pudo grabar el turno.");
            }

            using (var t = new TransactionScope())
            {
                try
                {
                    // Si no existe ese paciente, lo creamos...
                    if (!_pacienteServicio.VerificarExistencia(turno.Paciente.Dni))
                    {
                        // Guardo el id del paciente que me devuelve el servicio
                        // para grabarlo en el turno
                        var grabarPaciente = _pacienteServicio.Add(turno.Paciente);

                        turno.PacienteId = grabarPaciente;
                    }

                    _unidadDeTrabajo.TurnoRepositorio.AddNoAsync(new Entidades.Turno
                    {
                        PacienteId      = turno.PacienteId,
                        EspecialidadId  = turno.EspecialidadId,
                        MedicoId        = 24,
                        RecepcionistaId = 17,
                        Numero          = ObtenerNumeroTurno(),
                        FechaEmision    = DateTime.Now,
                        FechaAtencion   = turno.FechaAtencion,
                        EstadoTurno     = Constantes.Clases.EstadoTurno.En_Espera
                    });

                    _unidadDeTrabajo.CommitNoAsync();

                    t.Complete();

                    return(true);
                }
                catch (Exception e)
                {
                    t.Dispose();
                    throw new Exception(e.Message);
                }
            }
        }
        public void ComenzarInspeccion(OrdenDeProduccionDto op, UsuarioDto supervisorCalidadActual)
        {
            //TRAEMOS EL TURNO EN QUE SE ENCUENTRA
            TurnoDto t = this.ObtenerTurno();

            //TRAEMOS UN ARRAY DE DEFECTOS DTO Y LO HACEMOS UNA LISTA
            List <DefectoDto> ddto = new List <DefectoDto>();

            foreach (DefectoDto d in Adaptador.GetDefectos())
            {
                ddto.Add(new DefectoDto {
                    IdDefecto   = d.IdDefecto,
                    Detalle     = d.Detalle,
                    TipoDefecto = d.TipoDefecto
                });
            }


            if (t != null)
            {
                //OBTENEMOS DOS LISTAS, UNA DE DEFECTOS REPROCESO Y OTRA DE OBSERVADOS
                List <DefectoDto> observados = ddto.FindAll(
                    delegate(DefectoDto dO) {
                    return(dO.TipoDefecto == "Observado");
                });

                List <DefectoDto> reproceso = ddto.FindAll(
                    delegate(DefectoDto dr) {
                    return(dr.TipoDefecto == "Reproceso");
                });


                VistaInspeccion vistaIspeccion = new VistaInspeccion(op, supervisorCalidadActual, observados, reproceso, t);
                DatosEnLinea    datosEnLinea   = new DatosEnLinea(op, op.SupLineaAsignado, observados, reproceso, t);
                vistaIspeccion.agregarObservador(datosEnLinea);
                datosEnLinea.RellenarCamposyTablas();
                vistaIspeccion.RellenarCamposyTablas();
                vistaIspeccion.Show();
                datosEnLinea.Show();
            }
            else
            {
                MessageBox.Show("No se puede Comenzar una INSPECCION. Esta fuera del turno de Trabajo");
            }
        }
Example #10
0
        public async Task <IActionResult> CrearTurno(TurnoDto turno)
        {
            try
            {
                if (turno == null)
                {
                    return(BadRequest("Solicitud Inválida"));
                }

                var result = await _turno.CrearTurno(turno);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, string.Format("Ha ocurrido un error: {0}", ex.Message)));
            }
        }
Example #11
0
        public JsonResult GrabarTurno([FromBody] TurnoDto datosTurno)
        {
            var response = new Response();

            try
            {
                /*
                 * var turnoDto = new TurnoDto();
                 *
                 * turnoDto.PacienteId = datosTurno.Paciente.Id;
                 * turnoDto.EspecialidadId = datosTurno.Turno.EspecialidadId;
                 * turnoDto.MedicoId = datosTurno.Turno.MedicoId;
                 * turnoDto.FechaAtencion = datosTurno.Turno.FechaAtencion;
                 * turnoDto.Paciente.Nombre = datosTurno.Paciente.Nombre;
                 * turnoDto.Paciente.Apellido = datosTurno.Paciente.Apellido;
                 * turnoDto.Paciente.Dni = datosTurno.Paciente.Dni;
                 * turnoDto.Paciente.LocalidadId = datosTurno.Paciente.LocalidadId;
                 * turnoDto.Paciente.FechaNacimiento = datosTurno.Paciente.FechaNacimiento;
                 * turnoDto.Paciente.Email = datosTurno.Paciente.Email;
                 * turnoDto.Paciente.Celular = datosTurno.Paciente.Celular;
                 * turnoDto.Paciente.Telefono = datosTurno.Paciente.Telefono;
                 */
                bool ejecutarAdd = _turnoServicio.Add(datosTurno);

                if (ejecutarAdd)
                {
                    response.Estado  = true;
                    response.Mensaje = "El turno fue grabado exitosamente";

                    return(Json(new { response = response }));
                }

                response.Estado  = false;
                response.Mensaje = "Ocurrio u nerror al grabar el turno";

                return(Json(new { response = response }));
            }
            catch
            {
                response.Estado  = false;
                response.Mensaje = "Ocurrio un error al grabar el turno";
                return(Json(new { response = response }));
            }
        }
Example #12
0
        public async Task <RespuestaDto <TurnoDto> > CrearTurno(TurnoDto turno)
        {
            TurnoDto datosTurno = new TurnoDto();

            try
            {
                var datos = await _turnoRepository.CrearTurno(TurnoMapper.TurnoToEntity(turno), conStr);

                if (datos != null)
                {
                    datosTurno = TurnoMapper.TurnoToDto(datos);
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"{ex.Message}");
            }

            return(MensajeRespuesta.CrearMensajeRespuesta(datosTurno, string.Empty, true));
        }
Example #13
0
        public TurnoDto Add(TurnoDto dto)
        {
            var obj = new Domain.Entity.Entity.Turno()
            {
                FechaTurno         = dto.FechaTurno,
                Dia                = dto.Dia,
                Hora               = dto.Hora,
                Descripcion        = dto.Descripcion,
                Ocupado            = dto.Ocupado,
                CancelacionEmpresa = dto.CancelacionEmpresa,
                EmpresaId          = dto.EmpresaId,
                Eliminado          = dto.Eliminado,
                CategoriaId        = dto.CategoriaId
            };

            _turnoRepository.Add(obj);
            Save();

            dto.Id = obj.Id;

            return(dto);
        }
        public void MostrarDatosEnLinea(OrdenDeProduccionDto op, UsuarioDto supLinea)
        {
            TurnoDto t = this.ObtenerTurno();

            if (t != null)
            {
                //TRAEMOS UN ARRAY DE DEFECTOS DTO Y LO HACEMOS UNA LISTA
                List <DefectoDto> ddto = new List <DefectoDto>();
                foreach (DefectoDto d in Adaptador.GetDefectos())
                {
                    ddto.Add(new DefectoDto
                    {
                        IdDefecto   = d.IdDefecto,
                        Detalle     = d.Detalle,
                        TipoDefecto = d.TipoDefecto
                    });
                }

                //OBTENEMOS DOS LISTAS, UNA DE DEFECTOS REPROCESO Y OTRA DE OBSERVADOS
                List <DefectoDto> observados = ddto.FindAll(
                    delegate(DefectoDto dO) {
                    return(dO.TipoDefecto == "Observado");
                });

                List <DefectoDto> reproceso = ddto.FindAll(
                    delegate(DefectoDto dr) {
                    return(dr.TipoDefecto == "Reproceso");
                });

                DatosEnLinea vistaDatosEnLinea = new DatosEnLinea(op, supLinea, observados, reproceso, t);
                vistaDatosEnLinea.RellenarCamposyTablas();
                vistaDatosEnLinea.Show();
            }
            else
            {
                MessageBox.Show("No se puedo ver datos en linea, Esta fuera del turno de Trabajo");
            }
        }
 public ActionResult <Turno> Post(TurnoDto paciente)
 {
     return(StatusCode(201, _service.CreateTurno(paciente)));
 }