private void ProductoIdmaskedTextBox_TextChanged(object sender, EventArgs e) { CantidadnumericUpDown.Text = "0"; DescripcionProductotextBox.Clear(); PreciotextBox.Clear(); ProductoerrorProvider.Clear(); }
private void BuscarProducto() { if (!string.IsNullOrEmpty(ProductoIdmaskedTextBox.Text)) { int id = Utilidades.TOINT(ProductoIdmaskedTextBox.Text); Detalle.Producto = BLL.ProductosBLL.Buscar(p => p.ProductoId == id); if (Detalle.Producto != null) { DescripcionProductotextBox.Text = Detalle.Producto.Descripcion; PreciotextBox.Text = Detalle.Producto.Precio.ToString(); CantidadnumericUpDown.Enabled = true; CantidadnumericUpDown.Focus(); } else { ProductoIdmaskedTextBox.Clear(); ProductoerrorProvider.SetError(ProductoIdmaskedTextBox, "No existe un producto con ese id."); DescripcionProductotextBox.Clear(); PreciotextBox.Clear(); CantidadnumericUpDown.Enabled = false; ProductoIdmaskedTextBox.Focus(); } } else { DescripcionProductotextBox.Clear(); ProductoerrorProvider.SetError(ProductoIdmaskedTextBox, "Digite el id de un producto."); ProductoIdmaskedTextBox.Focus(); } }
private bool SetError(int error) { bool paso = false; if (error == 1 && IDcomboBox.Text == string.Empty) { IDerrorProvider.SetError(IDcomboBox, "Llenar Id"); paso = true; } if (error == 2 && CLienteIDcomboBox.Text == string.Empty) { DemaserrorProvider.SetError(CLienteIDcomboBox, "Llenar Cliente Id"); paso = true; } if (error == 2 && DescripciponFacturatextBox.Text == string.Empty) { DemaserrorProvider.SetError(DescripciponFacturatextBox, "Llenar descripcion"); paso = true; } if (error == 2 && DescripciponFacturatextBox.Text == string.Empty) { DemaserrorProvider.SetError(DescripciponFacturatextBox, "Llenar descripcion"); paso = true; } if (error == 3 && ProductoIdcomboBox.Text == string.Empty) { ProductoerrorProvider.SetError(ProductoIdcomboBox, " Llenar id producto"); paso = true; } if (error == 4 && DetallecomboBox.Text == string.Empty) { ProductoerrorProvider.SetError(DetallecomboBox, " Llenar id producto"); paso = true; } if (error == 5 && Convert.ToDecimal(DevueltatextBox.Text) < 0) { DemaserrorProvider.SetError(DevueltatextBox, "Arreglar efectivo recibido"); paso = true; } if (error == 6 && ProductoIdcomboBox.Text == string.Empty) { DemaserrorProvider.SetError(ProductoIdcomboBox, "Debe de buscar antes de agregar!"); paso = true; } if (error == 7 && CantidadnumericUpDown.Value == 0) { DemaserrorProvider.SetError(CantidadnumericUpDown, "Debe de agregar una cantidad andes de agregar!"); paso = true; } return(paso); }
private void Limpiar() { Detalle = new Entidades.FacturasProductos(); Factura = new Entidades.Facturas(); FacturaIdmaskedTextBox.Clear(); ClienteIdmaskedTextBox.Clear(); NombreClientetextBox.Clear(); MontotextBox.Clear(); FechadateTimePicker.Value = DateTime.Now; ProductoIdmaskedTextBox.Clear(); DescripcionProductotextBox.Clear(); ProductodataGridView.DataSource = null; CantidadnumericUpDown.Value = 0; PreciotextBox.Clear(); DevueltatextBox.Clear(); RecibidomaskedTextBox.Clear(); ComentariotextBox.Clear(); NombreClienteerrorProvider.Clear(); CantidaderrorProvider.Clear(); ProductoerrorProvider.Clear(); RecibidoerrorProvider.Clear(); GriderrorProvider.Clear(); ClienteIderrorProvider.Clear(); FacturaIderrorProvider.Clear(); DevueltaerrorProvider.Clear(); FormaPagoComboBox.Text = null; ClienteIdmaskedTextBox.Enabled = true; ProductoIdmaskedTextBox.Enabled = true; FechadateTimePicker.Enabled = true; ComentariotextBox.Enabled = true; FormaPagoComboBox.Enabled = true; ProductodataGridView.Enabled = true; RecibidomaskedTextBox.Enabled = false; FacturaIdmaskedTextBox.Enabled = true; CantidadnumericUpDown.Enabled = false; }
private void LimpiarProvider() { IDerrorProvider.Clear(); DemaserrorProvider.Clear(); ProductoerrorProvider.Clear(); }
private void AgregarProducto() { if (!string.IsNullOrEmpty(DescripcionProductotextBox.Text)) { if (CantidadnumericUpDown.Value != 0) { if (Detalle.Producto.Cantidad >= CantidadnumericUpDown.Value) { bool productoAgregado = false; foreach (var producto in Factura.Relacion) { if (Detalle.Producto.ProductoId == producto.ProductoId) { productoAgregado = true; break; } } if (!productoAgregado) { Factura.Relacion.Add(new Entidades.FacturasProductos(Factura.FacturaId, Detalle.Producto.ProductoId, Detalle.Producto.Descripcion, Detalle.Producto.Precio, CantidadnumericUpDown.Value)); LlenarDataGrid(Factura); CantidadnumericUpDown.Enabled = false; CalculoMonto(); ProductoIdmaskedTextBox.Clear(); } else { MessageBox.Show("Este producto ya esta agregado en la factura."); DescripcionProductotextBox.Clear(); PreciotextBox.Clear(); CantidadnumericUpDown.Text = "0"; CantidadnumericUpDown.Enabled = false; ProductoIdmaskedTextBox.Focus(); } } else { if (Detalle.Producto.Cantidad <= 0) { MessageBox.Show("No queda producto de ese tipo"); ProductoIdmaskedTextBox.Clear(); DescripcionProductotextBox.Clear(); CantidadnumericUpDown.Text = "0"; ProductoIdmaskedTextBox.Focus(); } else { MessageBox.Show("La cantidad excede la existencia, se cuenta con (" + Detalle.Producto.Cantidad + ") " + Detalle.Producto.Descripcion + "."); CantidadnumericUpDown.Focus(); } } } else { CantidaderrorProvider.SetError(CantidadnumericUpDown, "Digite una cantidad diferente de (0)."); CantidadnumericUpDown.Focus(); } } else { ProductoerrorProvider.SetError(ProductoIdmaskedTextBox, "Busque un producto para poder agregar."); } ClienteIdmaskedTextBox.Clear(); }
//listo Eso maneja la validacion private bool SetError(int error) { bool paso = false; if (error == 1 && IDcomboBox.Text == string.Empty) { IDerrorProvider.SetError(IDcomboBox, "Llenar Id"); paso = true; } if (error == 2 && CLienteIDcomboBox.Text == string.Empty) { DemaserrorProvider.SetError(CLienteIDcomboBox, "Llenar Cliente Id"); paso = true; } if (error == 2 && FormaDePagocomboBox.Text == string.Empty) { DemaserrorProvider.SetError(FormaDePagocomboBox, "Llenar Forma de pago"); paso = true; } if (error == 2 && DescripciponFacturatextBox.Text == string.Empty) { DemaserrorProvider.SetError(DescripciponFacturatextBox, "Llenar descripcion"); paso = true; } if (error == 2 && DescripciponFacturatextBox.Text == string.Empty) { DemaserrorProvider.SetError(DescripciponFacturatextBox, "Llenar descripcion"); paso = true; } if (error == 2 && EfectivonumericUpDown.Value == 0 && FormaDePagocomboBox.SelectedIndex != 0 && Convert.ToInt32(DevueltatextBox.Text) < Convert.ToInt32(MontotextBox.Text)) { DemaserrorProvider.SetError(EfectivonumericUpDown, "Llenar Efectivo de caja"); paso = true; } if (error == 3 && ProductoIdcomboBox.Text == string.Empty) { ProductoerrorProvider.SetError(ProductoIdcomboBox, " Llenar id producto"); paso = true; } if (error == 4 && DetallecomboBox.Text == string.Empty) { ProductoerrorProvider.SetError(DetallecomboBox, " Llenar id producto"); paso = true; } if (error == 5 && Convert.ToDecimal(DevueltatextBox.Text) < 0) { DemaserrorProvider.SetError(DevueltatextBox, "Posible perdida, Arreglar efectivo recibido"); paso = true; } if (error == 6 && ProductoIdcomboBox.Text == string.Empty) { DemaserrorProvider.SetError(ProductoIdcomboBox, "Debe de buscar antes de agregar!"); paso = true; } if (error == 7 && CantidadnumericUpDown.Value == 0) { DemaserrorProvider.SetError(CantidadnumericUpDown, "Debe de agregar una cantidad andes de agregar!"); paso = true; } return(paso); }