private void data_gridVendedor()
    {
        tb_cxc_vendorBL BL = new tb_cxc_vendorBL();
        tb_cxc_vendor BE = new tb_cxc_vendor();

        switch (cbo_filtro.SelectedValue)
        {
            case "01":
                BE.vendorid = txt_filter.Text.Trim().ToUpper();
                break;
            case "02":
                BE.ddnni = txt_filter.Text.Trim().ToUpper();
                break;
            case "03":
                BE.vendorname = txt_filter.Text.Trim().ToUpper();
                break;
            default:
                //**
                break;
        }
        try
        {
            //Eliminar Columnas Actuales(Opcional):
            GridView1.Columns.Clear();
            GridView1.Width = 550;
            //Objeto Columna:
            CommandField image;
            //Crear Columna:
            image = new CommandField();
            image.ButtonType = ButtonType.Image;
            image.SelectImageUrl = "~/Images/go-search.png";
            image.ShowSelectButton = true;
            image.ItemStyle.Width = 10;
            image.ItemStyle.Wrap = true;
            GridView1.Columns.Add(image);

            BoundField DDNNI;
            DDNNI = new BoundField();
            DDNNI.DataField = "vendorid";
            DDNNI.HeaderText = "CODIGO";
            DDNNI.ItemStyle.Width = 80;
            GridView1.Columns.Add(DDNNI);

            BoundField APPAT;
            APPAT = new BoundField();
            APPAT.DataField = "ddnni";
            APPAT.HeaderText = "DNI";
            APPAT.ItemStyle.Width = 80;
            GridView1.Columns.Add(APPAT);

            BoundField NOMBR;
            NOMBR = new BoundField();
            NOMBR.DataField = "vendorname";
            NOMBR.HeaderText = "NOMBRES";
            NOMBR.ItemStyle.Width = 250;
            GridView1.Columns.Add(NOMBR);

            GridView1.DataSource = BL.GetAll(Session["ssEmpresaID"].ToString(), BE);
            GridView1.DataBind();
            GridView1.Visible = true;
        }
        catch (Exception ex)
        {
            ClientMessage(ex.Message);
        }
    }
 // PINTAMOS EL VENDEDOR DE DICHA
 void Vendedor()
 {
     tb_cxc_vendorBL BL = new tb_cxc_vendorBL();
     tb_cxc_vendor BE = new tb_cxc_vendor();
     DataTable dt = new DataTable();
     BE.usuarweb = Session["ssUsuar"].ToString().Trim();
     dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         txt_vendorid.Text = dt.Rows[0]["vendorid"].ToString();
         txt_vendorname.Text = dt.Rows[0]["vendorname"].ToString();
     }
 }
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         switch (filtro)
         {
             case "PS":
                 tb_cxc_vendorBL PSBL = new tb_cxc_vendorBL();
                 tb_cxc_vendor PSBE = new tb_cxc_vendor();
                 DataTable PSDT = new DataTable();
                 PSBE.ddnni = GridView1.SelectedRow.Cells[2].Text;
                 PSDT = PSBL.GetAll(Session["ssEmpresaID"].ToString(), PSBE).Tables[0];
                 txt_vendorid.Text = PSDT.Rows[0]["vendorid"].ToString();
                 txt_vendorname.Text = PSDT.Rows[0]["vendorname"].ToString();
                 break;
             case "PR":
                  clienteBL BL = new clienteBL();
                  tb_cliente BE = new tb_cliente();
                  DataTable dt = new DataTable();
                  BE.ctacte = GridView1.SelectedRow.Cells[1].Text;
                  dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];
                  txt_ctacte.Text = dt.Rows[0]["ctacte"].ToString();
                  txt_ctactename.Text = dt.Rows[0]["ctactename"].ToString();
                  txt_ruc.Text = dt.Rows[0]["nmruc"].ToString();
                  direc_entrega.Text = dt.Rows[0]["direc"].ToString();
                  break;
             case "PA":
                  txt_articidold.Text = GridView1.SelectedRow.Cells[1].Text;
                  MetodoCargarLineal();
                  break;
         }
         UpdatePanel2.Update();
         ModalPopupExtender2.Hide();
     }
     catch (Exception ex)
     {
         ClientMessage(ex.Message);
     }
 }
        private void data_TablaVendedor()
        {
            if (TablaVendedor.Rows.Count > 0)
            {
                TablaVendedor.Rows.Clear();
            }
            var BL = new tb_cxc_vendorBL();
            var BE = new tb_cxc_vendor();

            BE.parameters = txtbusqueda.Text.Trim().ToUpper();
            TablaVendedor = BL.GetAll(EmpresaID, BE).Tables[0];
            if (TablaVendedor.Rows.Count > 0)
            {
                btn_imprimir.Enabled = true;
                dgb_vendedores.DataSource = TablaVendedor;
                dgb_vendedores.Rows[0].Selected = false;
            }
        }
 // VERIFICO COMO ESTOY INGRESANDO ( COMO QUE USUARIO ESTOY INGRESANDO )
 void ValIngreso()
 {
     String xusu = Session["ssUsuar"].ToString().Trim(); tb_cxc_vendorBL BL = new tb_cxc_vendorBL();
     tb_cxc_vendor BE = new tb_cxc_vendor();
     DataTable dt = new DataTable();
     BE.usuarweb = xusu;
     dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         //txt_vendorname.Text = dt.Rows[0]["vendorname"].ToString();
         Response.Redirect("~/Comercial/Listados/Lst_PedidosPend.aspx");
     }
     else
     {
         //txt_vendorname.Text = "VENDEDOR SIN PEDIDOS";
         Response.Redirect("");
     }
 }
    protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            filtro = "PA";
            switch (filtro)
            {
                case "PS":
                    tb_cxc_vendorBL PSBL = new tb_cxc_vendorBL();
                    tb_cxc_vendor PSBE = new tb_cxc_vendor();
                    DataTable PSDT = new DataTable();
                    PSBE.ddnni = GridView1.SelectedRow.Cells[2].Text;
                    PSDT = PSBL.GetAll(Session["ssEmpresaID"].ToString(), PSBE).Tables[0];
                    txt_vendorid.Text = PSDT.Rows[0]["vendorid"].ToString();
                    txt_vendorname.Text = PSDT.Rows[0]["vendorname"].ToString();
                    break;
                case "PR":
                    String xctacte = GridView2.SelectedRow.Cells[1].Text;
                    ValidaCliente(xctacte);
                    break;
                case "PA":
                    txt_articidold.Text = GridView2.SelectedRow.Cells[1].Text;
                    MetodoCargarLineal(txt_articidold.Text);
                    break;
            }

        }
        catch (Exception ex)
        {
            //ClientMessage(ex.Message);
            Response.Redirect("ErrorPage/Frm_PaginaError_405.aspx");
        }

        GridView2.SelectedRowStyle.CssClass = "SeRoSty alert-success";
    }
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         filtro = "PR";
         switch (filtro)
         {
             case "PS":
                 tb_cxc_vendorBL PSBL = new tb_cxc_vendorBL();
                 tb_cxc_vendor PSBE = new tb_cxc_vendor();
                 DataTable PSDT = new DataTable();
                 PSBE.ddnni = GridView1.SelectedRow.Cells[2].Text;
                 PSDT = PSBL.GetAll(Session["ssEmpresaID"].ToString(), PSBE).Tables[0];
                 txt_vendorid.Text = PSDT.Rows[0]["vendorid"].ToString();
                 txt_vendorname.Text = PSDT.Rows[0]["vendorname"].ToString();
                 break;
             case "PR":
                 String xctacte = GridView1.SelectedRow.Cells[1].Text;
                 ValidaCliente(xctacte);
                 break;
             case "PA":
                 txt_articidold.Text = GridView1.SelectedRow.Cells[1].Text;
                 MetodoCargarLineal("");
                 break;
         }
         //UpdatePanel2.Update();
         //ModalPopupExtender2.Hide();
         //data-dismiss="modal"
     }
     catch (Exception ex)
     {
         //ClientMessage(ex.Message);
         Response.Redirect("ErrorPage/Frm_PaginaError_405.aspx");
     }
 }