Пример #1
0
        public async Task <IActionResult> Delete(string id)
        {
            try
            {
                var response = await apiServicio.EliminarAsync(id, new Uri(WebApp.BaseAddressRM), "api/MaestroArticuloSucursal");

                if (response.IsSuccess)
                {
                    await GuardarLogService.SaveLogEntry(new LogEntryTranfer { ApplicationName = Convert.ToString(Aplicacion.WebAppRM), EntityID = string.Format("{0} : {1}", "Maestro Artículo de Sucursal", id), Message = "Registro eliminado", LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete), LogLevelShortName = Convert.ToString(LogLevelParameter.ADV), UserName = "******" });

                    return(this.Redireccionar($"{Mensaje.Informacion}|{response.Message}"));
                }
                return(this.Redireccionar($"{Mensaje.Error}|{response.Message}"));
            }
            catch (Exception ex)
            {
                await GuardarLogService.SaveLogEntry(new LogEntryTranfer { ApplicationName = Convert.ToString(Aplicacion.WebAppRM), Message = "Eliminar Maestro Artículo de Sucursal", ExceptionTrace = ex.Message, LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete), LogLevelShortName = Convert.ToString(LogLevelParameter.ERR), UserName = "******" });

                return(this.Redireccionar($"{Mensaje.Error}|{Mensaje.Excepcion}"));
            }
        }
Пример #2
0
        public async Task <entidades.Utils.Response> EliminarAsync(string id)
        {
            entidades.Utils.Response response = new entidades.Utils.Response();
            try
            {
                response = await apiservicio.EliminarAsync(id,
                                                           new Uri(WebApp.BaseAddress),
                                                           "/api/BasesDatos");

                if (response.IsSuccess)
                {
                    await GuardarLogService.SaveLogEntry(new LogEntryTranfer
                    {
                        ApplicationName      = Convert.ToString(Aplicacion.WebAppSeguridad),
                        EntityID             = string.Format("{0} : {1}", "BaseDatos", id),
                        Message              = "Registro eliminado",
                        LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete),
                        LogLevelShortName    = Convert.ToString(LogLevelParameter.ADV),
                        UserName             = "******"
                    });
                }
                return(response);
            }
            catch (Exception ex)
            {
                await GuardarLogService.SaveLogEntry(new LogEntryTranfer
                {
                    ApplicationName      = Convert.ToString(Aplicacion.WebAppSeguridad),
                    Message              = "Eliminar Base de datos",
                    ExceptionTrace       = ex,
                    LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete),
                    LogLevelShortName    = Convert.ToString(LogLevelParameter.ERR),
                    UserName             = "******"
                });

                response.IsSuccess = false;
                response.Message   = ex.Message;
                return(response);
            }
        }
Пример #3
0
        public async Task <IActionResult> Delete(string id)
        {
            try
            {
                var response = await apiServicio.EliminarAsync(id, new Uri(WebApp.BaseAddress)
                                                               , "api/FormulasRMU");

                if (response.IsSuccess)
                {
                    await GuardarLogService.SaveLogEntry(new LogEntryTranfer
                    {
                        ApplicationName      = Convert.ToString(Aplicacion.WebAppTh),
                        EntityID             = string.Format("{0} : {1}", "Sistema", id),
                        Message              = "Registro eliminado",
                        LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete),
                        LogLevelShortName    = Convert.ToString(LogLevelParameter.ADV),
                        UserName             = "******"
                    });

                    return(RedirectToAction("Index"));
                }
                return(RedirectToAction("Index", new { mensaje = response.Message }));

                //return BadRequest();
            }
            catch (Exception ex)
            {
                await GuardarLogService.SaveLogEntry(new LogEntryTranfer
                {
                    ApplicationName      = Convert.ToString(Aplicacion.WebAppTh),
                    Message              = "Eliminar FormulasRMU",
                    ExceptionTrace       = ex.Message,
                    LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete),
                    LogLevelShortName    = Convert.ToString(LogLevelParameter.ERR),
                    UserName             = "******"
                });

                return(BadRequest());
            }
        }
Пример #4
0
        public async Task <IActionResult> Delete(string id)
        {
            try
            {
                var response = await apiServicio.EliminarAsync(id, new Uri(WebApp.BaseAddress)
                                                               , "/api/EscalasEvaluacionesTotales");

                if (response.IsSuccess)
                {
                    await GuardarLogService.SaveLogEntry(new LogEntryTranfer
                    {
                        ApplicationName      = Convert.ToString(Aplicacion.WebAppTh),
                        EntityID             = string.Format("{0} : {1}", "Escala Evaluación Total", id),
                        Message              = "Registro de escala de evaluación total eliminado",
                        LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete),
                        LogLevelShortName    = Convert.ToString(LogLevelParameter.ADV),
                        UserName             = "******"
                    });

                    return(RedirectToAction("Index"));
                }
                return(BadRequest());
            }
            catch (Exception ex)
            {
                await GuardarLogService.SaveLogEntry(new LogEntryTranfer
                {
                    ApplicationName      = Convert.ToString(Aplicacion.WebAppTh),
                    Message              = "Eliminar Escala Evaluación Total",
                    ExceptionTrace       = ex,
                    LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete),
                    LogLevelShortName    = Convert.ToString(LogLevelParameter.ERR),
                    UserName             = "******"
                });

                return(BadRequest());
            }
        }
