protected override void Execute(System.Activities.CodeActivityContext context) { base.Execute(context); // Process Shipment now SplitShipments(); }
protected override void Execute(System.Activities.CodeActivityContext context) { base.Execute(context); // Check inventory ValidateItems(); }
protected override void ExecuteActivity(System.Activities.CodeActivityContext executionContext) { TraceService.Trace("Entering GetProcessPropertiesActivity"); StringBuilder sb = new StringBuilder(); sb.AppendLine("Worflow Category: " + WorkflowContext.WorkflowCategory); sb.AppendLine("The following Values were in the InputParameters:"); foreach (KeyValuePair <string, object> pair in WorkflowContext.InputParameters) { sb.AppendLine(pair.Key); } sb.AppendLine("The following Values were in the OutputParameters:"); foreach (KeyValuePair <string, object> pair in WorkflowContext.OutputParameters) { sb.AppendLine(pair.Key); } sb.AppendLine("End of GetProcessPropertiesActivity"); throw new Exception(sb.ToString()); }
protected override void DoExecute(System.Activities.CodeActivityContext context) { devlog.Debug(string.Format("Entered for '{0}'", ServiceAccount)); var myServiceAccount = ServiceAccount.Get(context); devlog.Debug(string.Format("Got for '{0}'", myServiceAccount)); Repository.Download(myServiceAccount); }
protected override void Execute(System.Activities.CodeActivityContext context) { base.Execute(context); if (CurrentOrderGroup.OrderForms.Count == 0) { return; } var orderForm = CurrentOrderGroup.OrderForms[0]; orderForm.Discounts.Clear(); orderForm.DiscountAmount = 0m; var lineItemsToRemove = new List <string>(); foreach (var lineItem in orderForm.LineItems.ToArray()) { var reward = MarketingRepository.PromotionRewards.OfType <CatalogItemReward>().FirstOrDefault(pr => pr.SkuId == lineItem.CatalogItemId); //Line items that were added as result of promotion have to be removed if (reward != null && lineItem.Discounts.Any(x => x.PromotionId == reward.PromotionId)) { orderForm.LineItems.Remove(lineItem); lineItemsToRemove.Add(lineItem.LineItemId); } else { lineItem.Discounts.Clear(); lineItem.LineItemDiscountAmount = 0m; } } foreach (var shipment in orderForm.Shipments) { shipment.Discounts.Clear(); shipment.ShippingDiscountAmount = 0m; var links = shipment.ShipmentItems.Where(link => lineItemsToRemove.Contains(link.LineItemId)).ToList(); foreach (var link in links) { shipment.ShipmentItems.Remove(link); } } //Remove usages for current orderGroup. var usages = MarketingRepository.PromotionUsages.Where(x => x.OrderGroupId == CurrentOrderGroup.OrderGroupId && x.Status != (int)PromotionUsageStatus.Used).ToList(); foreach (var promotionUsage in usages) { MarketingRepository.Remove(promotionUsage); } //Must clear them before discounts are applied. Otherwise discounts will not be applied correctly MarketingRepository.UnitOfWork.Commit(); }
protected override void Execute(System.Activities.CodeActivityContext context) { base.Execute(context); if (ServiceLocator == null) { return; } if (CurrentOrderGroup == null || CurrentOrderGroup.OrderForms.Count == 0) { return; } // get line item promotions var lineItemRecords = CalculateLineItemDiscounts(); // get cart promotions var cartRecords = CalculateCartDiscounts(); // combine all records var recordsList = new List <PromotionRecord>(lineItemRecords); recordsList.Add(cartRecords); // filter policies var allRecords = PromotionEvaluator.EvaluatePolicies(recordsList.ToArray()); //3. Apply discounts var cartSubtotalRewards = (from r in allRecords where r.Reward is CartSubtotalReward select r).ToArray(); var lineItemRewards = (from r in allRecords where r.Reward is CatalogItemReward select r).ToArray(); var shipmentRewards = (from r in allRecords where r.Reward is ShipmentReward select r).ToArray(); var lineItemDiscountTotal = ApplyCatalogItemRewards(lineItemRewards); var orderSubTotal = CurrentOrderGroup.Subtotal - lineItemDiscountTotal; //Apply order subtotal discounts ApplyOrderSubtotalReward(orderSubTotal, cartSubtotalRewards); //Apply shipment discounts ApplyShipmentReward(shipmentRewards); //Add Gifts ApplyGiftReward(null, lineItemRewards); }
protected override void Execute(System.Activities.CodeActivityContext context) { base.Execute(context); if (ServiceLocator == null) { return; } if (CurrentOrderGroup == null || CurrentOrderGroup.OrderForms.Count == 0) { return; } //Remove usages for current orderGroup var usages = MarketingRepository.PromotionUsages.Where(x => x.OrderGroupId == CurrentOrderGroup.OrderGroupId && x.Status != (int)PromotionUsageStatus.Used).ToList(); foreach (var promotionUsage in usages) { MarketingRepository.Remove(promotionUsage); } var currentUsages = new List <PromotionUsage>(); foreach (var orderForm in CurrentOrderGroup.OrderForms) { //create records for order form discounts orderForm.Discounts.ToList().ForEach(formDiscount => UpdatePromotionUsage(currentUsages, formDiscount)); //create records for line item discounts orderForm.LineItems.SelectMany(x => x.Discounts).ToList().ForEach(lineItemDiscount => UpdatePromotionUsage(currentUsages, lineItemDiscount)); //create records for shipment discounts orderForm.Shipments.SelectMany(x => x.Discounts).ToList().ForEach(shipmentDiscount => UpdatePromotionUsage(currentUsages, shipmentDiscount)); } MarketingRepository.UnitOfWork.Commit(); }
protected override void Execute(System.Activities.CodeActivityContext context) { base.Execute(context); CalculateTaxes(CurrentOrderGroup); }
protected override void Execute(System.Activities.CodeActivityContext context) { base.Execute(context); ProcessPayment(); }
public BuildMessageWriter(System.Activities.CodeActivityContext context) { _context = context; }
/// <summary> /// Returnes a new registry context when in Graywulf execution mode. /// </summary> /// <param name="activity"></param> /// <param name="activityContext"></param> /// <param name="connectionMode"></param> /// <param name="transactionMode"></param> /// <returns></returns> public Jhu.Graywulf.Registry.Context CreateContext(IGraywulfActivity activity, System.Activities.CodeActivityContext activityContext, Jhu.Graywulf.Registry.ConnectionMode connectionMode, Jhu.Graywulf.Registry.TransactionMode transactionMode) { switch (executionMode) { case Query.ExecutionMode.SingleServer: return(null); case Query.ExecutionMode.Graywulf: return(Jhu.Graywulf.Registry.ContextManager.Instance.CreateContext(activity, activityContext, connectionMode, transactionMode)); default: throw new NotImplementedException(); } }