private Boolean ValidarUnicidadCuil(Int64 cuit) { bool valido = true; string msg = string.Empty; List <long> listcuit = new List <long>(); List <Empleado> listempleados = _empls.TraerListadoPorEmpresa(ObtenerIdEmpresa()); foreach (Empleado e in listempleados) { listcuit.Add(e.Cuil); } if (listcuit.Any(x => x == cuit)) { msg = "El Cuil ya se encuentra ingresado."; } if (msg != string.Empty) { valido = false; MessageBox.Show(msg); } return(valido); }
private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e) { try { CargarListaEmpleados(_empls.TraerListadoPorEmpresa(ObtenerIdEmpresa())); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); listBox2.DataSource = null; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; textBox5.Enabled = false; comboBox2.Enabled = false; comboBox3.Enabled = false; } catch (Exception ex) { MessageBox.Show("Error.\n" + ex.Message); } listBox1.Enabled = true; }