Ejemplo n.º 1
0
        public ResultadoOperacionDto GuardarListaNotificacion(ListaNotificacionDto dto, long idUsuarioExec, long idEmpresaExc)
        {
            var resultado = new ResultadoOperacionDto()
            {
                Resultado = true
            };

            try
            {
                resultado = ListaNotificacionRepository.Guardar(dto);

                var param = new List <object>()
                {
                    dto.Nombre
                };
                var informacionAuditoria = new InformacionAuditoriaDto(
                    idUsuarioExec,
                    dto.IdListaNotificacion == 0 ? ConstantsAccionAuditable.Insertar : ConstantsAccionAuditable.Actualizar,
                    ConstantsModulo.ListasNotificacion,
                    dto.IdListaNotificacion == 0 ? MensajesServicios.InsertarListaNotificacion : MensajesServicios.ActualizarListaNotificacion,
                    param,
                    idEmpresaExc
                    );
                resultado.InformacionAuditoria = informacionAuditoria;
            }
            catch (Exception ex)
            {
                LogUtil.Error(ex);
                resultado.Resultado            = false;
                resultado.InformacionAuditoria = null;
            }

            return(resultado);
        }
Ejemplo n.º 2
0
        public ResultadoOperacionDto Guardar(ListaNotificacionDto listaNotificacionDto)
        {
            var dto = new ResultadoOperacionDto();

            StringBuilder sql = new StringBuilder();

            sql.Append("select * from ListaNotificacion ");

            try
            {
                if (listaNotificacionDto.IdListaNotificacion == 0)
                {
                    List <string> ClaveListas = ExecuteQuery(sql.ToString()).Select(t => t.ClaveLista).ToList();
                    if (!ClaveListas.Contains(listaNotificacionDto.ClaveLista))
                    {
                        var listaNotificacion = new ListaNotificacion
                        {
                            Nombre        = listaNotificacionDto.Nombre,
                            Descripcion   = listaNotificacionDto.Descripcion,
                            TituloMensaje = listaNotificacionDto.TituloMensaje,
                            ClaveLista    = listaNotificacionDto.ClaveLista
                        };
                        Add(listaNotificacion);

                        dto.InformacionExtra = listaNotificacion.IdListaNotificacion;
                    }
                    else
                    {
                        dto.Resultado        = true;
                        dto.InformacionExtra = "-1";
                        dto.Mensaje          = null;
                    }
                }
                else
                {
                    var listaNotificacion = GetById(listaNotificacionDto.IdListaNotificacion);

                    listaNotificacion.Nombre        = listaNotificacionDto.Nombre;
                    listaNotificacion.Descripcion   = listaNotificacionDto.Descripcion;
                    listaNotificacion.TituloMensaje = listaNotificacionDto.TituloMensaje;
                    listaNotificacion.ClaveLista    = listaNotificacionDto.ClaveLista;

                    Update(listaNotificacion);

                    dto.InformacionExtra = listaNotificacion.IdListaNotificacion;
                }
                dto.Resultado = true;
            }
            catch (Exception exception)
            {
                dto.Resultado = false;
                dto.Mensaje   = exception.Message;
            }
            return(dto);
        }
        public IHttpActionResult GuardarListaNotificacion()
        {
            var resultado = new ResultadoOperacionDto()
            {
                Resultado = false
            };

            var jsonString       = getFormKeyValue("json");
            var parametroSistema = new ListaNotificacionDto();

            JsonConvert.PopulateObject(jsonString, parametroSistema);

            resultado = ListaNotificacionService.GuardarListaNotificacion(parametroSistema, IdUsuarioExec, IdEmpresa);

            return(Ok(resultado));
        }