Пример #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + (AccountNumber == null ? 0 : AccountNumber.GetHashCode());
         hash = hash * 23 + (BillToAddressId == default(int) ? 0 : BillToAddressId.GetHashCode());
         hash = hash * 23 + (Comment == null ? 0 : Comment.GetHashCode());
         hash = hash * 23 + (CreditCardApprovalCode == null ? 0 : CreditCardApprovalCode.GetHashCode());
         hash = hash * 23 + (CreditCardId == null ? 0 : CreditCardId.GetHashCode());
         hash = hash * 23 + (CurrencyRateId == null ? 0 : CurrencyRateId.GetHashCode());
         hash = hash * 23 + (CustomerId == default(int) ? 0 : CustomerId.GetHashCode());
         hash = hash * 23 + (DueDate == default(DateTime) ? 0 : DueDate.GetHashCode());
         hash = hash * 23 + (Freight == default(decimal) ? 0 : Freight.GetHashCode());
         hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
         hash = hash * 23 + (OnlineOrderFlag == default(bool) ? 0 : OnlineOrderFlag.GetHashCode());
         hash = hash * 23 + (OrderDate == default(DateTime) ? 0 : OrderDate.GetHashCode());
         hash = hash * 23 + (PurchaseOrderNumber == null ? 0 : PurchaseOrderNumber.GetHashCode());
         hash = hash * 23 + (RevisionNumber == default(byte) ? 0 : RevisionNumber.GetHashCode());
         hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
         hash = hash * 23 + (SalesOrderNumber == null ? 0 : SalesOrderNumber.GetHashCode());
         hash = hash * 23 + (SalesPersonId == null ? 0 : SalesPersonId.GetHashCode());
         hash = hash * 23 + (ShipDate == null ? 0 : ShipDate.GetHashCode());
         hash = hash * 23 + (ShipMethodId == default(int) ? 0 : ShipMethodId.GetHashCode());
         hash = hash * 23 + (ShipToAddressId == default(int) ? 0 : ShipToAddressId.GetHashCode());
         hash = hash * 23 + (Status == default(byte) ? 0 : Status.GetHashCode());
         hash = hash * 23 + (SubTotal == default(decimal) ? 0 : SubTotal.GetHashCode());
         hash = hash * 23 + (TaxAmt == default(decimal) ? 0 : TaxAmt.GetHashCode());
         hash = hash * 23 + (TerritoryId == null ? 0 : TerritoryId.GetHashCode());
         hash = hash * 23 + (TotalDue == default(decimal) ? 0 : TotalDue.GetHashCode());
         return(hash);
     }
 }
Пример #2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     // credit: http://stackoverflow.com/a/263416/677735
     unchecked // Overflow is fine, just wrap
     {
         var hash = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hash = hash * 59 + Id.GetHashCode();
         }
         if (PetId != null)
         {
             hash = hash * 59 + PetId.GetHashCode();
         }
         if (Quantity != null)
         {
             hash = hash * 59 + Quantity.GetHashCode();
         }
         if (ShipDate != null)
         {
             hash = hash * 59 + ShipDate.GetHashCode();
         }
         if (Status != null)
         {
             hash = hash * 59 + Status.GetHashCode();
         }
         if (Complete != null)
         {
             hash = hash * 59 + Complete.GetHashCode();
         }
         return(hash);
     }
 }
