Esempio n. 1
0
        /// <summary>
        /// Permite obtener una Observacion Planeada Entity
        /// </summary>
        /// <param name="CodigoExpediente"></param>
        /// <returns>Entidad Observacion Planeada Response</returns>
        public ProcessResult <ObjetivoEstrategicoEmpresaResponse> ObtenerObjetivoEstrategicoEmpresa(ObjetivoEstrategicoEmpresaRequest data)
        {
            ProcessResult <ObjetivoEstrategicoEmpresaResponse> resultado = new ProcessResult <ObjetivoEstrategicoEmpresaResponse>();

            resultado.Result = new ObjetivoEstrategicoEmpresaResponse();
            try
            {
                if (data.CodigoObjetivoEstrategicoEmpresa.HasValue)
                {
                    BandejaObjetivoEstrategicoEmpresaRequest modelo = new BandejaObjetivoEstrategicoEmpresaRequest();
                    modelo.CodigoObjetivoEstrategicoEmpresa = data.CodigoObjetivoEstrategicoEmpresa;
                    modelo.CodigoIdioma = data.CodigoIdioma;

                    ObjetivoEstrategicoEmpresaEntity ObjetivoEstrategicoEmpresaEntity = ObjetivoEstrategicoEmpresaEntityRepository.GetById(data.CodigoObjetivoEstrategicoEmpresa);

                    if (ObjetivoEstrategicoEmpresaEntity != null)
                    {
                        ResponsableEntity responsableEntity = responsableEntityRepository.GetById(ObjetivoEstrategicoEmpresaEntity.CodigoResponsable);

                        resultado.Result = Mapper.Map <ObjetivoEstrategicoEmpresaEntity, ObjetivoEstrategicoEmpresaResponse>(ObjetivoEstrategicoEmpresaEntity);
                        resultado.Result.NombreCompletoResponsable = responsableEntity.Nombres + " " + responsableEntity.ApellidoPaterno + " " + responsableEntity.ApellidoMaterno;
                    }
                }
            }
            catch (Exception ex)
            {
                resultado.IsSuccess = false;
                resultado.Exception = new ApplicationLayerException <ObjetivoEstrategicoEmpresaService>(ex.Message);
            }
            return(resultado);
        }
Esempio n. 2
0
        public ProcessResult <ObjetivoEstrategicoEmpresaResponse> RegistrarObjetivoEstrategicoEmpresa(ObjetivoEstrategicoEmpresaRequest data)
        {
            ProcessResult <ObjetivoEstrategicoEmpresaResponse> resultado = new ProcessResult <ObjetivoEstrategicoEmpresaResponse>();

            resultado.Result = new ObjetivoEstrategicoEmpresaResponse();
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    ObjetivoEstrategicoEmpresaEntity ObjetivoEstrategicoEmpresaSincronizar = ObjetivoEstrategicoEmpresaEntityRepository.GetById(data.CodigoObjetivoEstrategicoEmpresa);
                    ObjetivoEstrategicoEmpresaEntity ObjetivoEstrategicoEmpresaGeneral     = Mapper.Map <ObjetivoEstrategicoEmpresaRequest, ObjetivoEstrategicoEmpresaEntity>(data);

                    if (ObjetivoEstrategicoEmpresaSincronizar != null)
                    {
                        Mapper.Map <ObjetivoEstrategicoEmpresaEntity, ObjetivoEstrategicoEmpresaEntity>(ObjetivoEstrategicoEmpresaGeneral, ObjetivoEstrategicoEmpresaSincronizar);
                        ObjetivoEstrategicoEmpresaSincronizar.EstadoRegistro = DatosConstantes.EstadoRegistro.Activo;
                        ObjetivoEstrategicoEmpresaEntityRepository.Editar(ObjetivoEstrategicoEmpresaSincronizar);
                        resultado.Result.CodigoObjetivoEstrategicoEmpresa      = data.CodigoObjetivoEstrategicoEmpresa;
                        resultado.Result.NombreObjetivoEstrategicoEmpresa      = data.NombreObjetivoEstrategicoEmpresa;
                        resultado.Result.DescripcionObjetivoEstrategicoEmpresa = data.DescripcionObjetivoEstrategicoEmpresa;
                        resultado.Result.CodigoModeloConceptual = data.CodigoModeloConceptual;
                        resultado.Result.CodigoResponsable      = data.CodigoResponsable;
                        resultado.Result.EstadoRegistro         = DatosConstantes.EstadoRegistro.Activo;
                    }
                    else
                    {
                        ObjetivoEstrategicoEmpresaEntityRepository.Insertar(ObjetivoEstrategicoEmpresaGeneral);
                        bool registroExitoso = resultado.IsSuccess;
                        if (!registroExitoso)
                        {
                            resultado.IsSuccess = false;
                            resultado.Exception = new ApplicationLayerException <ObjetivoEstrategicoEmpresaService>(MensajesSistemaResource.EtiquetaError);
                        }
                        resultado.Result.CodigoObjetivoEstrategicoEmpresa = ObjetivoEstrategicoEmpresaGeneral.CodigoObjetivoEstrategicoEmpresa;
                    }

                    ObjetivoEstrategicoEmpresaEntityRepository.GuardarCambios();
                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                resultado.IsSuccess = false;
                resultado.Exception = new ApplicationLayerException <ObjetivoEstrategicoEmpresaService>(ex.Message);
            }
            return(resultado);
        }