public override void BuildJob() { // FIXME: Looks like I can definitely refactor this and work this out job.Tasks = new List<JobTask>(); // INFO: Fetching to FetchDeliveryManTask fetchDeliveryManTask = new FetchDeliveryManTask(order.From, order.To); job.Tasks.Add(fetchDeliveryManTask); fetchDeliveryManTask.AssetUpdated += JobTask_AssetUpdated; PackagePickUpTask pickUpTask = new PackagePickUpTask(order.From); pickUpTask.SetPredecessor(fetchDeliveryManTask); job.Tasks.Add(pickUpTask); pickUpTask.AssetUpdated += JobTask_AssetUpdated; DeliveryTask deliveryTask = new DeliveryTask(order.From, order.To); deliveryTask.SetPredecessor(pickUpTask); job.Tasks.Add(deliveryTask); deliveryTask.AssetUpdated += JobTask_AssetUpdated; if (order.Type == OrderTypes.ClassifiedDelivery && order.Variant == DeliveryOrderVariants.Default) { SecureDeliveryTask secureDeliveryTask = new SecureDeliveryTask(order.To, order.From); secureDeliveryTask.SetPredecessor(deliveryTask); job.Tasks.Add(secureDeliveryTask); secureDeliveryTask.AssetUpdated += JobTask_AssetUpdated; job.TerminalTask = secureDeliveryTask; } else if ( (order.Type == OrderTypes.ClassifiedDelivery && order.Variant == DeliveryOrderVariants.EnterpriseDelivery) || order.Type == OrderTypes.Delivery) { job.TerminalTask = deliveryTask; } job.PaymentMethod = this.paymentMethod.Key; job.PaymentStatus = PaymentStatus.Pending; job.EnsureJobTaskChangeEventsRegistered(); job.EnsureTaskAssetEventsAssigned(); if (order.JobTaskETAPreference?.Count > 0) SetupJobTaskETAs(order); }
public override void BuildJob() { // FIXME: Looks like I can definitely refactor this and work this out job.Tasks = new List <JobTask>(); // INFO: Fetching to FetchDeliveryManTask fetchDeliveryManTask = new FetchDeliveryManTask(order.From, order.To); job.Tasks.Add(fetchDeliveryManTask); PackagePickUpTask pickUpTask = new PackagePickUpTask(order.From); pickUpTask.SetPredecessor(fetchDeliveryManTask); job.Tasks.Add(pickUpTask); DeliveryTask deliveryTask = new DeliveryTask(order.From, order.To); deliveryTask.SetPredecessor(pickUpTask); job.Tasks.Add(deliveryTask); if (order.Type == OrderTypes.ClassifiedDelivery && order.Variant == DeliveryOrderVariants.Default) { SecureDeliveryTask secureDeliveryTask = new SecureDeliveryTask(order.To, order.From); secureDeliveryTask.SetPredecessor(deliveryTask); job.Tasks.Add(secureDeliveryTask); job.TerminalTask = secureDeliveryTask; } else if ( (order.Type == OrderTypes.ClassifiedDelivery && order.Variant == DeliveryOrderVariants.EnterpriseDelivery) || order.Type == OrderTypes.Delivery) { job.TerminalTask = deliveryTask; } job.PaymentMethod = this.paymentMethod.Key; job.PaymentStatus = PaymentStatus.Pending; job.EnsureJobTaskChangeEventsRegistered(); if (order.JobTaskETAPreference?.Count > 0) { SetupJobTaskETAs(order); } }