コード例 #1
0
        public static bool IsValid(this ShipStationOrder order)
        {
            if (order == null)
            {
                return(false);
            }

            var shipTo = order.ShippingAddress;

            if (shipTo == null)
            {
                return(false);
            }

            if (string.IsNullOrEmpty(shipTo.Name) || string.IsNullOrWhiteSpace(shipTo.Street1) || string.IsNullOrWhiteSpace(shipTo.City) || string.IsNullOrWhiteSpace(shipTo.Country))
            {
                return(false);
            }

            var isInUs = shipTo.Country.Equals("US", StringComparison.OrdinalIgnoreCase);

            if (isInUs && (string.IsNullOrWhiteSpace(shipTo.PostalCode) || string.IsNullOrWhiteSpace(shipTo.State)))
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
		public bool Equals( ShipStationOrder other )
		{
			if( ReferenceEquals( null, other ) )
				return false;
			if( ReferenceEquals( this, other ) )
				return true;
			return this.OrderId.Equals( other.OrderId );
		}
コード例 #3
0
 public bool Equals(ShipStationOrder other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(this.OrderId.Equals(other.OrderId));
 }
コード例 #4
0
 public bool Equals( ShipStationOrder other )
 {
     if( ReferenceEquals( null, other ) )
         return false;
     if( ReferenceEquals( this, other ) )
         return true;
     return this.OrderId.Equals( other.OrderId );
 }
コード例 #5
0
		public async Task UpdateOrderAsync( ShipStationOrder order )
		{
			if( !order.IsValid() )
				return;

			await ActionPolicies.SubmitAsync.Do( async () =>
			{
				try
				{
					await this._webRequestServices.PostDataAsync( ShipStationCommand.CreateUpdateOrder, order.SerializeToJson() );
				}
				catch( WebException x )
				{
					if( x.Response.GetHttpStatusCode() == HttpStatusCode.InternalServerError )
						ShipStationLogger.Log.Trace( "Error updating order. Encountered 500 Internal Error. Order: {order}", order );
					else
						throw;
				}
			} );
		}