Ejemplo n.º 1
0
        protected void BtnGuardar_Click(object sender, EventArgs e)
        {
            if (TbIdCuenta.Text == string.Empty)
            {
                OtenerDatos();


                if (c.Insertar())
                {
                    Alert("Cuenta Se Guardo Corectamente");

                    Limpiar();
                }
                else
                {
                    Alert("Cuenta No Se Pudo Guardar Corectamente");
                }
            }

            else
            {
                OtenerDatos();

                if (c.Modificar(TbIdCuenta.Text))
                {
                    Alert("Cuenta Se Modificada Corectamente");
                }
                else
                {
                    Alert("Cuenta No Se  Modificar Corectamente");
                }
            }
        }
Ejemplo n.º 2
0
        protected void EnviarButton_Click(object sender, EventArgs e)
        {
            Boolean paso = false;

            if (DescripcionTextBox.Text.Trim().Length == 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Debe ingresar una descripcion.');", true);
            }
            if (BalanceTextBox.Text.Trim().Length == 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Debe ingresar un balance.');", true);
            }
            else
            {
                Cuenta.CuentaId    = Utilitarios.ToInt(IDCuentaTextBox.ToString());
                Cuenta.Descripcion = DescripcionTextBox.Text;
                Cuenta.Balance     = float.Parse(BalanceTextBox.Text);

                if (Cuenta.CuentaId > 0)
                {
                    //Editando
                    paso = Cuenta.Modificar();
                }
                else
                {
                    //Insertando
                    paso = Cuenta.Insertar();
                }
                if (paso)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Registrado Satisfactoriamente.');", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Ha habido un error.');", true);
                }
            }
        }