private void button1_Click(object sender, EventArgs e) { if (validaciones()) { Tienda t1 = new Tienda(); t1.Nombre = txtNombre.Text; t1.Precio = double.Parse(txtPrecio.Text); t1.Cantidad = int.Parse(txtCantidad.Text); t1.Total = LTienda.ObtenerTotal((double)t1.Precio, (int)t1.Cantidad); if (ti != null) { t1.Codigo = ti.Codigo; t1.Id = ti.Id; Acceso.Modificar(t1); Completo(false); } else { t1.Codigo = LTienda.ObternCodigoc(Acceso.Obtener()); Acceso.Agregar(t1); Completo(true); } } else { MessageBox.Show("LLeno los compos correctamente"); } }
private bool Validaciones() { if (txtVenta.Text.Trim() != string.Empty && LTienda.esNum(txtVenta.Text.Trim())) { int venta = int.Parse(txtVenta.Text); if (t1.Cantidad >= venta && venta != 0) { return(true); } else { MessageBox.Show("Cantidad insuficiente"); } } return(false); }
private bool validaciones() { Espacios(); if (txtNombre.Text != string.Empty) { if (txtPrecio.Text != string.Empty && LTienda.esNumF(txtPrecio.Text)) { if (txtCantidad.Text != string.Empty && LTienda.esNum(txtCantidad.Text)) { return(true); } } } return(false); }