Exemplo n.º 1
0
        public static StatusService getInstance()
        {
            if (statusService == null)
            {
                statusService = new StatusService();
            }

            return(statusService);
        }
Exemplo n.º 2
0
        public Conversation CreateConversation(ConversationStarter conversationStarter, Person person)
        {
            Conversation conversation = GetActiveConversationForPerson(person);

            if (conversation != null)
            {
                throw new OmniBotException(person + " already has an active conversation and cannot be started on a new one.");
            }

            DataClasses.Script script = ScriptService.GetScriptByConversationStarter(conversationStarter);

            conversation = new Conversation()
            {
                Id       = -1,
                Person   = person,
                Script   = script,
                StatusId = StatusService.getInstance().conversationStatuses[StatusType.STARTED.ToString()].Id,
                Active   = true
            };

            Context.Conversations.Add(conversation);

            return(conversation);
        }