private bool Validar() { bool paso = false; if (String.IsNullOrWhiteSpace(observacionesTextBox.Text)) { HayErrores.SetError(observacionesTextBox, "No debes dejar la Observacion vacia"); paso = true; } if (cantidadnumericUpDown.Value == 0) { HayErrores.SetError(cantidadnumericUpDown, "No debes dejar la Cantidad Vacia vacia"); paso = true; } if (detalledataGridView.RowCount == 0) { HayErrores.SetError(detalledataGridView, "Es obligatorio Agregar un Articulo "); paso = true; } return(paso); }
private bool ValidarE() { bool paso = false; if (cotizacionArticulosIdnumericUpDown.Value == 0) { HayErrores.SetError(cotizacionArticulosIdnumericUpDown, "No debes dejar la Cotizacion Id Vacio"); paso = true; } return(paso); }
private bool Validar(int error) { bool paso = false; if (error == 1 && mantenimientoIdNumericUpDown.Value == 0) { HayErrores.SetError(mantenimientoIdNumericUpDown, "No debes dejar la Mantenimiento Id Vacio"); paso = true; } if (error == 2 && string.IsNullOrWhiteSpace(TotaltextBox.Text)) { HayErrores.SetError(TotaltextBox, "No debes dejar la total vacio"); paso = true; } if (error == 2 && string.IsNullOrWhiteSpace(subtotaltextBox.Text)) { HayErrores.SetError(subtotaltextBox, "No debes dejar la subtotal vacio"); paso = true; } if (error == 2 && string.IsNullOrWhiteSpace(ItbistextBox.Text)) { HayErrores.SetError(ItbistextBox, "No debes dejar la Itbis vacio"); paso = true; } if (error == 2 && DetalledataGridView.RowCount == 0) { HayErrores.SetError(DetalledataGridView, "Es obligatorio Agregar un Articulo "); paso = true; } if (error == 3 && string.IsNullOrEmpty(importeTextBox.Text)) { HayErrores.SetError(importeTextBox, "Es obligatorio Agregar un Articulo "); paso = true; } return(paso); }
private bool Validar(int error) { bool paso = false; decimal num = 0; if (error == 1 && reciboIdNumericUpDown.Value == 0) { HayErrores.SetError(reciboIdNumericUpDown, "No debes dejar la Recibo Id Vacio"); paso = true; } if (error == 2 && DetalledataGridView.RowCount == 0) { HayErrores.SetError(DetalledataGridView, "Es obligatorio Agregar un Articulo "); paso = true; } if (error == 4 && string.IsNullOrWhiteSpace(montoTextBox.Text)) { HayErrores.SetError(montoTextBox, "No debes dejar la Monto vacio"); paso = true; } if (error == 4 && string.IsNullOrWhiteSpace(descripcionTextBox.Text)) { HayErrores.SetError(descripcionTextBox, "No debes dejar la descripcion vacia"); paso = true; } if (error == 4 && cantidadNumericUpDown.Value == 0) { HayErrores.SetError(cantidadNumericUpDown, "No debes dejar la Cantidad vacia"); paso = true; } if (error == 3 && decimal.TryParse(montoTextBox.Text, out num) == false) { HayErrores.SetError(montoTextBox, "Debe Dijitar un Monto"); paso = true; } if (error == 5 && string.IsNullOrWhiteSpace(clienteIdComboBox.Text) || string.IsNullOrEmpty(articuloIdComboBox.Text)) { HayErrores.SetError(clienteIdComboBox, "No hay Cliente o Articulos Creado"); paso = true; } if (error == 5 && string.IsNullOrEmpty(articuloIdComboBox.Text)) { HayErrores.SetError(articuloIdComboBox, "No hay Cliente o Articulos Creado"); paso = true; } return(paso); }
private void Agregarbutton_Click(object sender, EventArgs e) { if (Validar(5)) { MessageBox.Show(" Combobox Vacio", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(4)) { MessageBox.Show(" LLene las Casillas Correspondiente", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validar(3)) { MessageBox.Show(" Digite un Monto", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { HayErrores.Clear(); List <ReciboDetalles> detalle = new List <ReciboDetalles>(); if (DetalledataGridView.DataSource != null) { detalle = (List <ReciboDetalles>)DetalledataGridView.DataSource; } ActivodeNegocio negocio = BLL.ActivodeNegocioBLL.Buscar(1); if (Convert.ToDecimal(montoTextBox.Text) > negocio.Activo) { HayErrores.SetError(montoTextBox, "Error"); MessageBox.Show("No Hay esa Cantidad de Dinero Disponiblle!!", "Validación!!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(montoTextBox.Text) && string.IsNullOrEmpty(cantidadNumericUpDown.Text)) { MessageBox.Show(" Llene cantidad y Monto", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { detalle.Add( new ReciboDetalles(iD: 0, reciboId: (int)Convert.ToInt32(reciboIdNumericUpDown.Value), articuloId: (int)articuloIdComboBox.SelectedValue, articulo: (string)BLL.ArticulosBLL.RetornarNombre(articuloIdComboBox.Text), descripcion: (string)descripcionTextBox.Text, cantidad: (int)Convert.ToInt32(cantidadNumericUpDown.Value), monto: (decimal)Convert.ToDecimal(montoTextBox.Text) )); //Cargar el detalle al Grid DetalledataGridView.DataSource = null; DetalledataGridView.DataSource = detalle; decimal monto = 0; foreach (var item in detalle) { monto += item.Monto; } montoTotalTextBox.Text = monto.ToString(); //Oculta las Columnas No deceada NoColumnas(); LimpiaRecibo(); } } }