Beispiel #1
0
        public InvoiceValidator()
        {
            RuleFor(x => x.CustomerName).Cascade(CascadeMode.StopOnFirstFailure)
            .MaximumLength(100);

            RuleFor(x => x.PriceSold).Cascade(CascadeMode.StopOnFirstFailure)
            .NotEmpty()
            .Must(PriceSold => Decimal.TryParse(PriceSold.ToString(), NumberStyles.Currency, CultureInfo.CurrentCulture, out decimal result))
            .WithMessage("Price sold may include only numbers, commas, and decimals.")
            .Must(PriceSold => PriceMustBeGreaterThanZero(PriceSold.ToString()))
            .WithMessage("Price must be greater than 0");


            RuleFor(x => x.DateSold).Cascade(CascadeMode.StopOnFirstFailure)
            .LessThanOrEqualTo(DateTime.Today).WithMessage("Date must be today or earlier.");
        }
Beispiel #2
0
        /// <summary>
        /// Register queue transaction
        /// </summary>
        public void Insert()
        {
            var colValPairs = new List <Tuple <string, string> >();

            colValPairs.Add(new Tuple <string, string>("Codigo", ProductCode));
            colValPairs.Add(new Tuple <string, string>("CategoriaProducto", ProductCategory));
            colValPairs.Add(new Tuple <string, string>("Descripcion", ProductDescription));
            colValPairs.Add(new Tuple <string, string>("PrecioVendido", PriceSold.ToString()));
            colValPairs.Add(new Tuple <string, string>("UnidadesVendidas", UnitsSold.ToString()));
            colValPairs.Add(new Tuple <string, string>("TotalVendido", TotalAmountSold.ToString()));
            colValPairs.Add(new Tuple <string, string>("FechaVenta", Utilities.FormatDateForMySql(DateTime.Now)));
            colValPairs.Add(new Tuple <string, string>("Cliente", Customer));
            colValPairs.Add(new Tuple <string, string>("Vendedor", Seller));
            colValPairs.Add(new Tuple <string, string>("FacturaRequerida", FiscalReceiptRequiredString));
            colValPairs.Add(new Tuple <string, string>("NumeroPedido", OrderNumber.ToString()));
            MySqlData.Insert(colValPairs);
        }