private void buttonGuardar_Click(object sender, EventArgs e) { if (UtilidadesFormularios.Validar(new List <TextBox>() { textBoxLugar }, null, new List <ComboBox>() { comboBoxDias })) { int id = 0; int.TryParse(maskedTextBoxId.Text, out id); Ruta ruta = new Ruta(id, textBoxLugar.Text, comboBoxDias.SelectedIndex); using (var db = new Repositorio <Ruta>()) { if (RutasBLL.Guardar(ruta)) { LlenarFormulario(RutasBLL.rutaReturned); } } } else { toolStripLabelHaciendo.Text = "Datos incorrectos"; } }
private void buttonEliminar_Click(object sender, EventArgs e) { if (UtilidadesFormularios.Validar(maskedTextBoxId)) { if (RutasBLL.Eliminar(new Ruta(int.Parse(maskedTextBoxId.Text), textBoxLugar.Text, comboBoxDias.SelectedIndex))) { toolStripLabelHaciendo.Text = "Ruta eliminada!"; UtilidadesFormularios.Limpiar(new List <TextBox> { textBoxLugar }, new List <MaskedTextBox> { maskedTextBoxId }, new List <ComboBox> { comboBoxDias }); } else { toolStripLabelHaciendo.Text = "Esta ruta no existe!"; } } else { toolStripLabelHaciendo.Text = "Datos incorrectos"; } }
private void ConsultrarCliente_Load(object sender, EventArgs e) { checkBoxNombre.Checked = false; toolStripTextBoxSearch.Enabled = false; RutasBLL.GetList(x => x.RutaId > 0, false); comboBox1.DataSource = RutasBLL.rutaReturnedList; comboBox1.DisplayMember = "Lugar"; comboBox1.ValueMember = "RutaId"; }
private void RegistrarCliente_Load(object sender, EventArgs e) { maskedTextBoxId.Focus(); toolTip.SetToolTip(buttonBuscar, "Haga click para buscar un cliente."); toolTip.SetToolTip(buttonNuevo, "Haga click para limpiar datos y crear un nuevo cliente."); toolTip.SetToolTip(buttonGuardar, "Haga click para guardar un cliente."); toolTip.SetToolTip(buttonEliminar, "Haga click para eliminar un cliente."); RutasBLL.GetList(x => x.RutaId > 0, false); comboBoxRutas.DataSource = RutasBLL.rutaReturnedList; comboBoxRutas.DisplayMember = "Lugar"; comboBoxRutas.ValueMember = "RutaId"; }
public static IEnumerable <CIUDADES> GetAllId(this RutasBLL r, WInteger id) { try { using (db = new PasajesBDEntities()) { return((from t in db.CIUDADES where !t.IdCiudad.Equals(id.Value) select t).ToList()); } } catch (Exception) { throw; } }
private void buttonBuscar_Click(object sender, EventArgs e) { dataGridView1.Rows.Clear(); dataGridView1.Refresh(); int rutaId = Convert.ToInt32(comboBoxRutas.SelectedValue); RutasBLL.Buscar(x => x.RutaId == rutaId, true); foreach (var cliente in RutasBLL.rutaReturned.Clientes) { DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone(); row.Cells[0].Value = cliente.Nombres; row.Cells[1].Value = cliente.Direccion; dataGridView1.Rows.Add(row); } }
private void buttonBuscar_Click(object sender, EventArgs e) { if (UtilidadesFormularios.Validar(maskedTextBoxId)) { int id = int.Parse(maskedTextBoxId.Text); if (RutasBLL.Buscar(x => x.RutaId == id, false)) { LlenarFormulario(RutasBLL.rutaReturned); } else { toolStripLabelHaciendo.Text = "Esta ruta no existe"; } } else { toolStripLabelHaciendo.Text = "Datos incorrectos"; } }