private void BtnRegistrar_Click(object sender, EventArgs e) { marcaservice = new MarcaService(ConfigConnection.ConnectionString); productoservice = new ProductoService(ConfigConnection.ConnectionString); if (TxtCodigo.Text.Equals("") || TxtInstrumento.Text.Equals("") || TxtPrecio.Text.Equals("") || CmbMarca.Text.Equals("")) { MessageBox.Show("Complete los campos. "); } else { try { decimal precio = decimal.Parse(TxtPrecio.Text.Trim()); Producto producto = new Producto(); producto.Codigo = TxtCodigo.Text.Trim().ToUpper(); producto.Marca = marcaservice.FiltrarMarca(CmbMarca.Text); producto.Nombre = TxtInstrumento.Text.Trim().ToUpper(); producto.Precio = precio; MessageBox.Show(productoservice.GuardarProducto(producto)); Inventario.Actualizar(); UnlockInventario.unlockInventario(); this.Close(); } catch (FormatException ex) { MessageBox.Show("Error " + ex.Message.ToString()); } } }
private void BtnModificar_Click_1(object sender, EventArgs e) { if (TxtNombre.Text.Equals("")) { MessageBox.Show("Complete los campos. "); } else { marcaservice = new MarcaService(ConfigConnection.ConnectionString); Marca marca = marcaservice.BuscarMarca(TxtCodigo.Text); marca.Nombre = TxtNombre.Text.Trim().ToUpper(); MessageBox.Show(marcaservice.ModificarMarca(marca)); Inventario.Actualizar(); UnlockInventario.unlockInventario(); this.Close(); } }
private void BtnRegistrar_Click(object sender, EventArgs e) { marcaservice = new MarcaService(ConfigConnection.ConnectionString); if (TxtNombre.Text.Equals("") || TxtCodigo.Text.Equals("")) { MessageBox.Show("Complete el campo. "); } else { Marca marca = new Marca(); marca.Nombre = TxtNombre.Text.Trim().ToUpper(); marca.NumeroMarca = TxtCodigo.Text; MessageBox.Show(marcaservice.GuardarMarca(marca)); Inventario.Actualizar(); UnlockInventario.unlockInventario(); this.Close(); } }
private void BtnSalir_Click(object sender, EventArgs e) { UnlockInventario.unlockInventario(); this.Close(); }