Exemplo n.º 1
0
 // Find a fixed conversational rule by Id
 public FixedConversationalRule FindFixedConversationalRuleById(string id)
 {
     FixedConversationalRule newRule;
     try
     {
         var x = fixedConversationalRuleTableAdapter.FindFixedConversationalRuleById(id).ToList().First();
         newRule = new FixedConversationalRule(x.Id, x.Input, x.Output, x.RelatedUsersId, Utils.GetStatus(x.Status));
     }
     catch
     {
         newRule = null;
     }
     return newRule;
 }
Exemplo n.º 2
0
 // Find fixed conversational rules by status
 public List<FixedConversationalRule> FindFixedConversationalRulesAccordingToStatus(Status status)
 {
     List<FixedConversationalRule> result = new List<FixedConversationalRule>();
     foreach (var x in fixedConversationalRuleTableAdapter.GetAllFCRulesByStatus(status.ToString()).ToList())
     {
         string id = x.Id;
         string input = x.Input;
         string output = x.Output;
         string relatedUserId = x.RelatedUsersId;
         FixedConversationalRule conversationalRule = new FixedConversationalRule(id, input, output, relatedUserId, status);
         result.Add(conversationalRule);
     }
     return result;
 }
Exemplo n.º 3
0
        // Add a fixed conversation rule
        public void AddNewFCRule(string input, string output, string userId)
        {
            FixedConversationalRule rule = new FixedConversationalRule(Utils.CreateIdByType("FixedConversationalRule", dataHandler.FindLastFixedConversationalRuleId()), Utils.IgnoreWhiteSpace(input), Utils.IgnoreWhiteSpace(output), userId, Status.Pending);

            dataHandler.AddFixedConversationalRule(rule);
        }