Ejemplo n.º 1
0
 // Find a conversational rule by Id
 public ConversationalRule FindConversationalRuleById(string id)
 {
     ConversationalRule newRule;
     try
     {
         var x = conversationalRuleTableAdapter.FindConversationalRuleById(id).ToList().First();
         newRule = new ConversationalRule(x.Id, x.Input, x.Output, x.RelatedUsersId, Utils.GetStatus(x.Status));
     }
     catch
     {
         newRule = null;
     }
     return newRule;
 }
Ejemplo n.º 2
0
 // Find conversational rules by status
 public List<ConversationalRule> FindConversationalRulesAccordingToStatus(Status status)
 {
     List<ConversationalRule> result = new List<ConversationalRule>();
     foreach(var x in conversationalRuleTableAdapter.GetAllCRulesByStatus(status.ToString()).ToList())
     {
         string id = x.Id;
         string input = x.Input;
         string output = x.Output;
         string relatedUserId = x.RelatedUsersId;
         ConversationalRule conversationalRule = new ConversationalRule(id, input, output, relatedUserId, status);
         result.Add(conversationalRule);
     }
     return result;
 }
Ejemplo n.º 3
0
        // Add a conversation rule
        public void AddNewCRule(string input, string output, string userId)
        {
            ConversationalRule rule = new ConversationalRule(Utils.CreateIdByType("ConversationalRule", dataHandler.FindLastConversationalRuleId()), Utils.IgnoreWhiteSpace(input), Utils.IgnoreWhiteSpace(output), userId, Status.Pending);

            dataHandler.AddConversationalRule(rule);
        }