public async Task <IActionResult> Create()
        {
            try
            {
                var adscexe = new AdscexeViewModel
                {
                    Del = false,
                    Sel = false,
                    Upd = false,
                    Ins = false,
                };
                await CargarListaCombox();

                return(View(adscexe));
            }
            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());
            }
        }
Exemple #2
0
        public async Task <IActionResult> CrearPermisoGrupo(string adgrBdd, string adgrGrupo, string mensaje)
        {
            var miem = new AdscexeViewModel
            {
                AdexBdd   = adgrBdd,
                AdexGrupo = adgrGrupo,
            };

            await CargarListaCombox();

            InicializarMensaje(mensaje);
            return(View(miem));
        }
Exemple #3
0
        public async Task <IActionResult> CrearPermisoGrupoPost(AdscexeViewModel adscexeViewModel)
        {
            var response = new entidades.Utils.Response();
            var adscexe  = new Adscexe();

            try
            {
                if (!ModelState.IsValid)
                {
                    adscexe = new Adscexe
                    {
                        AdexAplicacion = adscexeViewModel.AdexAplicacion,
                        Adex           = adscexeViewModel.Adex,
                        AdexBdd        = adscexeViewModel.AdexBdd,
                        AdexGrupo      = adscexeViewModel.AdexGrupo,
                        AdexNavigation = adscexeViewModel.AdexNavigation,
                        AdexSistema    = adscexeViewModel.AdexSistema,
                        AdexSql        = adscexeViewModel.AdexSql,
                    };

                    await CargarListaCombox(adscexe);

                    return(RedirectToAction("CrearPermisoGrupo", new { adgrBdd = adscexe.AdexBdd, adgrGrupo = adscexe.AdexGrupo }));
                }

                int ins = 0;
                int del = 0;
                int upd = 0;
                int sel = 0;

                if (adscexeViewModel.Del == true)
                {
                    del = 1;
                }
                if (adscexeViewModel.Ins == true)
                {
                    ins = 1;
                }
                if (adscexeViewModel.Upd == true)
                {
                    upd = 1;
                }
                if (adscexeViewModel.Sel == true)
                {
                    sel = 1;
                }


                adscexe = new Adscexe
                {
                    AdexAplicacion = adscexeViewModel.AdexAplicacion,
                    Adex           = adscexeViewModel.Adex,
                    AdexBdd        = adscexeViewModel.AdexBdd,
                    AdexGrupo      = adscexeViewModel.AdexGrupo,
                    AdexNavigation = adscexeViewModel.AdexNavigation,
                    AdexSistema    = adscexeViewModel.AdexSistema,
                    AdexSql        = adscexeViewModel.AdexSql,
                    Del            = del,
                    Sel            = sel,
                    Upd            = upd,
                    Ins            = ins,
                };


                response = await apiServicio.InsertarAsync(adscexe,
                                                           new Uri(WebApp.BaseAddress),
                                                           "api/Adscexes/InsertarAdscexe");

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

                    return(RedirectToAction("MenusGrupo", new { adgrBdd = adscexe.AdexBdd, adgrGrupo = adscexe.AdexGrupo }));
                }
                await CargarListaCombox();

                return(RedirectToAction("CrearPermisoGrupo", new { adgrBdd = adscexe.AdexBdd, adgrGrupo = adscexe.AdexGrupo, mensaje = response.Message }));
            }
            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());
            }
        }