Пример #3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (PetId != null)
         {
             hashCode = hashCode * 59 + PetId.GetHashCode();
         }
         if (Quantity != null)
         {
             hashCode = hashCode * 59 + Quantity.GetHashCode();
         }
         if (ShipDate != null)
         {
             hashCode = hashCode * 59 + ShipDate.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         if (Complete != null)
         {
             hashCode = hashCode * 59 + Complete.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #4
0
 public ActiveJob(ScheduledJob job, ShipTimeAssignment assignment, DateTime shipTime, EmployeeState employee)
 {
     this.UsedTruck  = assignment.AssignedEmployee.AssignedTruck;
     this.Job        = job;
     this.Employee   = employee;
     this.ShipDate   = shipTime;
     this.Assignment = assignment;
     this.EndDate    = ShipDate.AddHours(job.Job.GetTravelTime());
 }
Пример #5
0
        public Dictionary <string, object> ToDictionary()
        {
            Dictionary <string, object> orderDictionary = new Dictionary <string, object>();

            string[] printOperatorID       = GetIdFromNameIfPresent(PrintOperator, _NameLookup)?.ToArray();
            string[] DestinationLocationID = GetIdFromNameIfPresent(DestinationLocation, _NameLookup)?.ToArray();

            string[] shipperID = GetIdFromNameIfPresent(Shipper, _NameLookup)?.ToArray();

            if (!string.IsNullOrEmpty(IncludedComponentId))
            {
                orderDictionary.AddIfNotNull(IncludedComponentsKey, new string[] { IncludedComponentId });
            }

            orderDictionary.AddIfNotNull(OrderIDKey, OrderID);
            orderDictionary.AddIfNotNull(StageKey, Stage);
            orderDictionary.AddIfNotNull(OrderValueKey, OrderValue);
            orderDictionary.AddIfNotNull(DescriptionKey, Description);
            orderDictionary.AddIfNotNull(NotesKey, Notes);
            orderDictionary.AddIfNotNull(OrderNoteKey, OrderNote);
            orderDictionary.AddIfNotNull(PersonalizationKey, Personalization);

            if (DueDate.Year > 2010)
            {
                orderDictionary.AddIfNotNull(DueDateKey, DueDate.ToString("d"));
            }
            if (ShipDate.Year > 2010)
            {
                orderDictionary.AddIfNotNull(ShippedDateKey, ShipDate.ToString("d"));
            }
            orderDictionary.AddIfNotNull(RushKey, Priority);
            orderDictionary.AddIfNotNull(CancelledKey, Cancelled);
            orderDictionary.AddIfNotNull(InventoryRequestKey, IsInventoryRequest);
            orderDictionary.AddIfNotNull(OrderTypeKey, OrderType);
            orderDictionary.AddIfNotNull(PrintOperatorKey, printOperatorID);
            orderDictionary.AddIfNotNull(DestinationLocationKey, DestinationLocationID);
            orderDictionary.AddIfNotNull(ShipperKey, shipperID);
            orderDictionary.AddIfNotNull(ChannelKey, Channel);
            orderDictionary.AddIfNotNull(OrderURLKey, OrderURL);
            orderDictionary.AddIfNotNull(DesignerURLKey, DesignerURL);
            if (RequestedQuantity > 0)
            {
                orderDictionary.AddIfNotNull(RequestedQuantityKey, RequestedQuantity);
            }

            return(orderDictionary);
        }
Пример #6
0
        /// <summary>
        /// Returns true if Order instances are equal
        /// </summary>
        /// <param name="other">Instance of Order to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Order other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||

                     Id.Equals(other.Id)
                     ) &&
                 (
                     PetId == other.PetId ||

                     PetId.Equals(other.PetId)
                 ) &&
                 (
                     Quantity == other.Quantity ||

                     Quantity.Equals(other.Quantity)
                 ) &&
                 (
                     ShipDate == other.ShipDate ||
                     ShipDate != null &&
                     ShipDate.Equals(other.ShipDate)
                 ) &&
                 (
                     Status == other.Status ||

                     Status.Equals(other.Status)
                 ) &&
                 (
                     Complete == other.Complete ||

                     Complete.Equals(other.Complete)
                 ));
        }
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + (EmployeeId == default(int) ? 0 : EmployeeId.GetHashCode());
         hash = hash * 23 + (Freight == default(decimal) ? 0 : Freight.GetHashCode());
         hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
         hash = hash * 23 + (OrderDate == default(DateTime) ? 0 : OrderDate.GetHashCode());
         hash = hash * 23 + (RevisionNumber == default(byte) ? 0 : RevisionNumber.GetHashCode());
         hash = hash * 23 + (ShipDate == null ? 0 : ShipDate.GetHashCode());
         hash = hash * 23 + (ShipMethodId == default(int) ? 0 : ShipMethodId.GetHashCode());
         hash = hash * 23 + (Status == default(byte) ? 0 : Status.GetHashCode());
         hash = hash * 23 + (SubTotal == default(decimal) ? 0 : SubTotal.GetHashCode());
         hash = hash * 23 + (TaxAmt == default(decimal) ? 0 : TaxAmt.GetHashCode());
         hash = hash * 23 + (TotalDue == default(decimal) ? 0 : TotalDue.GetHashCode());
         hash = hash * 23 + (VendorId == default(int) ? 0 : VendorId.GetHashCode());
         return(hash);
     }
 }
