public void WriteJson(ElasticJsonWriter elasticCrudJsonWriter) { elasticCrudJsonWriter.JsonWriter.WritePropertyName("order"); elasticCrudJsonWriter.JsonWriter.WriteStartObject(); JsonHelper.WriteValue(_field, _order.ToString(), elasticCrudJsonWriter); elasticCrudJsonWriter.JsonWriter.WriteEndObject(); }
public OrderProcessor(OrderEnum order, IRuleCommandFacotry ruleCommandFacotry, bool isContinueOnFail) { RuleCommandFacotry = ruleCommandFacotry ?? throw new NullReferenceException("Rule command facotry should not be null"); Order = order; IsContinueOnFail = isContinueOnFail; Console.WriteLine($"Order processor created for {Order.ToString()}"); }
private IEnumerable <IRuleCommand> GetRulesCommands() { Console.WriteLine($"Creating rules for {Order.ToString()}"); switch (Order) { case OrderEnum.Book: yield return(RuleCommandFacotry.GetRuleCommands(RuleCommandEnum.GeneratePackingSlip)); yield return(RuleCommandFacotry.GetRuleCommands(RuleCommandEnum.GenerateCommisionPayment)); break; case OrderEnum.PhysicalProduct: yield return(RuleCommandFacotry.GetRuleCommands(RuleCommandEnum.GenerateDuplicatePackingSlip)); yield return(RuleCommandFacotry.GetRuleCommands(RuleCommandEnum.GenerateCommisionPayment)); break; case OrderEnum.MemberShip: yield return(RuleCommandFacotry.GetRuleCommands(RuleCommandEnum.ActivateMembership)); yield return(RuleCommandFacotry.GetRuleCommands(RuleCommandEnum.SendMail)); break; case OrderEnum.UpgradeMemberShip: yield return(RuleCommandFacotry.GetRuleCommands(RuleCommandEnum.UpgradeMembership)); yield return(RuleCommandFacotry.GetRuleCommands(RuleCommandEnum.SendMail)); break; case OrderEnum.LearningToSki: yield return(RuleCommandFacotry.GetRuleCommands(RuleCommandEnum.AddFirsAidVideo)); break; } Console.WriteLine($"Rules created for {Order.ToString()}"); }