private void Btn_Guardar_Click(object sender, EventArgs e) { if (Lb_Id.Text == "Id_Producto") { if (Tb_Producto.Text != "" && Tb_Codigo.Text != "" && Tb_Precio_Venta.Text != "") { if (con.Insertar_Producto(Tb_Producto.Text, Tb_Descripcion.Text, Tb_Codigo.Text, Tb_Precio_Venta.Text, "0") == true) { MessageBox.Show("¡El producto se registró exitosamente!", "Información del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar_TextBox(); } else { MessageBox.Show("¡El producto ya está registrado!", "¡Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Tb_Producto.Text = ""; Tb_Producto.Focus(); } } else { MessageBox.Show("Por favor revise que los campos obligatorios se hayan ingresado", "¡Atención!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { con.Actualizar_Producto(Lb_Id.Text, Tb_Producto.Text, Tb_Descripcion.Text, Tb_Codigo.Text, Tb_Precio_Venta.Text); Limpiar_TextBox(); MessageBox.Show("¡La pieza se actualizó exitosamente!", "Información del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
private void Limpiar_TextBox() { Tb_Producto.Text = ""; Tb_Descripcion.Text = ""; Tb_Codigo.Text = ""; Tb_Precio_Venta.Text = ""; Tb_Producto.Focus(); }
private void MP_Limpiar() { Tb_Id.Clear(); Tb_CodProducto.Clear(); Tb_Descripcion.Clear(); Tb_CodBarras.Clear(); Tb_Peso.Value = 0; Tb_IdProducto.Value = 0; Tb_Cantidad.Value = 0; Tb_Producto.Clear(); if (_Limpiar == false) { UTGlobal.MG_SeleccionarCombo(Cb_UnidadVenta); UTGlobal.MG_SeleccionarCombo(Cb_UniPeso); UTGlobal.MG_SeleccionarCombo(Cb_Grupo1); UTGlobal.MG_SeleccionarCombo(Cb_Grupo2); UTGlobal.MG_SeleccionarCombo(Cb_Grupo3); UTGlobal.MG_SeleccionarCombo(Cb_Grupo4); UTGlobal.MG_SeleccionarCombo(Cb_Grupo5); } }