Пример #8
0
        public Dictionary <string, object> ToDictionary()
        {
            Dictionary <string, object> orderDictionary = new Dictionary <string, object>();

            string[] printOperatorID = GetIdFromNameIfPresent(PrintOperator, _NameLookup)?.ToArray();
            string[] shipperID       = GetIdFromNameIfPresent(Shipper, _NameLookup)?.ToArray();
            string[] channelID       = GetIdFromNameIfPresent(Channel, _ChannelLookup)?.ToArray();


            orderDictionary.AddIfNotNull(OrderIDKey, OrderID.ToString());
            orderDictionary.AddIfNotNull(DescriptionKey, Description);
            orderDictionary.AddIfNotNull(NotesKey, Notes);
            orderDictionary.AddIfNotNull(OrderNoteKey, OrderNote);
            orderDictionary.AddIfNotNull(CustomerKey, CustomerEmail);
            orderDictionary.AddIfNotNull(TotalPaymentKey, TotalPrice);
            orderDictionary.AddIfNotNull(ActualShippingKey, ShippingCost);
            orderDictionary.AddIfNotNull(SalesTaxKey, SalesTax);
            orderDictionary.AddIfNotNull(ShippingChargeKey, ShippingCharge);
            orderDictionary.AddIfNotNull(MaterialCostKey, MaterialCost);
            if (DueDate.Year > 2010)
            {
                orderDictionary.AddIfNotNull(DueDateKey, DueDate.ToString("d"));
            }
            if (ShipDate.Year > 2010)
            {
                orderDictionary.AddIfNotNull(ShippedDateKey, ShipDate.ToString("d"));
            }
            orderDictionary.AddIfNotNull(RushKey, Rush);
            orderDictionary.AddIfNotNull(PrintOperatorKey, printOperatorID);
            orderDictionary.AddIfNotNull(ShipperKey, shipperID);
            orderDictionary.AddIfNotNull(ShipperPayKey, ShipperPay);
            orderDictionary.AddIfNotNull(ChannelKey, channelID);
            orderDictionary.AddIfNotNull(AsanaTaskIDKey, AsanaTaskID);
            orderDictionary.AddIfNotNull(OptinSentTypeKey, OptinSentType);
            orderDictionary.AddIfNotNull(ValueOfInventoryKey, ValueOfInventory);
            orderDictionary.AddIfNotNull(AmountRefundedKey, AmountRefunded);

            return(orderDictionary);
        }
Пример #9
0
 public override int CompareTo(Truck other)
 {
     return(this.Id.CompareTo(other.Id) + this.ManifestId.CompareTo(other.ManifestId) +
            TruckCode.CompareTo(other.TruckCode) + ShipDate.CompareTo(other.ShipDate));
 }
Пример #10
0
        public string BuildXml()
        {
            string result = string.Empty;

            StringWriter  sw = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
            XmlTextWriter xw = new XmlTextWriter(sw);

            xw.Formatting  = Formatting.Indented;
            xw.Indentation = 2;

            xw.WriteStartDocument();

            //Preamble
            xw.WriteStartElement("FDXRateRequest");
            xw.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            xw.WriteAttributeString("xsi:noNamespaceSchemaLocation", "FDXRateRequest.xsd");

            RequestHeader.WriteToXml(xw, "RequestHeader");
            xw.WriteElementString("ReturnShipmentIndicator", ReturnType.ToString());
            xw.WriteElementString("ShipDate", ShipDate.ToString("yyyy-MM-dd"));
            xw.WriteElementString("DropoffType", this.globals.DefaultDropOffType.ToString());
            xw.WriteElementString("Service", Service.ToString());
            xw.WriteElementString("Packaging", Packaging.ToString());
            xw.WriteElementString("WeightUnits", WeightUnits.ToString());
            xw.WriteElementString("Weight", _Weight.ToString("0.0"));
            xw.WriteElementString("ListRate", globals.UseListRates ? "1" : "0");

            OriginAddress.WriteToXml(xw, "OriginAddress");
            DestinationAddress.WriteToXml(xw, "DestinationAddress");

            xw.WriteStartElement("Payment");
            xw.WriteElementString("PayorType", "SENDER");
            xw.WriteEndElement();

            if (Packaging == PackageType.YOURPACKAGING)
            {
                Dimensions.WriteToXml(xw, "Dimensions");
            }

            xw.WriteStartElement("DeclaredValue");
            xw.WriteElementString("Value", _DeclaredValue.ToString("0.00"));
            xw.WriteElementString("CurrencyCode", "USD");
            xw.WriteEndElement();

            if (ContainsAlcohol)
            {
                xw.WriteElementString("Alcohol", "1");
            }
            SpecialServices.WriteToXml(xw, "SpecialServices");
            xw.WriteElementString("PackageCount", PackageCount.ToString());

            //_RequestContact.WriteToXml(xw, "Contact")
            //_RequestAddress.WriteToXml(xw, "Address")

            xw.WriteEndDocument();

            xw.Flush();
            xw.Close();

            result = sw.GetStringBuilder().ToString();

            return(result);
        }