public static TimeSpan DetermineMst(Action action) { var mst = Convert.ToDouble(action.Properties.FixedMst); return(TimeSpan.FromMinutes(mst)); }
private ConsignmentData CreateDropOffData(Action consignment) { var consignmentData = new ConsignmentData() { IntegrationKey = Utils.RemoveIllegalChars(consignment.ActionId), Reference = Utils.RemoveIllegalChars(consignment.ActionReference), ConsigneeEntityIntegrationKey = Utils.RemoveIllegalChars(consignment.ConsigneeID), ConsignorEntityIntegrationKey = "Teljoy", AccessGroups = new List <string>(), Dropoffs = new List <DropoffData>() { new DropoffData() { EntityContactIntegrationKeys = _entityContactIntegrationKeys.First(x => x.Key.Equals(consignment.ConsigneeID)).Value, Reference = Utils.RemoveIllegalChars(consignment.ActionReference), InternalReference = consignment.ActionInternalReferemce, MaximumServiceTime = Utils.DetermineMst(consignment), ExpectedCompletionDate = DateTime.Parse(consignment.Dates.DueAt).ToUniversalTime(), EntityIntegrationKey = Utils.RemoveIllegalChars(consignment.ConsigneeID), ShippingAddressIntegrationKey = Utils.RemoveIllegalChars(consignment.ConsigneeID), IntegrationKey = Utils.RemoveIllegalChars(consignment.ActionId), DueAt = DateTime.Parse(consignment.Dates.DueAt).ToUniversalTime(), TimerType = "Up", HandlingUnits = CreateConsignmentHandlingUnitsData(consignment.Products), SpecialInstructions = consignment.SpecialInstructions, Financial = new FinancialData() { AmountExcl = Convert.ToDecimal(consignment.Properties.AmountExcl), AmountIncl = Convert.ToDecimal(consignment.Properties.AmountIncl) }, Dimensions = new DimensionsData() { Volume = new VolumesData() { Volume = (decimal)consignment.Properties.Volume }, VolumetricMass = (decimal)consignment.Properties.Volume, Pieces = consignment.Properties.Units, Pallets = (decimal)consignment.Properties.Pallets, Weight = (decimal)consignment.Properties.Pallets }, Requirements = new RequirementsData() { SuccessSequence = new List <string> { "odometer", "actiondebrief", "signature", "image", "servicerating" }, FailureSequence = new List <string> { "odometer", "image" }, OdometerReadings = new List <OdometerReadingData> { new OdometerReadingData { IntegrationKey = "odometer", AssetIntegrationKey = null, AssetType = "Vehicle", Validate = false, Label = "Opening Odometer", IsOptional = false, AutoPopulateAsset = false } }, //HandlingUnitDebriefs = new List<HandlingUnitDebriefData> //{ // new HandlingUnitDebriefData // { // IntegrationKey = "HUD", // Label = "Handling unit Debrief" // } //}, ActionDebriefs = new List <ActionDebriefData> { new ActionDebriefData { IntegrationKey = "actiondebrief", Label = "Action Debrief", AllowPartialFailure = true } }, Signatures = new List <SignatureData>() { new SignatureData() { IntegrationKey = "signature", Label = "Signature", IsOptional = false } }, Images = new List <ImageData>() { new ImageData() { IntegrationKey = "image", MaxImages = 3, Label = "Photo of service", IsOptional = false } }, ServiceRatings = new List <ServiceRatingData>() { new ServiceRatingData() { IntegrationKey = "servicerating", Type = "star", Label = "Service Rating", IsOptional = false } } } } }, }; return(consignmentData); }