示例#1
0
        public IActionResult ConsultarDetallePorId([FromBody] ConsultaOrdenProcesoPlantaPorIdRequestDTO request)
        {
            Guid guid = Guid.NewGuid();

            _log.RegistrarEvento($"{guid}{Environment.NewLine}{JsonConvert.SerializeObject(request)}");

            ConsultaOrdenProcesoPlantaPorIdResponseDTO response = new ConsultaOrdenProcesoPlantaPorIdResponseDTO();

            try
            {
                response.Result.Data    = OrdenProcesoPlantaService.ConsultarOrdenProcesoPlantaDetallePorId(request);
                response.Result.Success = true;
            }
            catch (ResultException ex)
            {
                response.Result = new Result()
                {
                    Success = true, ErrCode = ex.Result.ErrCode, Message = ex.Result.Message
                };
            }
            catch (Exception ex)
            {
                response.Result = new Result()
                {
                    Success = false, Message = "Ocurrio un problema en el servicio, intentelo nuevamente."
                };
                _log.RegistrarEvento(ex, guid.ToString());
            }

            _log.RegistrarEvento($"{guid}{Environment.NewLine}{JsonConvert.SerializeObject(response)}");
            return(Ok(response));
        }
        public ConsultaOrdenProcesoPlantaPorIdBE ConsultarOrdenProcesoPlantaPorId(ConsultaOrdenProcesoPlantaPorIdRequestDTO request)
        {
            ConsultaOrdenProcesoPlantaPorIdBE consultaOrdenProcesoPlantaPorIdBE = _IOrdenProcesoPlantaRepository.ConsultarOrdenProcesoPlantaPorId(request.OrdenProcesoPlantaId);

            if (consultaOrdenProcesoPlantaPorIdBE != null)
            {
                consultaOrdenProcesoPlantaPorIdBE.detalle = _IOrdenProcesoPlantaRepository.ConsultarOrdenProcesoPlantaDetallePorId(request.OrdenProcesoPlantaId).ToList();


                List <ConsultaDetalleTablaBE> lista = _IMaestroRepository.ConsultarDetalleTablaDeTablas(consultaOrdenProcesoPlantaPorIdBE.EmpresaId, String.Empty).ToList();


                string[] certificacionesIds = consultaOrdenProcesoPlantaPorIdBE.TipoCertificacionId.Split('|');

                string certificacionLabel = string.Empty;


                if (certificacionesIds.Length > 0)
                {
                    List <ConsultaDetalleTablaBE> certificaciones = lista.Where(a => a.CodigoTabla.Trim().Equals("TipoCertificacion")).ToList();

                    foreach (string certificacionId in certificacionesIds)
                    {
                        ConsultaDetalleTablaBE certificacion = certificaciones.Where(a => a.Codigo == certificacionId).FirstOrDefault();

                        if (certificacion != null)
                        {
                            certificacionLabel = certificacionLabel + certificacion.Label + " ";
                        }
                    }
                }

                consultaOrdenProcesoPlantaPorIdBE.TipoCertificacion = certificacionLabel;
            }

            return(consultaOrdenProcesoPlantaPorIdBE);
        }
        public ConsultaOrdenProcesoPlantaPorIdBE ConsultarOrdenProcesoPlantaDetallePorId(ConsultaOrdenProcesoPlantaPorIdRequestDTO request)
        {
            ConsultaOrdenProcesoPlantaPorIdBE consultaOrdenProcesoPlantaPorIdBE = new ConsultaOrdenProcesoPlantaPorIdBE();


            consultaOrdenProcesoPlantaPorIdBE.detalle = _IOrdenProcesoPlantaRepository.ConsultarOrdenProcesoPlantaDetallePorId(request.OrdenProcesoPlantaId).ToList();


            return(consultaOrdenProcesoPlantaPorIdBE);
        }