Exemple #1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            decimal temp;

            try
            {
                if (decimal.TryParse(txtValorFormaPago.Text, out temp))
                {
                    temp = Convert.ToDecimal(Utilidades.ModificarFormatoDecimal(txtValorFormaPago.Text));

                    if (temp > 0)
                    {
                        if (temp <= ValorTotal)
                        {
                            if ((sumValorTotalEfectivo + temp) <= ValorTotal)
                            {
                                decimal gal;
                                if (!string.IsNullOrEmpty(txtCantidad.Text.Trim()))
                                {
                                    if (Decimal.TryParse(txtCantidad.Text.Trim(), out gal))
                                    {
                                        if (gal <= Cantidad)
                                        {
                                            txtValorFormaPago.Clear();
                                            grdTurnos.Rows.Add(IdBloqueo.ToString(), Turno.ToString(), Manguera.ToString(), Producto.ToString(), cmbFormaPago.SelectedValue.ToString(), Precio.ToString(), txtCantidad.Text.Trim(), temp.ToString());
                                            sumValorTotalEfectivo += temp;
                                        }
                                        else
                                        {
                                            MessageBox.Show("La Catidad de Galones supera la cantidad total", "Agregar Cantidad", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("La Catidad de Galones es numerica", "Agregar Cantidad", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("La Catidad de Galones es obligatoria", "Agregar Cantidad", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                }
                            }
                            else
                            {
                                MessageBox.Show("El valor supera al total de la venta", "Agregar Cantidad", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                        else
                        {
                            MessageBox.Show("El valor supera al total de la venta", "Agregar Cantidad", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                    else
                    {
                        MessageBox.Show("El valor debe ser mayor que cero", "Agregar Cantidad", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("El valor debe ser numerico", "Agregar Cantidad", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "Gasolutions", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }