protected void llenarGrid(string nombre, string cedula)
        {
            this.grw_clientes.DataBindings.Clear();
            grw_clientes.Columns.Clear();
            string    mensaje   = "";
            ClienteTR tran      = new ClienteTR();
            int       registros = (this.cmb_registros.Text != "TODOS") ? Convert.ToInt32(this.cmb_registros.Text) : -1;
            DataTable datos     = tran.consultarClientesSeleccion(ref mensaje, nombre, cedula, registros);

            if (datos != null)
            {
                this.grw_clientes.DataSource         = datos;
                this.grw_clientes.Columns[0].Visible = false;
                int ancho = this.grw_clientes.Width;
                this.grw_clientes.Columns[2].Width = Convert.ToInt16(ancho * 0.55);
                if (this.habilitarCodigoCliente)
                {
                    this.grw_clientes.Columns[3].Width = Convert.ToInt16(ancho * 0.35);
                    this.grw_clientes.Columns[4].Width = Convert.ToInt16(ancho * 0.10);
                }
                else
                {
                    this.grw_clientes.Columns[3].Width = Convert.ToInt16(ancho * 0.10);
                }
            }
            else
            {
                Mensaje.error(mensaje);
            }
        }
        protected void llenarGrid(string nombre, string cedula)
        {
            this.grw_clientes.DataBindings.Clear();
            grw_clientes.Columns.Clear();
            string    mensaje   = "";
            ClienteTR tran      = new ClienteTR();
            int       registros = (this.cmb_registros.Text != "TODOS") ? Convert.ToInt32(this.cmb_registros.Text) : -1;
            DataTable datos     = tran.consultarClientes(ref mensaje, nombre, cedula, registros);

            if (datos != null)
            {
                this.grw_clientes.DataSource         = datos;
                this.grw_clientes.Columns[0].Visible = false;
                int ancho = this.grw_clientes.Width - 20;
                this.grw_clientes.Columns[1].Width = Convert.ToInt16(ancho * 0.15);
                this.grw_clientes.Columns[2].Width = Convert.ToInt16(ancho * 0.30);
                this.grw_clientes.Columns[3].Width = Convert.ToInt16(ancho * 0.15);
                this.grw_clientes.Columns[4].Width = Convert.ToInt16(ancho * 0.37);

                DataGridViewButtonColumn bcol = new DataGridViewButtonColumn();
                bcol.Width      = 20;
                bcol.HeaderText = "";
                bcol.Name       = "botonEditar";
                bcol.UseColumnTextForButtonValue = true;
                //grw_empleado.Columns.Insert(5, bcol);
                this.grw_clientes.Columns.Add(bcol);
            }
            else
            {
                Mensaje.error(mensaje);
            }
        }
Beispiel #3
0
        private void guardar()
        {
            if (!validar())
            {
                return;
            }
            Persona persona = new Persona();

            persona.id     = this.idCliente;
            persona.cedula = this.txt_cedula.Text.Trim();
            persona.ruc    = this.txt_ruc.Text.Trim();
            persona.tipo   = this.cmb_tipo.SelectedValue.ToString();
            if (persona.tipo == "N" && String.IsNullOrEmpty(persona.cedula) && persona.ruc.Length == 13)
            {
                persona.cedula = persona.ruc.Substring(0, 10);
            }
            persona.razon_social  = txt_nombre.Text;
            persona.codigo        = this.txt_codigo.Text;
            persona.telefonos     = txt_telefono.Text;
            persona.email         = txt_email.Text;
            persona.direccion     = txt_direccion.Text;
            persona.es_cliente    = true;
            persona.es_extranjero = this.chk_extranjero.Checked;
            ClienteTR tran = new ClienteTR(persona);
            string    msn  = "";

            if (estadoGuardar && tran.insertarCliente(ref msn)) //guardar
            {
                Mensaje.informacion("Cliente ingresado con éxito.");
                if (this.Owner.GetType() == typeof(frm_factura))
                {
                    pasarDatosFactura();
                }
                this.limpiar();
                txt_cedula.Focus();
            }
            else if (!estadoGuardar && tran.actualizarCliente(ref msn))
            {
                Mensaje.informacion("Cliente actualizado con éxito.");
                if (this.fila != null)
                {
                    pasarDatos();
                }
                this.limpiar();
                txt_cedula.Focus();
            }
            else
            {
                Mensaje.advertencia(msn);
            }
        }
Beispiel #4
0
        private void buscarCliente(int idCliente)
        {
            this.cliente = ClienteTR.buscarXId(idCliente);

            if (cliente.bloqueado)
            {
                Mensaje.informacion("La persona seleccionada posee documentos vencidos no se podrá emitir una guía de remisión a este nombre");
                this.borrarDatosCliente();
                return;

                this.limpiar();
            }
            this.txt_cedulaDestinatario.Text    = String.IsNullOrEmpty(this.cliente.cedula) ? this.cliente.ruc : this.cliente.cedula;
            this.txt_nombreDestinatario.Text    = this.cliente.razon_social;
            this.txt_direccionDestinatario.Text = this.cliente.direccion;
            Console.WriteLine(cliente.bloqueado);
            this.txt_direccionDestinatario.Focus();
        }
Beispiel #5
0
 public void buscarCliente(string cedula)
 {
     try
     {
         Persona persona = ClienteTR.buscarXCedula(cedula);
         if (persona != null)
         {
             llenarCampos(persona);
             this.idCliente = persona.id;
             activarEstadoActualizar();
         }
         else
         {
             Mensaje.advertencia("No se encontró el cliente.");
         }
     }
     catch (Exception e)
     {
         Mensaje.error(e.Message);
     }
 }