Example #1
0
    // Guarda el soporte bancario creado por el formulario uno a uno
    protected void btnGuardar_Click(object sender, EventArgs e)
    {
        string usuario       = Session["Usuario"].ToString();
        int    identificador = 0;
        int    pagaduria     = 0;
        string NoCheque      = "No tiene";
        int    talon         = 0;
        string sucursal      = "No tiene";

        if (ddlPagaduriaUno.Text != "")
        {
            pagaduria = int.Parse(ddlPagaduriaUno.Text);
        }

        if (txtNoTalon.Text != "")
        {
            talon = int.Parse(txtNoTalon.Text);
        }

        if (txtIdentificacion.Text != "")
        {
            identificador = int.Parse(txtIdentificacion.Text);
        }

        if (txtNoCheque.Text != "")
        {
            NoCheque = txtNoCheque.Text;
        }

        if (txtSucursal.Text != "")
        {
            sucursal = txtSucursal.Text;
        }

        if (ddlFormaDePago.Text != "" & ddlRecibido.Text != "" & ddlCompania.Text != "" & ddlBanco.Text != "" & ddlNoCuenta.Text != "" & txtFecha.Text != "" & txtValor.Text != "")
        {
            DataTable dtTipoCuenta = new DataTable();
            dtTipoCuenta = CuentasBancarias.ConsultarTipoCuentaBancaria(int.Parse(ddlNoCuenta.SelectedValue.ToString()));
            int tipoCuenta = int.Parse(dtTipoCuenta.Rows[0]["tipCue_Id"].ToString());

            int registros = AdministrarSoportesBancarios.InsertarSoporteBancarioUno(int.Parse(ddlTipoDoc.SelectedValue.ToString()), identificador, pagaduria, int.Parse(ddlFormaDePago.SelectedValue.ToString()),
                                                                                    NoCheque, int.Parse(ddlRecibido.SelectedValue.ToString()), int.Parse(ddlCompania.SelectedValue.ToString()), int.Parse(ddlBanco.SelectedValue.ToString()), tipoCuenta,
                                                                                    int.Parse(ddlNoCuenta.SelectedValue.ToString()), DateTime.Parse(txtFecha.Text), talon, int.Parse(txtValor.Text), sucursal, usuario);

            if (registros > 0)
            {
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + "Soporte Guardado." + "');window.location.replace('/gestion/recaudoypago/soportebancario')", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + "El soporte no fue guardado." + "'))", true);
            }
        }
        else
        {
            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Faltan campos por LLenar');", true);
        }
    }