Пример #1
0
 /// <summary>
 /// Initializes a new instance of the Order class.
 /// </summary>
 public Order(long id, string orderNumber, System.DateTime orderDate, bool isConfirmed, double subTotal, double totalDelivery, double totalTax, double totalCost, string status, string deliveryMethod, string transactionId, string transactionStatus, string orderType, bool useShippingAddress, ShippingAddress shippingAddress, string internalNotes, string customerFacingNotes, bool emailed, string discounts, double discountsTotal, string shippingCompany, string ipAddress, System.Guid guid, string paymentStatus = default(string), System.DateTime?lastUpdated = default(System.DateTime?), IList <OrderItem> items = default(IList <OrderItem>), OrderCustomerDetails customerDetails = default(OrderCustomerDetails))
 {
     Id                  = id;
     OrderNumber         = orderNumber;
     OrderDate           = orderDate;
     IsConfirmed         = isConfirmed;
     SubTotal            = subTotal;
     TotalDelivery       = totalDelivery;
     TotalTax            = totalTax;
     TotalCost           = totalCost;
     Status              = status;
     PaymentStatus       = paymentStatus;
     DeliveryMethod      = deliveryMethod;
     TransactionId       = transactionId;
     TransactionStatus   = transactionStatus;
     OrderType           = orderType;
     UseShippingAddress  = useShippingAddress;
     ShippingAddress     = shippingAddress;
     InternalNotes       = internalNotes;
     CustomerFacingNotes = customerFacingNotes;
     Emailed             = emailed;
     Discounts           = discounts;
     DiscountsTotal      = discountsTotal;
     ShippingCompany     = shippingCompany;
     IpAddress           = ipAddress;
     Guid                = guid;
     LastUpdated         = lastUpdated;
     Items               = items;
     CustomerDetails     = customerDetails;
     CustomInit();
 }
Пример #2
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (OrderNumber == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "OrderNumber");
     }
     if (Status == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Status");
     }
     if (DeliveryMethod == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "DeliveryMethod");
     }
     if (TransactionId == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TransactionId");
     }
     if (TransactionStatus == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TransactionStatus");
     }
     if (OrderType == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "OrderType");
     }
     if (ShippingAddress == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ShippingAddress");
     }
     if (InternalNotes == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "InternalNotes");
     }
     if (CustomerFacingNotes == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "CustomerFacingNotes");
     }
     if (Discounts == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Discounts");
     }
     if (ShippingCompany == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ShippingCompany");
     }
     if (IpAddress == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "IpAddress");
     }
     if (ShippingAddress != null)
     {
         ShippingAddress.Validate();
     }
     if (Items != null)
     {
         foreach (var element in Items)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
 }