Exemplo n.º 1
0
        protected async void btnModificar_Click(object sender, EventArgs e)
        {
            if (ValidarModificar())
            {
                Models.Combustible combustibleModificado = new Models.Combustible();
                Models.Combustible combustible           = new Models.Combustible()
                {
                    COMB_CODIGO = Int32.Parse(TextBox_codigo.Text),
                    COMB_TIPO   = TextBox_combustible.Text
                };

                combustibleModificado =
                    await combustibleManager.Actualizar(combustible, VG.usuarioActual.CadenaToken);

                if (combustibleModificado != null)
                {
                    MensajeEstado("Registro modificado con exito", false, true);
                    InicializarControles();
                }
                else
                {
                    MensajeEstado("Hubo un error al intentar modificar el registro", false, true);
                }
            }
        }
Exemplo n.º 2
0
        protected async void btnAgregar_Click(object sender, EventArgs e)
        {
            if (ValidarInsertar())
            {
                Models.Combustible combustibleIngresado = new Models.Combustible();
                Models.Combustible combustible          = new Models.Combustible()
                {
                    COMB_TIPO = TextBox_combustible.Text,
                };

                combustibleIngresado =
                    await combustibleManager.Ingresar(combustible, VG.usuarioActual.CadenaToken);

                if (combustibleIngresado != null)
                {
                    MensajeEstado("Registro guardado con exito", false, true);
                    InicializarControles();
                }
                else
                {
                    MensajeEstado("Ha habido un error al guardar el registro", true, true);
                }
            }
        }