Пример #5
0
        public async Task <IActionResult> Delete(string id)
        {
            try
            {
                var response = await apiServicio.EliminarAsync(id, new Uri(WebApp.BaseAddress)
                                                               , "api/IndiceOcupacionalComportamientosObservables");

                if (response.IsSuccess)
                {
                    await GuardarLogService.SaveLogEntry(new LogEntryTranfer
                    {
                        ApplicationName      = Convert.ToString(Aplicacion.WebAppTh),
                        EntityID             = string.Format("{0} : {1}", "Sistema", id),
                        Message              = "Registro de Rol de Brigada Salud y Seguridad Ocupacional eliminado",
                        LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete),
                        LogLevelShortName    = Convert.ToString(LogLevelParameter.ADV),
                        UserName             = "******"
                    });

                    return(RedirectToAction("Index"));
                }
                return(BadRequest());
            }
            catch (Exception ex)
            {
                await GuardarLogService.SaveLogEntry(new LogEntryTranfer
                {
                    ApplicationName      = Convert.ToString(Aplicacion.WebAppTh),
                    Message              = "Eliminar Brigada SSO Roles",
                    ExceptionTrace       = ex.Message,
                    LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete),
                    LogLevelShortName    = Convert.ToString(LogLevelParameter.ERR),
                    UserName             = "******"
                });

                return(BadRequest());
            }
        }
        public async Task <IActionResult> Delete(string id)
        {
            try
            {
                var response = await apiServicio.EliminarAsync(id, new Uri(WebApp.BaseAddress)
                                                               , "/api/Adscpassws");

                if (response.IsSuccess)
                {
                    var responseLog = new EntradaLog
                    {
                        ExceptionTrace       = null,
                        LogCategoryParametre = Convert.ToString(LogCategoryParameter.Delete),
                        LogLevelShortName    = Convert.ToString(LogLevelParameter.ADV),
                        ObjectPrevious       = JsonConvert.SerializeObject(response.Resultado),
                        ObjectNext           = null,
                    };
                    await apiServicio.SalvarLog <entidades.Utils.Response>(HttpContext, responseLog);

                    return(RedirectToAction("Index"));
                }
                return(BadRequest());
            }
            catch (Exception ex)
            {
                var responseLog = new EntradaLog
                {
                    ExceptionTrace       = ex.Message,
                    LogCategoryParametre = Convert.ToString(LogCategoryParameter.Critical),
                    LogLevelShortName    = Convert.ToString(LogLevelParameter.ERR),
                    ObjectPrevious       = null,
                    ObjectNext           = null,
                };
                await apiServicio.SalvarLog <entidades.Utils.Response>(HttpContext, responseLog);

                return(BadRequest());
            }
        }
Пример #7
0
        public async Task <IActionResult> Delete(string id)
        {
            try
            {
                var response = await apiServicio.EliminarAsync(id, new Uri(WebApp.BaseAddress)
                                                               , "api/DenominacionesCompetencias");

                if (response.IsSuccess)
                {
                    return(this.RedireccionarMensajeTime(
                               "DenominacionesCompetencias",
                               "Index",
                               $"{Mensaje.Success}|{response.Message}|{"7000"}"
                               ));
                }
                return(this.RedireccionarMensajeTime("DenominacionesCompetencias", "Index", new { mensaje = response.Message }));
                //return BadRequest();
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }
        }
        public async Task <IActionResult> Delete(int id)
        {
            var respuesta = await apiServicio.EliminarAsync(
                id.ToString(),
                new Uri(WebApp.BaseAddress),
                "api/IndicesOcupacionales/"
                );

            if (respuesta.IsSuccess == true)
            {
                return(this.Redireccionar(
                           "IndicesOcupacionales",
                           "Index",
                           $"{Mensaje.Success}|{respuesta.Message}"
                           ));
            }

            return(this.Redireccionar(
                       "IndicesOcupacionales",
                       "Index",
                       $"{Mensaje.Aviso}|{respuesta.Message}"
                       ));
        }
Пример #9
0
        public async Task <IActionResult> DeleteAmbitoCapacitacion(string id)
        {
            try
            {
                var response = await apiServicio.EliminarAsync(id, new Uri(WebApp.BaseAddress)
                                                               , "api/GeneralCapacitacion");

                if (response.IsSuccess)
                {
                    return(RedirectToAction("IndexAmbitoCapacitacion"));
                }
                return(BadRequest());
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }
        }