private void bunifuThinButton22_Click(object sender, EventArgs e) { if (newprecio.Text == "") { errorProvider1.SetError(newprecio, "Llene el campo Precio!"); } else if (newmodelo.Text == "") { errorProvider1.SetError(newmodelo, "Llene el campo Modelo!"); } else { Herencia_Vehiculos hv = new Herencia_Vehiculos(); hv.Id = Convert.ToInt32(newid.Text); hv.Precio = Convert.ToInt32(newprecio.Text); hv.Marca = newmarca.SelectedItem.ToString(); hv.Modelo = newmodelo.Text; hv.Tipo = newtipo.SelectedItem.ToString(); hv.Canidad = Convert.ToInt32(newcanti.Value); errorProvider1.Clear(); pv.modificarInfo(hv.Id, hv.Marca, hv.Modelo, hv.Tipo, hv.Precio, hv.Canidad); pv.mostrarInfo(modificarinfo); } newid.Text = ""; newprecio.Text = ""; newcanti.Value = 0; newmarca.SelectedIndex = -1; newtipo.SelectedIndex = -1; }
private void bunifuThinButton21_Click(object sender, EventArgs e) { if (id.Text == "") { errorProvider1.SetError(id, "Llene el campo ID! "); } else if (precio.Text == "") { errorProvider1.SetError(precio, "Llene el campo de Precio! "); } else if (bd.MostrarDatos("SELECT marca FROM vehiculo WHERE id = '" + marca.SelectedItem.ToString() + "'") == marca.SelectedItem.ToString()) { MessageBox.Show("Esa marca de Vehiculo ya Existe!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (bd.MostrarDatos("SELECT id FROM vehiculo WHERE id = '" + id.Text + "'") == id.Text) { MessageBox.Show("Ese identificador de Vehiculo ya Existe!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (bd.MostrarDatos("SELECT modelo FROM vehiculo WHERE id = '" + modelo.Text + "'") == modelo.Text) { MessageBox.Show("Ese modelo de Vehiculo ya Existe!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Herencia_Vehiculos hv = new Herencia_Vehiculos(); hv.Id = Convert.ToInt32(id.Text); hv.Precio = Convert.ToInt32(precio.Text); hv.Marca = marca.SelectedItem.ToString(); hv.Modelo = modelo.Text; hv.Tipo = tipo.SelectedItem.ToString(); hv.Canidad = Convert.ToInt32(canti.Value); errorProvider1.Clear(); pv.registrarVehiculo(hv.Id, hv.Marca, hv.Modelo, hv.Tipo, hv.Precio, hv.Canidad); } id.Text = ""; precio.Text = ""; marca.SelectedIndex = 0; tipo.SelectedIndex = 0; canti.Value = 0; }