コード例 #1
0
        public ActionResult GuardarConstantes(string IdConstante, string TipoOperacion)
        {
            VerConstanteModelView model = null;

            try
            {
                if (IdConstante != null)
                {
                    if (TipoOperacion == "Guardar")
                    {
                        model = ConstLogic.VerConstantes_Guardar(Convert.ToInt16(IdConstante)).FirstOrDefault();
                    }
                    else if (TipoOperacion == "Editar")
                    {
                        model = ConstLogic.VerConstantes(Convert.ToInt16(IdConstante)).FirstOrDefault();
                    }
                }
                ViewBag.TipoOperacion = TipoOperacion;
                return(PartialView(model));
            }
            catch (Exception ex)
            {
                Mensaje mensaje = new Mensaje();
                mensaje.esError = true;
                mensaje.mensaje = ex.Message;
                return(PartialView("../Common/Mensaje", mensaje));
            }
        }
コード例 #2
0
 public string ActualizarConstanteHijo(VerConstanteModelView Const)
 {
     DTO.ModelCustoms.RespuestaWS respuesta = new DTO.ModelCustoms.RespuestaWS();
     if (!constanteBL.EditarConstante(Const).esError)
     {
         respuesta.codigo  = 200;
         respuesta.mensaje = "La operación fue realizada correctamente";
     }
     else
     {
         respuesta.codigo  = 500;
         respuesta.mensaje = "Ocurrió un error al realizar la operación";
     }
     return(JsonConvert.SerializeObject(respuesta, Newtonsoft.Json.Formatting.Indented));
 }
コード例 #3
0
        public ActionResult GuardarConstantes(string TipoOperacion, VerConstanteModelView Const)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(Const));
            }

            if (TipoOperacion == "Guardar")
            {
                return(PartialView("../Common/Mensaje", ConstLogic.CrearConstante(Const)));
            }
            else if (TipoOperacion == "Editar")
            {
                return(PartialView("../Common/Mensaje", ConstLogic.EditarConstante(Const)));
            }
            else
            {
                ModelState.AddModelError("", "Ocurrió un error desconocido");
                return(PartialView());
            }
        }
コード例 #4
0
        public Mensaje CrearConstante(VerConstanteModelView Const)
        {
            Mensaje mensaje = new Mensaje();

            try
            {
                using (DbContextTransaction Transaccion = context.Database.BeginTransaction())
                {
                    try
                    {
                        context.SP_I_Constante(
                            Const.IdPadre,
                            Const.Constante,
                            Const.Descripcion,
                            Const.CodigoAgrupador,
                            Const.Orden,
                            Const.Tag,
                            Const.IdEstado
                            );

                        context.SaveChanges();
                        Transaccion.Commit();
                        mensaje.esError = false;
                    }
                    catch (Exception ex)
                    {
                        Transaccion.Rollback();
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                mensaje.esError = true;
                mensaje.mensaje = ex.Message;
            }
            return(mensaje);
        }
コード例 #5
0
        public Mensaje EditarConstante(VerConstanteModelView Const)
        {
            Mensaje mensaje = new Mensaje();

            try
            {
                context.SP_U_Constante(
                    Const.IdConstante,
                    Const.Constante,
                    Const.Descripcion,
                    Const.Orden,
                    Const.Tag,
                    Const.IdEstado);
                mensaje.esError = false;
            }
            catch (Exception ex)
            {
                mensaje.esError = true;
                mensaje.mensaje = ex.Message;
            }

            return(mensaje);
        }