示例#1
0
        public ValidateOrderListRequest(GetOrderListMessage MyGetOrderListMessage)
        {
            _ValidateOrderListMessage = new ValidateOrderListMessage();
            int i = 0;

            foreach (Order MyOrder in MyGetOrderListMessage._OrderListMessage.Result.OrderList)
            {
                ValidateOrder MyValidateOrder = new ValidateOrder();
                MyValidateOrder.CarrierName    = "CarrierName";
                MyValidateOrder.TrackingNumber = "TrackingNumber";
                MyValidateOrder.TrackingUrl    = "TrackingUrl";
                MyValidateOrder.OrderNumber    = MyOrder.OrderNumber;
                int j = 0;
                foreach (OrderLine MyOrderLine in MyOrder.OrderLineList)
                {
                    ValidateOrderLine MyValidateOrderLine = new ValidateOrderLine();
                    MyValidateOrderLine.SellerProductId  = MyOrderLine.SellerProductId;
                    MyValidateOrderLine.ProductCondition = (ProductConditionEnum)MyOrderLine.ProductCondition;
                    MyValidateOrder.OrderLineList[j]     = MyValidateOrderLine;
                }

                _ValidateOrderListMessage.OrderList[i] = MyValidateOrder;
            }
            _Token = MyGetOrderListMessage._Token;
        }
示例#2
0
        public void SetAreaCode(string areaCode)
        {
            if (!ValidateOrder.IsNumeric(areaCode))
            {
                throw new ApplicationException("AreaCode must be numeric!");
            }

            AreaCode = areaCode;
        }
示例#3
0
        public void SetCreatedAt(string date)
        {
            if (!ValidateOrder.IsValidDate(date))
            {
                throw new ApplicationException("Date is not in correct format!");
            }

            CreatedAt = date;
        }
示例#4
0
        public void SetCountryCode(string countryCode)
        {
            if (!ValidateOrder.IsNumeric(countryCode))
            {
                throw new ApplicationException("CountryCode must be numeric!");
            }

            CountryCode = countryCode;
        }
示例#5
0
        public void SetEmail(string email)
        {
            if (!ValidateOrder.IsValidEmail(email))
            {
                throw new ApplicationException("Document must have 11 or 14 characters!");
            }

            Email = email;
        }
示例#6
0
        public void SetType(string type)
        {
            if (!ValidateOrder.IsValidCustomerType(type))
            {
                throw new ApplicationException("Accepted values for Type are: individual and company!");
            }

            Type = type;
        }
示例#7
0
        public void SetZipCode(string zipCode)
        {
            if (!ValidateOrder.IsNumeric(zipCode))
            {
                throw new ApplicationException("Zip code must be numeric!");
            }

            ZipCode = zipCode;
        }
示例#8
0
        public void SetDocument(string document)
        {
            if (!ValidateOrder.IsValidDocument(document))
            {
                throw new ApplicationException("Document must have 11 or 14 characters!");
            }

            Document = document;
        }
示例#9
0
        public void SetLine1(string line1)
        {
            if (!ValidateOrder.IsValidLine1(line1))
            {
                throw new ApplicationException("Line1 must be in the format 'número, rua, bairro'!");
            }

            Line1 = line1;
        }
示例#10
0
        public void SetNumber(string number)
        {
            if (!ValidateOrder.IsNumeric(number))
            {
                throw new ApplicationException("Number must be numeric!");
            }

            Number = number;
        }
示例#11
0
        public void SetStatus(string status)
        {
            if (!ValidateOrder.IsValidAddressStatus(status))
            {
                throw new ApplicationException("Status must be active or deleted!");
            }

            Status = status;
        }
示例#12
0
        public void SetStatus(string status)
        {
            if (!ValidateOrder.IsValidChargeStatus(status))
            {
                throw new ApplicationException("Charge status must be pending, paid, canceled, processing, failed, overpaid or underpaid!");
            }

            Status = status;
        }
示例#13
0
    public async Task Handle(PlaceOrder placeOrder, IMessageHandlerContext context)
    {
        log.Info($"Sending order {placeOrder.OrderId} to validation.");

        await Task.Delay(1000).ConfigureAwait(false);

        var validateOrder = new ValidateOrder
        {
            OrderId = placeOrder.OrderId,
            Sender  = context.ReplyToAddress
        };


        await context.SendLocal(validateOrder)
        .ConfigureAwait(false);
    }
        public bool Validate(ValidateOrder data)
        {
            if (data.OrderId == Guid.Empty || data.RestaurantId == Guid.Empty || data.CustomerId == Guid.Empty)
            {
                return(false);
            }

            for (int i = 0; i < data.Items.Length; i++)
            {
                if (data.Items[i].MenuItemId == Guid.Empty)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#15
0
        public async Task <IActionResult> PutOrders(Guid id, Order order)
        {
            // validate id's and that OrderTotal matches sum of all orderitems
            if (order == null || id != order.Id || !ValidateOrder.TotalCost(order))
            {
                return(BadRequest());
            }

            var isUpdated = await _ordersRepository.UpdateOrderAsync(order);

            if (isUpdated)
            {
                return(Ok(id));
            }
            else
            {
                return(NoContent());
            }
        }
        /// <summary>
        /// Create a new order
        /// </summary>
        /// <param name="order"></param>
        /// <returns>Order</returns>
        public async Task <Order> CreateOrderAsync(Order order)
        {
            // Validate order!
            if (ValidateOrder.OrderData(order))
            {
                // If ordertotal and sum of all items doesn't match, return null, order not valid!
                if (!ValidateOrder.TotalCost(order))
                {
                    return(null);
                }

                // Set order status to 1
                order.StatusId = 1;

                // Save
                _context.Orders.Add(order);
                await _context.SaveChangesAsync();

                return(order);
            }

            return(null);
        }
示例#17
0
 private void btnCash_Click(object sender, RoutedEventArgs e)
 {
     validateOrder = new ValidateOrder();
     Main.GetCurrent().SetLayoutRoot(validateOrder);
 }