private void BtnLimpiar_Click(object sender, EventArgs e) { foreach (TextBox txt in this.Controls.OfType <TextBox>()) { txt.Clear(); TxtCosto.Focus(); } }
private void CmdAgregar_Click(object sender, EventArgs e) { if (TxtID_Producto.Text == "") { // MessageBox.Show("Favor Ingrese el ID!", "Info!", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtID_Producto.Focus(); return; } else if (TxtCosto.Text.Trim() == "" || TxtCosto.Text.Trim() == "0") { Program.MensajeError("Verificar el precio de costo!"); return; } if (TxtCosto.Text == "") { MessageBox.Show("Favor Ingrese el precio de costo!", "Info!", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtCosto.Focus(); return; } try { var prd = new Clases.Productos() { ID_Producto = TxtID_Producto.Text.Trim() == "" ? null : TxtID_Producto.Text, Clase = (int)CmbClase.SelectedValue, NombreProducto = (int)CmbNombre.SelectedValue, Fecha_Ingreso = dtFechaIngreso.Value, Precio_Costo = decimal.Parse(TxtCosto.Text), }; if (!Productos_A_Ingresar.Exists(p => p.ID_Producto == prd.ID_Producto)) { Productos_A_Ingresar.Add(prd); } else { Program.MensageInfo("Producto ya registrado"); return; } TxtID_Producto.Text = ""; TxtID_Producto.Focus(); AddProd(prd); //LlenarListaProdsToAdd(); } catch (Exception es) { MessageBox.Show(es.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
void limpiar() { TxtFechaCaducidad.Clear(); TxtNombre.Clear(); TxtCosto.Clear(); TxtPrecioMin.Clear(); TxtprecioVenta.Clear(); TxtIva.Clear(); TxtStock.Clear(); TxtStockMin.Clear(); TxtDescripcion.Clear(); cbidPromocio.Visible = false; lblselecpromo.Visible = false; cbpromocion.DataSource = null; cbProveedor.DataSource = null; CbMedida.DataSource = null; CbFamilia.DataSource = null; TxtCodigoBarra.Clear(); }
private void BtnCalcular_Click(object sender, EventArgs e) { if (TxtCosto.Text.Trim().Length == 0) { POO.MsgWarning("El Precio de Costo es Requerido."); TxtCosto.Focus(); } if (TxtVenta.Text.Trim().Length == 0) { POO.MsgWarning("El Precio de Venta es Requerido."); TxtVenta.Focus(); } double prec, prev; prec = Convert.ToDouble(TxtCosto.Text); prev = Convert.ToDouble(TxtVenta.Text); TxtPorcentaje.Text = POO.PorcGanan(prec, prev).ToString() + "%"; }
bool validartxt() { try { if (cbidPromocio.SelectedText != null) { if (TxtCodigoBarra.Text != "") { if (TxtNombre.Text != "") { if (TxtDescripcion.Text != "") { if (TxtStock.Text != "" && TxtStock.Text != "0") { if (TxtStockMin.Text != "" && TxtStockMin.Text != "0") { if (TxtCosto.Text != "") { if (TxtPrecioMin.Text != "") { if (TxtprecioVenta.Text != "") { if (TxtIva.Text != "") { if (CbMedida.SelectedValue != null) { if (CbFamilia.SelectedValue != null) { if (cbpromocion.SelectedText != null) { if (cbProveedor.SelectedValue != null) { if (CbEstatus.SelectedText != null) { if (TxtFechaCaducidad.Text != null) { return(true); } } } } } } } else { TxtIva.Focus(); } } else { TxtprecioVenta.Focus(); } } else { TxtPrecioMin.Focus(); } } else { TxtCosto.Focus(); } } else { TxtStockMin.Focus(); } } else { TxtStock.Focus(); } } else { TxtDescripcion.Focus(); } } else { TxtNombre.Focus(); } } else { TxtCodigoBarra.Focus(); } } } catch (Exception e) { MessageBox.Show("Error consulte con su administrador error:" + e.ToString(), "Error"); } return(false); }