Exemplo n.º 1
0
    protected void ddlCompania_SelectedIndexChanged(object sender, EventArgs e)
    {
        int cargo     = int.Parse(Session["car_Id"].ToString());
        int formaPago = int.Parse(Session["formaPago"].ToString());

        Session["companiaId"]   = ddlCompania.SelectedValue.ToString();
        Session["companiaEdit"] = ddlCompaniaEdit.SelectedValue.ToString();

        int intCompania = (Session["companiaId"].ToString() == "") ? 0 : int.Parse(Session["companiaId"].ToString());

        int tipoBanco = 1;

        if (intCompania == 5)
        {
            tipoBanco = 0;
        }
        DataTable dtBancos = new DataTable();

        dtBancos = AdministrarSoportesBancarios.ConsultarBancosSoporteBancario(intCompania, tipoBanco, formaPago);

        ddlBanco.DataTextField  = "ban_Nombre";
        ddlBanco.DataValueField = "ban_Id";
        ddlBanco.DataSource     = dtBancos;
        ddlBanco.DataBind();
        ddlBanco.Items.Insert(0, new ListItem("Seleccione banco", ""));

        int companiaEdit = (Session["companiaEdit"].ToString() == "") ? 0 : int.Parse(Session["companiaEdit"].ToString());

        DataTable dtBancosEdit = new DataTable();

        dtBancosEdit = CuentasBancarias.ConsultarBancosPorCompania(companiaEdit, 1);

        ddlBancoEdit.DataTextField  = "ban_Nombre";
        ddlBancoEdit.DataValueField = "ban_Id";
        ddlBancoEdit.DataSource     = dtBancosEdit;
        ddlBancoEdit.DataBind();
        ddlBancoEdit.Items.Insert(0, new ListItem("Seleccione banco", ""));

        if (intCompania != 1)
        {
            txtNoTalon.Enabled = false;
        }
        else
        {
            txtNoTalon.Enabled = true;
        }
    }