private void btnConsultar_Click(object sender, EventArgs e) { String condiciones = ""; if (!chkCliente.Checked) { if (txtDoc.Text != string.Empty) { condiciones += "AND nroDoc=" + "'" + (txtDoc.Text).ToString() + "'"; } if (txtApellido.Text != string.Empty) { condiciones += "AND apellido=" + "'" + txtApellido.Text + "'"; } if (condiciones != "") { grdClientes.DataSource = oClienteService.ConsultarClientes(condiciones); } else { MessageBox.Show("Debe ingresar al menos un criterio", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { grdClientes.DataSource = oClienteService.ConsultarClientes(condiciones); } }
//Es el button Consultar private void Button1_Click(object sender, EventArgs e) { string strCondiciones = ""; if (!chkTodos.Checked) { bool nomOk = false; bool dniOk = false; bool apOk = false; if (!String.IsNullOrEmpty(txtDNI.Text.ToString())) { dniOk = true; strCondiciones += "AND C.dni =" + "'" + txtDNI.Text.ToString() + "'"; } if (!String.IsNullOrEmpty(txtNombre.Text)) { nomOk = true; strCondiciones += "AND C.nombre =" + "'" + txtNombre.Text + "'"; } if (!String.IsNullOrEmpty(txtApellido.Text)) { apOk = true; strCondiciones += "AND C.apellido =" + "'" + txtApellido.Text + "'"; } if (nomOk || apOk || dniOk) { IList <Cliente> listaC = clienteService.ConsultarClientes(strCondiciones); if (listaC.Count > 0) { this.dataGridClientes.DataSource = listaC; } else { MessageBox.Show("No se encontró ningún cliente.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("No se ingresó ningún criterio de búsqueda", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { this.CargarGrilla(); } }
private void filtroCombo_SelectedIndexChanged(object sender, EventArgs e) { if (filtroCombo.SelectedIndex == 0) { DtgClientes.Rows.Clear(); foreach (var item in clienteservice.ConsultarClientes()) { DtgClientes.Rows.Add(item.Cedula, item.PrimerNombre, item.SegundoNombre, item.PrimerApellido, item.SegundoApellido, item.Genero, item.Celular, item.Direccion, item.Email); } } if (filtroCombo.SelectedIndex == 1) { DtgClientes.Rows.Clear(); foreach (var item in clienteservice.ClientesGenero('F')) { DtgClientes.Rows.Add(item.Cedula, item.PrimerNombre, item.SegundoNombre, item.PrimerApellido, item.SegundoApellido, item.Genero, item.Celular, item.Direccion, item.Email); } } if (filtroCombo.SelectedIndex == 2) { DtgClientes.Rows.Clear(); foreach (var item in clienteservice.ClientesGenero('M')) { DtgClientes.Rows.Add(item.Cedula, item.PrimerNombre, item.SegundoNombre, item.PrimerApellido, item.SegundoApellido, item.Genero, item.Celular, item.Direccion, item.Email); } } }
public void PintarTabla() { DtgClientes.Rows.Clear(); foreach (var item in clienteService.ConsultarClientes()) { DtgClientes.Rows.Add(item.Cedula, item.PrimerNombre, item.SegundoNombre, item.PrimerApellido, item.SegundoApellido, item.Genero, item.Celular, item.Direccion, item.Email); } }
private bool ValidarDNICliente() { string strSql = "AND C.dni = " + this.txtDNI.Text; if (clienteService.ConsultarClientes(strSql).Count > 0) { return(false); } return(true); }
private void MapearDtgTodos(DataGridView Dtg) { ClienteService = new ClienteService(ConfigConnection.ConnectionString); DtgClientes.Rows.Clear(); foreach (var item in ClienteService.ConsultarClientes()) { int n = DtgClientes.Rows.Add(); Dtg.Rows[n].Cells[0].Value = item.Cedula; Dtg.Rows[n].Cells[1].Value = item.PrimerNombre; Dtg.Rows[n].Cells[2].Value = item.SegundoNombre; Dtg.Rows[n].Cells[3].Value = item.PrimerApellido; Dtg.Rows[n].Cells[4].Value = item.SegundoApellido; Dtg.Rows[n].Cells[5].Value = item.Correo; Dtg.Rows[n].Cells[6].Value = item.Telefono; Dtg.Rows[n].Cells[7].Value = item.Direccion; Dtg.Rows[n].Cells[8].Value = item.Lugar.Ciudad; Dtg.Rows[n].Cells[9].Value = item.Barrio; } TxtTotal.Text = ClienteService.ConsultarClientes().Count.ToString(); }
public FormListaClientes() { InitializeComponent(); DtgClientes.DataSource = null; DtgClientes.DataSource = clienteservice.ConsultarClientes(); }
public FormGestionPagos() { InitializeComponent(); DtgClientes.DataSource = clienteService.ConsultarClientes(); }