private void Consultabutton_Click(object sender, EventArgs e) { Expression <Func <Departamento, bool> > filtro = x => true; switch (TipocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.DepartamentoId == id; if (BLL.DepartamentoBLL.Buscar(filtro).Count() == 0) { MessageBox.Show("Este ID, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Nombre if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar una Descripcion!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Nombre.Contains(CriteriotextBox.Text); if (BLL.DepartamentoBLL.Buscar(filtro).Count() == 0) { MessageBox.Show("Esta Descripcion, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 3: //Todo filtro = x => true; break; } ConsultadataGridView.DataSource = BLL.DepartamentoBLL.Buscar(filtro); CriteriotextBox.Clear(); TexterrorProvider.Clear(); }
private void Buscarbutton_Click(object sender, EventArgs e) { Expression <Func <Clientes, bool> > filtro = x => true; switch (FiltrocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.ClienteId == id; if (BLL.ClientesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este ID, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Direccion if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar una direccion!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Direccion.Contains(CriteriotextBox.Text); if (BLL.ClientesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Esta direccion, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 2: //Nombre if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar un nombre!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Nombre.Contains(CriteriotextBox.Text); if (BLL.ClientesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este nombre, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 3: //Devuelta if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal Devuelta = Convert.ToDecimal(CriteriotextBox.Text); filtro = x => x.Devuelta == Devuelta; if (BLL.ClientesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Esta devuelta, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 4: //Cedula if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar una cedula!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Cedula.Contains(CriteriotextBox.Text);; if (BLL.ClientesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Esta cedula, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 5: //telefono if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un telefono!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Telefono.Contains(CriteriotextBox.Text); if (BLL.ClientesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No existe telefono", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 6: //Todo filtro = x => true; break; } clientes = BLL.ClientesBLL.GetList(filtro); ClientesdataGridView.DataSource = clientes; CriteriotextBox.Clear(); errorProvider1.Clear(); }
private void Buscarbutton_Click(object sender, EventArgs e) { Expression <Func <Recibos, bool> > filtro = x => true; switch (FiltrocomboBox.SelectedIndex) { case 0: //ReciboId if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.ReciboId == id && (x.Fecha >= DesdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.ReciboId == id; } if (BLL.ReciboBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; } if (FiltrocomboBox.SelectedItem != null) { CobrosdataGridView.DataSource = BLL.ReciboBLL.GetList(filtro); if (FiltrocomboBox.SelectedIndex == 0) { foreach (var item in BLL.ReciboBLL.GetList(filtro)) { deudatextBox.Text = (BLL.CobroBLL.quincenas(item.Fecha, item.MontoTotal) - item.Abono).ToString(); AbonostextBox.Text = item.Abono.ToString(); DateTime FechaAct = fechaDateTimePicker.Value; DateTime FechaEmpeño = item.UltimaFechadeVigencia; if (FechaAct >= FechaEmpeño) { estadolabel.Text = "Vencido"; estadolabel.ForeColor = Color.Red; } else { estadolabel.Text = "Vigente"; estadolabel.ForeColor = Color.Green; } } } CriteriotextBox.Clear(); GeneralerrorProvider.Clear(); CobrosdataGridView.Columns["Detalle"].Visible = false; CobrosdataGridView.Columns["ActivodeNegocioId"].Visible = false; } }
//Busca una Entidad en la base de datos y la muestra //Comparando con cada uno de los casos del switch private void Buscarbutton_Click_1(object sender, EventArgs e) { //Inicializacion del filtro en True Expression <Func <Articulos, bool> > filtro = X => true; int id; switch (FiltrocomboBox.SelectedIndex) { case 0: //Todo ConsultardataGridView.DataSource = BLL.ArticuloBLL.GetList(filtro); // Muesta la lista completa de entidade que se encuentran en la //base de datos break; case 1: //ID if (Validar(1)) { MessageBox.Show("Por Favor Llene Casilla"); } else if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero"); } else { id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.ArticuloId == id; // aqui se busca una entidad por el id y lo lista if (BLL.ArticuloBLL.GetList(filtro).Count() == 0) { errorProvider.Clear(); MessageBox.Show("Este ID no Existe"); return; } else { errorProvider.Clear(); ConsultardataGridView.DataSource = BLL.ArticuloBLL.GetList(filtro); // aqui lo lista en el datagridview } } break; case 2: //Fecha if (Validar(1)) { MessageBox.Show("Por Favor Llene Casilla"); } else if (Validar(3)) { MessageBox.Show("Debe Digitar una Fecha"); } else { filtro = x => x.FechaVencimiento.Equals(CriteriotextBox.Text); if (BLL.ArticuloBLL.GetList(filtro).Count() == 0) // se busca una entidad por la fecha { errorProvider.Clear(); MessageBox.Show("Esta Fecha no Existe"); return; } else { errorProvider.Clear(); } ConsultardataGridView.DataSource = BLL.ArticuloBLL.GetList(filtro); } break; case 3: //Precio if (Validar(1)) { MessageBox.Show("Por Favor Llene Casilla"); } else if (Validar(2)) { MessageBox.Show("Debe Digitar un Precio"); } else { decimal p = Convert.ToDecimal(CriteriotextBox.Text); filtro = x => x.Precio == p; //se busca una entidad por el precio if (BLL.ArticuloBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este Precio No Existe"); return; } else { errorProvider.Clear(); } ConsultardataGridView.DataSource = BLL.ArticuloBLL.GetList(filtro); } break; } CriteriotextBox.Clear(); }
private void Buscarbutton_Click(object sender, EventArgs e) { switch (FiltrocomboBox.SelectedIndex) { case 0: //ReciboId if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.ReciboId == id; if (BLL.ReciboDetallesBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: // ArticuloId if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.ArticuloId == id; if (BLL.ReciboDetallesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 2: //NombreArticulo if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar un Nombre de Articulo!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { filtro = x => x.Articulo.Contains(CriteriotextBox.Text); if (BLL.ReciboDetallesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 3: //Descripcion if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar una Direccion!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Descripcion.Contains(CriteriotextBox.Text); if (BLL.ReciboDetallesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 4: // Cantidad if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int cantidad = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.Cantidad == cantidad; if (BLL.ReciboDetallesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 5: // Monto if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Monto!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal monto = Convert.ToDecimal(CriteriotextBox.Text); filtro = x => x.Monto == monto; if (BLL.ReciboDetallesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 6: //TODO filtro = x => true; if (BLL.ReciboDetallesBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Lista esta Vacia, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } break; } if (FiltrocomboBox.SelectedItem != null) { RecibodataGridView.DataSource = BLL.ReciboDetallesBLL.GetList(filtro); CriteriotextBox.Clear(); GeneralerrorProvider.Clear(); RecibodataGridView.Columns["articulos"].Visible = false; RecibodataGridView.Columns["ID"].Visible = false; } }
private void Buscarbutton_Click(object sender, EventArgs e) { switch (FiltrocomboBox.SelectedIndex) { case 0: //ReciboId if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.ReciboId == id && (x.Fecha >= desdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.ReciboId == id; } if (BLL.ReciboBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: // ClienteId if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.ClienteId == id && (x.Fecha >= desdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.ClienteId == id; } if (BLL.ReciboBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 2: //NombredeCliente if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar un Nombre!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (FechacheckBox.Checked == true) { filtro = x => x.NombredeCliente.Contains(CriteriotextBox.Text) && (x.Fecha >= desdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.NombredeCliente.Contains(CriteriotextBox.Text); } if (BLL.ReciboBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 3: // Monto if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Monto!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { decimal monto = Convert.ToDecimal(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.MontoTotal == monto && (x.Fecha >= desdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.MontoTotal == monto; } if (BLL.ReciboBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 4: //TODO filtro = x => true; if (BLL.ReciboBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Lista esta Vacia, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } break; } if (FiltrocomboBox.SelectedItem != null) { RecibodataGridView.DataSource = BLL.ReciboBLL.GetList(filtro); // RecibodataGridView.Columns.Add("estado", "Estado"); CriteriotextBox.Clear(); GeneralerrorProvider.Clear(); RecibodataGridView.Columns["ActivodeNegocioId"].Visible = false; RecibodataGridView.Columns["Detalle"].Visible = false; } }
private void Buscarbutton_Click(object sender, EventArgs e) { Expression <Func <Talleres, bool> > filtro = x => true; switch (FiltrocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("llenar campo ", "fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Digite un numero!", "fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.TallerId == id; if (BLL.TalleresBLL.GetList(filtro).Count() == 0) { MessageBox.Show("no existe ese Id", "favor revisar", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Nombre if (Validar(1)) { MessageBox.Show(" Llenar campo ", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Digite un nombre!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Nombre.Contains(CriteriotextBox.Text); if (BLL.TalleresBLL.GetList(filtro).Count() == 0) { MessageBox.Show("no hay ese nombre", "favor revisar", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; } ConsultadataGridView.DataSource = BLL.TalleresBLL.GetList(filtro); CriteriotextBox.Clear(); errorProvider1.Clear(); }
private void Buscarbutton_Click(object sender, EventArgs e) { Expression <Func <Usuarios, bool> > filtro = x => true; switch (FiltrocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.UsuarioId == id; if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este ID, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Nombre if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar un nombre!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Nombre.Contains(CriteriotextBox.Text); if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este nombre, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 2: //NombreUsuario if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar un nombre de usuario!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.NombreUsuario.Contains(CriteriotextBox.Text); if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este nombre de usurio, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 3: //Contrasena if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un contrasena!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Contrasena.Contains(CriteriotextBox.Text); if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este contrasena, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 4: //Todo filtro = x => true; break; } usuarios = BLL.UsuariosBLL.GetList(filtro); UsuariosdataGridView.DataSource = usuarios; CriteriotextBox.Clear(); errorProvider1.Clear(); }
private void Buscarbutton_Click(object sender, EventArgs e) { var listado = new List <Cliente>(); if (CriteriotextBox.Text.Trim().Length > 0) { switch (FiltrocomboBox.SelectedIndex) { case 0: //Id { int id = Convert.ToInt32(CriteriotextBox.Text); listado = repositoryBase.GetList(p => p.IDCliente == id); if (repositoryBase.GetList(filtro).Count() == 0) { MessageBox.Show("Este Articulo no Exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } break; } case 1: //nombre { listado = repositoryBase.GetList(p => p.Nombre.Contains(CriteriotextBox.Text)); if (repositoryBase.GetList(filtro).Count() == 0) { MessageBox.Show("Nombre no exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } break; } case 2: //Cedula { listado = repositoryBase.GetList(p => p.Cedula.Contains(CriteriotextBox.Text)); if (repositoryBase.GetList(filtro).Count() == 0) { MessageBox.Show("Cedula no exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } break; } case 3: //Direccion { listado = repositoryBase.GetList(p => p.Direccion.Contains(CriteriotextBox.Text)); if (repositoryBase.GetList(filtro).Count() == 0) { MessageBox.Show("Direccion no exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } break; case 4: //Telefono { listado = repositoryBase.GetList(p => p.Telefono.Contains(CriteriotextBox.Text)); if (repositoryBase.GetList(filtro).Count() == 0) { MessageBox.Show("Telefono no exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } break; case 5: //Telefono 2 { listado = repositoryBase.GetList(p => p.Telefono2.Contains(CriteriotextBox.Text)); if (repositoryBase.GetList(filtro).Count() == 0) { MessageBox.Show("Telefono 2 no exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } break; case 7: //todo filtro = x => true; break; } } else { listado = repositoryBase.GetList(p => true); } dataGridView1.DataSource = null; dataGridView1.DataSource = listado; CriteriotextBox.Clear(); // errorProvider1.Clear(); }
private void Buscarbutton_Click(object sender, EventArgs e) { RepositoryBase <Cliente> repository = new RepositoryBase <Cliente>(); var listado = new List <Cliente>(); if (CriteriotextBox.Text.Trim().Length >= 0) { switch (FiltrocomboBox.SelectedIndex) { case 0: //Todo listado = repository.GetList(filtro); break; case 1: //Id { int id = Convert.ToInt32(CriteriotextBox.Text); listado = repository.GetList(p => p.ClieteID == id); if (repository.GetList(filtro).Count() == 0) { MessageBox.Show("Este cliente no Exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } break; } case 2: //Nombre { listado = repository.GetList(p => p.Nombre.Contains(CriteriotextBox.Text)); if (repository.GetList(filtro).Count() == 0) { MessageBox.Show("Nombre no exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } break; } case 3: //Email { listado = repository.GetList(p => p.Email.Contains(CriteriotextBox.Text)); if (repository.GetList(filtro).Count() == 0) { MessageBox.Show("Email no exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } break; case 4: //Telefono { listado = repository.GetList(p => p.Telefono.Contains(CriteriotextBox.Text)); if (repository.GetList(filtro).Count() == 0) { MessageBox.Show("Telefono no exite", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } break; } } dataGridView1.DataSource = null; dataGridView1.DataSource = listado; CriteriotextBox.Clear(); cliente = listado; }
private void Buscarbutton_Click(object sender, EventArgs e) { var listado = new List <Asignaturas>(); RepositorioBase <Asignaturas> rb = new RepositorioBase <Asignaturas>(); try { if (CriteriotextBox.Text.Trim().Length > 0) { switch (FiltrocomboBox.Text) { case "Todos": listado = rb.GetList(A => true); break; case "Id": int id = Convert.ToInt32(CriteriotextBox.Text); listado = rb.GetList(p => p.AsignaturaId == id); break; case "Descripcion": listado = rb.GetList(A => A.Descripcion.Contains(CriteriotextBox.Text)); break; case "Creditos": decimal c = decimal.Parse(CriteriotextBox.Text); listado = rb.GetList(p => p.Creditos == c); break; } } else { MyErrorProvider.Clear(); if (FiltrocomboBox.Text == string.Empty) { MyErrorProvider.SetError(FiltrocomboBox, "El campo Filtro no puede estar vacio"); FiltrocomboBox.Focus(); } else if ((string)FiltrocomboBox.Text != "Todos") { if (CriteriotextBox.Text == string.Empty) { MyErrorProvider.SetError(CriteriotextBox, "El campo Criterio no puede estar vacio"); CriteriotextBox.Focus(); } } else { listado = rb.GetList(p => true); } } } catch (Exception) { } ConsultadataGridView.DataSource = null; ConsultadataGridView.DataSource = listado; }
private void Buscarbutton_Click(object sender, EventArgs e) { Expression <Func <LibrosBiblicos, bool> > filtro = x => true; switch (FiltrocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.LibroId == id && (DesdedateTimePicker.Value >= x.Fecha && HastadateTimePicker.Value <= x.Fecha); } else { filtro = x => x.LibroId == id; } if (BLL.LibrosBiblicosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este ID, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Descripcion if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar una Descripcion!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (FechacheckBox.Checked == true) { filtro = x => x.Descripcion.Contains(CriteriotextBox.Text) && (DesdedateTimePicker.Value >= x.Fecha && HastadateTimePicker.Value <= x.Fecha); } else { filtro = x => x.Descripcion.Contains(CriteriotextBox.Text); } if (BLL.LibrosBiblicosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Esta Descripcion, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 2: //Siglas if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar Caracteres!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (FechacheckBox.Checked == true) { filtro = x => x.Siglas.Equals(CriteriotextBox.Text) && (DesdedateTimePicker.Value >= x.Fecha && HastadateTimePicker.Value <= x.Fecha); } else { filtro = x => x.Siglas.Equals(CriteriotextBox.Text); } if (BLL.LibrosBiblicosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este Monto, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 3: //Tipo if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar Caracteres!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (FechacheckBox.Checked == true) { filtro = x => x.Tipo.Equals(CriteriotextBox.Text) && (DesdedateTimePicker.Value >= x.Fecha && HastadateTimePicker.Value <= x.Fecha); } else { filtro = x => x.Tipo.Equals(CriteriotextBox.Text); } if (BLL.LibrosBiblicosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este Monto, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 4: //TODO filtro = x => true; break; } ConsultadataGridView.DataSource = BLL.LibrosBiblicosBLL.GetList(filtro); CriteriotextBox.Clear(); GeneralerrorProvider.Clear(); }
private void Buscarbutton_Click(object sender, EventArgs e) { var listado = new List <Estudiantes>(); RepositorioBase <Estudiantes> rb = new RepositorioBase <Estudiantes>(); if (checkBox.Checked == true) { try { if (CriteriotextBox.Text.Trim().Length > 0) { switch (FiltrocomboBox.Text) { case "Todos": listado = rb.GetList(A => true); break; case "ID": int id = Convert.ToInt32(CriteriotextBox.Text); listado = rb.GetList(E => E.EstudianteId == id); break; case "Nombres": listado = rb.GetList(E => E.Nombres.Contains(CriteriotextBox.Text)); break; case "Balance": decimal balan = Convert.ToDecimal(CriteriotextBox.Text); listado = rb.GetList(E => E.Balance == balan); break; } listado = listado.Where(c => c.FechaIngresos.Date >= DesdedateTimePicker.Value.Date && c.FechaIngresos.Date <= HastadateTimePicker.Value.Date).ToList(); } else { MyErrorProvider.Clear(); if (FiltrocomboBox.Text == string.Empty) { MyErrorProvider.SetError(FiltrocomboBox, "El campo Filtro no puede estar vacio"); FiltrocomboBox.Focus(); } else if ((string)FiltrocomboBox.Text != "Todos") { if (CriteriotextBox.Text == string.Empty) { MyErrorProvider.SetError(CriteriotextBox, "El campo Criterio no puede estar vacio"); CriteriotextBox.Focus(); } } else { listado = rb.GetList(p => true); listado = listado.Where(c => c.FechaIngresos.Date >= DesdedateTimePicker.Value.Date && c.FechaIngresos.Date <= HastadateTimePicker.Value.Date).ToList(); } } ConsultadataGridView.DataSource = null; ConsultadataGridView.DataSource = listado; } catch (Exception) { MessageBox.Show("Introdujo un dato incorrecto"); } } else { try { if (CriteriotextBox.Text.Trim().Length > 0) { switch (FiltrocomboBox.Text) { case "Todo": listado = rb.GetList(p => true); break; case "Id": int id = Convert.ToInt32(CriteriotextBox.Text); listado = rb.GetList(p => p.EstudianteId == id); break; case "Nombre": listado = rb.GetList(p => p.Nombres.Contains(CriteriotextBox.Text)); break; case "Balance": decimal monto = Convert.ToInt32(CriteriotextBox.Text); listado = rb.GetList(p => p.Balance == monto); break; default: break; } } else { MyErrorProvider.Clear(); if (FiltrocomboBox.Text == string.Empty) { MyErrorProvider.SetError(FiltrocomboBox, "El campo Filtro no puede estar vacio"); FiltrocomboBox.Focus(); } else { if (FiltrocomboBox.Text.Equals("Todos")) { if (CriteriotextBox.Text == string.Empty) { MyErrorProvider.SetError(CriteriotextBox, "El campo Criterio no puede estar vacio"); CriteriotextBox.Focus(); } } { listado = rb.GetList(p => true); } ConsultadataGridView.DataSource = null; ConsultadataGridView.DataSource = listado; } } } catch (Exception) { MessageBox.Show("Introdujo un dato incorrecto"); } } }
private void Buscarbutton_Click(object sender, EventArgs e) { switch (FiltrocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.EntradadeActivosId == id && (x.Fecha >= DesdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.EntradadeActivosId == id; } if (BLL.EntradadeActivosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Motivo if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar Motivo!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (FechacheckBox.Checked == true) { filtro = x => x.Motivo.Contains(CriteriotextBox.Text) && (x.Fecha >= DesdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.Motivo.Contains(CriteriotextBox.Text); } if (BLL.EntradadeActivosBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 2: //Suma if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { decimal suma = Convert.ToDecimal(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.Suma == suma && (x.Fecha >= DesdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.Suma == suma; } if (BLL.EntradadeActivosBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 3: //Todo filtro = x => true; if (BLL.EntradadeActivosBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" Lista esta Vacia;", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } break; } if (FiltrocomboBox.SelectedItem != null) { EntradadataGridView.DataSource = BLL.EntradadeActivosBLL.GetList(filtro); CriteriotextBox.Clear(); GeneralerrorProvider.Clear(); EntradadataGridView.Columns["ActivodeNegocioId"].Visible = false; } }
private void Buscarbutton_Click(object sender, EventArgs e) { Expression <Func <RegistrodeArticulos, bool> > filtro = x => true; switch (FiltrocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.ArticulosId == id; if (BLL.RegistrodeArticulosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este ID, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Descripcion if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar una Descripcion!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Descripcion.Contains(CriteriotextBox.Text); if (BLL.RegistrodeArticulosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Esta Descripcion, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 2: //Costo if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal costo = Convert.ToDecimal(CriteriotextBox.Text); filtro = x => x.costo == costo; if (BLL.RegistrodeArticulosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este Monto, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 3: //Ganancia if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal Ganancia = Convert.ToDecimal(CriteriotextBox.Text); filtro = x => x.Ganancia == Ganancia; if (BLL.RegistrodeArticulosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este Monto, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 4: //precio if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal precio = Convert.ToDecimal(CriteriotextBox.Text); filtro = x => x.precio == precio; if (BLL.RegistrodeArticulosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este precio, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 5: //Inventario if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal Invetario = Convert.ToDecimal(CriteriotextBox.Text); filtro = x => x.Inventario == Invetario; if (BLL.RegistrodeArticulosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No hay Existencia", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 6: //Todo filtro = x => true; break; } ArticulosdataGridView.DataSource = BLL.RegistrodeArticulosBLL.GetList(filtro); CriteriotextBox.Clear(); GeneralerrorProvider.Clear(); }
private void Buscarbutton_Click(object sender, EventArgs e) { Expression <Func <RegistrodeMantenimiento, bool> > filtro = x => true; switch (FiltrocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.MantenimientoId == id && (x.Fecha >= desdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.MantenimientoId == id; } if (BLL.RegistrodeMantenimientoBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //VehiculoId if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int vehiculoid = Convert.ToInt32(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.VehiculoId == vehiculoid && (x.Fecha >= desdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.VehiculoId == vehiculoid; } if (BLL.RegistrodeMantenimientoBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 2: //Subtotal if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal subtotal = Convert.ToDecimal(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.Subtotal == subtotal && (x.Fecha >= desdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.Subtotal == subtotal; } if (BLL.RegistrodeMantenimientoBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 3: //Itbis if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal itbis = Convert.ToDecimal(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.itbis == itbis && (x.Fecha >= desdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.itbis == itbis; } if (BLL.RegistrodeMantenimientoBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 4: //Total if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal total = Convert.ToDecimal(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.Total == total && (x.Fecha >= desdedateTimePicker.Value.Date && x.Fecha <= HastadateTimePicker.Value.Date); } else { filtro = x => x.Total == total; } if (BLL.RegistrodeMantenimientoBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 5: filtro = x => true; break; } MantenimientodataGridView.DataSource = BLL.RegistrodeMantenimientoBLL.GetList(filtro); MantenimientodataGridView.Columns["Detalle"].Visible = false; CriteriotextBox.Clear(); GeneralerrorProvider.Clear(); }
private void Buscarbutton_Click(object sender, EventArgs e) { switch (FiltrocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.UsuariosId == id; if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este ID, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Nombre if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar un Nombre!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { filtro = x => x.Nombre.Contains(CriteriotextBox.Text); if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este Nombre, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 2: //Usuario if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar la Cedula con sus Guiones!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { filtro = x => x.Usuario.Equals(CriteriotextBox.Text); if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Esta Cedula, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 3: //Contraseña if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar el telefono con sus Guiones!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { filtro = x => x.Contraseña.Equals(CriteriotextBox.Text); if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este Telefono, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 4: //TipodeUsuario if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar una Direccion!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { filtro = x => x.Tipodeusuario.Equals(CriteriotextBox.Text); if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Esta Direccion, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 5: //TODO filtro = x => true; if (BLL.UsuariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Lista esta Vacia, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } break; } if (FiltrocomboBox.SelectedItem != null) { UsuariodataGridView.DataSource = BLL.UsuariosBLL.GetList(filtro); CriteriotextBox.Clear(); GeneralerrorProvider.Clear(); } }
private void Consultabutton_Click(object sender, EventArgs e) { switch (TipocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); filtro = x => x.UsuariosId == id; if (UsusariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este ID, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Nombre if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("Debe Digitar un Nombre!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Nombre.Contains(CriteriotextBox.Text); if (UsusariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Este Nombre, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 2: //Usuario if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(3)) { MessageBox.Show("!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { filtro = x => x.Usuario.Equals(CriteriotextBox.Text); if (UsusariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 3: //TODO filtro = x => true; if (UsusariosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("Lista esta Vacia, No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } break; } if (TipocomboBox.SelectedItem != null) { ConsultadataGridView.DataSource = BLL.UsusariosBLL.GetList(filtro); CriteriotextBox.Clear(); UsuarioerrorProvider.Clear(); } ListaUsuarios = UsusariosBLL.GetList(filtro); ConsultadataGridView.DataSource = ListaUsuarios; }
private void Consultabutton_Click(object sender, EventArgs e) { if (SetError(4)) { MessageBox.Show("Debe introducir porque filtro va a consultar", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error); } Expression <Func <Cliente, bool> > filtrar = x => true; List <Cliente> listaCliente = new List <Cliente>(); switch (FiltrarcomboBox.SelectedIndex) { case 0: filtrar = x => true; break; case 1: int.TryParse(CriteriotextBox.Text, out int id); filtrar = x => x.ClienteID == id; break; case 2: string Nombre = CriteriotextBox.Text; filtrar = x => x.NombreCliente.Contains(Nombre); break; } /* * switch (FiltrarcomboBox.SelectedIndex) * { * * case 0://ClienteID * * if (Validar(1)) * { * MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); * return; * } * if (Validar(2)) * { * MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); * return; * } * else * { * if (BLL.ClienteBLL.GetList(filtrar).Count() == 0) * { * MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); * return; * } * } * break; * }*/ /*if (FiltrarcomboBox.SelectedItem != null) * { */ listaCliente = ClienteBLL.GetList(filtrar).Where(x => x.Total > 0).ToList(); ConsultadataGridView.DataSource = listaCliente; /*if (FiltrarcomboBox.SelectedIndex == 0) * {*/ foreach (var item in listaCliente) { DeudanumericUpDown.Value = item.Total - AbonadonumericUpDown.Value; AbonadonumericUpDown.Text = item.Total.ToString(); } //} CriteriotextBox.Clear(); ClienteerrorProvider.Clear(); //ConsultadataGridView.Columns["InversionID"].Visible = false; //} }
private void Buscarbutton_Click(object sender, EventArgs e) { Expression <Func <Facturas, bool> > filtro = x => true; switch (FiltrocomboBox.SelectedIndex) { case 0: //Id if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.FacturaId == id && (desdedateTimePicker.Value >= x.Fecha && HastadateTimePicker.Value <= x.Fecha); } else { filtro = x => x.FacturaId == id; } if (BLL.FacturasBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //Clienteid if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int clienteId = Convert.ToInt32(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.ClienteId == clienteId && (desdedateTimePicker.Value >= x.Fecha && HastadateTimePicker.Value <= x.Fecha); } else { filtro = x => x.ClienteId == clienteId; } if (BLL.FacturasBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 2: //Subtotal if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal subtotal = Convert.ToDecimal(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.SubTotal == subtotal && (desdedateTimePicker.Value >= x.Fecha && HastadateTimePicker.Value <= x.Fecha); } else { filtro = x => x.SubTotal == subtotal; } if (BLL.FacturasBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 3: //ITBIS if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal itbis = Convert.ToDecimal(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.ITBIS == itbis && (desdedateTimePicker.Value >= x.Fecha && HastadateTimePicker.Value <= x.Fecha); } else { filtro = x => x.ITBIS == itbis; } if (BLL.FacturasBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 4: //Total if (Validar(1)) { MessageBox.Show("Favor Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Debe Digitar un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { decimal total = Convert.ToDecimal(CriteriotextBox.Text); if (FechacheckBox.Checked == true) { filtro = x => x.Total == total && (desdedateTimePicker.Value >= x.Fecha && HastadateTimePicker.Value <= x.Fecha); } else { filtro = x => x.Total == total; } if (BLL.FacturasBLL.GetList(filtro).Count() == 0) { MessageBox.Show(" No Existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 5: //todo filtro = x => true; break; } facturas = BLL.FacturasBLL.GetList(filtro); FacturasdataGridView.DataSource = facturas; CriteriotextBox.Clear(); errorProvider1.Clear(); }