private void ValidaPersona(String NamePersona)
        {
            if (NamePersona.Trim().Length > 0)
            {
                var BL = new tb_t1_vendedorBL();
                var BE = new tb_t1_vendedor();

                var dt = new DataTable();
                BE.vendorid = idadmin.Text.ToString().Trim();

                dt = BL.GetAll(EmpresaID, BE).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    idadmin.Text = dt.Rows[0]["vendorid"].ToString().Trim();
                    nameadmin.Text = dt.Rows[0]["vendorname"].ToString().Trim();
                }
                else
                {
                    idadmin.Text = string.Empty;
                    nameadmin.Text = string.Empty;
                }
            }
        }
        private void Insert()
        {
            try
            {
                if (U_Validacion())
                {
                    var BL = new tb_t1_vendedorBL();
                    var BE = new tb_t1_vendedor();

                    BE.ddnni = txtDni.Text.ToString();
                    BE.vendorname = txtnombres.Text;
                    BE.direcc = txtdireccion.Text;
                    BE.telefono = txttelefono.Text;
                    BE.local = txtccosto.Text;
                    BE.fechanac = Convert.ToDateTime(fnacimiento.Text);
                    BE.fechasig = Convert.ToDateTime(fIngreso.Text);
                    if (cbogenero.SelectedValue is DBNull)
                    {
                        BE.generoid = cbogenero.SelectedValue.ToString();
                    }
                    else
                    {
                        BE.generoid = "1";
                    }
                    BE.ccargoid = txtccargo.Text;
                    BE.status = "0";
                    BE.usuar = VariablesPublicas.Usuar.Trim();

                    if (BL.Insert(EmpresaID, BE))
                    {
                        MessageBox.Show("Datos Grabados Correctamente !!!", "ConfirmaciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        procesado = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void CargaDatos()
        {
            var BL = new tb_t1_vendedorBL();
            var BE = new tb_t1_vendedor();

            BE.vendorname = txtfiltronombre.Text;
            BE.ddnni = txtfiltronumdoc.Text;

            tablaVendedor = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0];

            Examinar.AutoGenerateColumns = false;
            Examinar.DataSource = tablaVendedor;
        }
 private void Delete()
 {
     try
     {
         if (lblvendorid.Text == string.Empty)
         {
             MessageBox.Show("Falta Codigo Vendedor !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         else
         {
             var BL = new tb_t1_vendedorBL();
             var BE = new tb_t1_vendedor();
             BE.vendorid = lblvendorid.Text;
             if (BL.Delete(EmpresaID, BE))
             {
                 MessageBox.Show("Datos Eliminado Correctamente !!!", "ConfirmaciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 NIVEL_FORMS();
                 form_bloqueado(false);
                 btnnuevo.Enabled = true;
                 CargaDatos();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void ValidaVendedor(String xvendedorid, Boolean retrn)
        {
            if (xvendedorid.Trim().Length > 0)
            {
                var BL = new tb_t1_vendedorBL();
                var BE = new tb_t1_vendedor();
                var dt = new DataTable();
                BE.vendorid = xvendedorid.Trim().PadLeft(4, '0');
                BE.local = local.ToString();

                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    vendperid.Text = dt.Rows[0]["vendorid"].ToString().Trim();
                    vendpername.Text = dt.Rows[0]["vendorname"].ToString().Trim();
                }
                else
                {
                    if (!retrn)
                    {
                        vendperid.Text = string.Empty;
                        vendpername.Text = string.Empty;
                        vendperid.Focus();
                    }
                }
            }
        }