private void BuscarButtom_Click(object sender, EventArgs e) { ErrorProvider error = new ErrorProvider(); if (!string.IsNullOrWhiteSpace(IdtextBox.Text) && Convert.ToInt32(IdtextBox.Text) > 0) { BLL.Motores motor = new BLL.Motores(); if (motor.Buscar(Convert.ToInt32(IdtextBox.Text))) { IdtextBox.Enabled = false; int id = Convert.ToInt32(IdtextBox.Text); Util.Limpiar(this); Modificar = true; IdModificar = id; IdtextBox.AppendText(id.ToString()); FabricanteTextBox.AppendText(motor.Fabricante); ModeloTextBox.AppendText(motor.Modelo); ColorComboBox.SelectedValue = motor.IdColor; NumeroTextBox.AppendText(motor.NumeroChasis); AComboBox.SelectedValue = motor.AProduccion; PrecioTextBox.AppendText(motor.Precio.ToString()); } } else { Modificar = true; Util.Limpiar(this); Consultas.cMotores consulta = new Consultas.cMotores(); consulta.ShowDialog(this); BLL.Motores motor = consulta.ObtenerMotor(); if (motor.IdMotor > 0) { IdtextBox.Enabled = false; IdModificar = motor.IdMotor; IdtextBox.AppendText(motor.IdMotor.ToString()); FabricanteTextBox.AppendText(motor.Fabricante); ModeloTextBox.AppendText(motor.Modelo); ColorComboBox.SelectedValue = motor.IdColor; NumeroTextBox.AppendText(motor.NumeroChasis); AComboBox.SelectedIndex = AComboBox.Items.Count - (DateTime.Now.Year - motor.AProduccion + 1); PrecioTextBox.AppendText(motor.Precio.ToString()); } } }
public rMotores(int IdMotor) { InitializeComponent(); ColorComboBox.DataSource = BLL.Colores.Listar(); ColorComboBox.DisplayMember = "Color"; ColorComboBox.ValueMember = "IdColor"; for (int year = 1960; year <= DateTime.Now.Year; year++) { AComboBox.Items.Add(year); AComboBox.ValueMember = "year"; } BLL.Motores motor = new BLL.Motores(); if (motor.Buscar(IdMotor)) { Modificar = true; IdModificar = IdMotor; FabricanteTextBox.AppendText(motor.Fabricante); ModeloTextBox.AppendText(motor.Modelo); ColorComboBox.SelectedIndex = motor.IdColor; NumeroTextBox.AppendText(motor.NumeroChasis); AComboBox.SelectedItem = motor.AProduccion; PrecioTextBox.AppendText(motor.Precio.ToString()); } }
public Boolean validarCampos() { if (PlacaTextBox.Text == "Placa" || PlacaTextBox.Text == "") { PlacaTextBox.Focus(); return(false); } //-----Este campo no es obligatorio if (CorreoCorporativoTextBox.Text != "Correo Corporativo") { if (!IsValidEmail(CorreoCorporativoTextBox.Text)) { MessageBox.Show("El correo tiene un Formato email incorrecto"); return(false); } } //-----Este campo no es obligatorio //if (LanMessengerTextBox.Text == "Lan Messenger" || LanMessengerTextBox.Text == "") //{ // LanMessengerTextBox.Focus(); // return false; //} if (EstadoComboBox.Text == "- Seleccionar Estado -") { EstadoComboBox.Focus(); return(false); } if (SerialTextBox.Text == "Serial" || SerialTextBox.Text == "") { SerialTextBox.Focus(); return(false); } if (MarcaTextBox.Text == "Marca" || MarcaTextBox.Text == "") { MarcaTextBox.Focus(); return(false); } if (ModeloTextBox.Text == "Modelo" || ModeloTextBox.Text == "") { ModeloTextBox.Focus(); return(false); } if (NombreProveedortextBox.Text == "Nombre del Proveedor" || NombreProveedortextBox.Text == "") { NombreProveedortextBox.Focus(); return(false); } if (NitCompraTextbox.Text == "NIT" || NitCompraTextbox.Text == "") { NitCompraTextbox.Focus(); return(false); } if (ValorCompraTextBox.Text == "Valor de Compra" || ValorCompraTextBox.Text == "") { ValorCompraTextBox.Focus(); return(false); } return(true); //if (PlacaTextBox.Text == "Placa" || CorreoCorporativoTextBox.Text == "Correo Corporativo" || // LanMessengerTextBox.Text == "Lan Messenger" || EstadoComboBox.Text == "- Seleccionar Estado -" || // SerialTextBox.Text == "Serial" || MarcaTextBox.Text == "Marca" || // ModeloTextBox.Text == "Modelo" || NombreProveedortextBox.Text == "Nombre Proveedor") }