Exemple #1
0
        public MainBot(BotServices botServices, ConversationState conversationState, IPersonStore personStore, ILogger <MainBot> logger)
        {
            _botServices = botServices ?? throw new ArgumentNullException(nameof(BotServices));

            ConversationState = conversationState;

            _logger = logger;

            _personStore           = personStore;
            _onTurnAccessor        = conversationState.CreateProperty <OnTurnProperty>(OnTurnPropertyName);
            _personInternState     = conversationState.CreateProperty <PersonInternState>(PersonInternStateName);
            _dialogAccessor        = conversationState.CreateProperty <DialogState>(DialogStateProperty);
            _dialogStateProperties = conversationState.CreateProperty <DialogStateProperties>(DialogStateProperties);

            if (!_botServices.LuisServices.ContainsKey(BotKey))
            {
                throw new ArgumentException($"Invalid configuration. Please check your '.bot' file for a LUIS service named '{BotKey}'.");
            }

            _dialogSet = new DialogSet(_dialogAccessor);
            _dialogSet.Add(new AskSalaryWhen(_onTurnAccessor));
            _dialogSet.Add(new ChitchatDialog(_onTurnAccessor));
            _dialogSet.Add(new AskPerson(_personStore, _onTurnAccessor, _personInternState, _dialogStateProperties));
            _dialogSet.Add(new EmergencyProcedureDialog(_onTurnAccessor));
            _dialogSet.Add(new AskHolidayDayDialog(_onTurnAccessor));
            _dialogSet.Add(new LegalTreatyBetweenCountriesDialog(_onTurnAccessor));
        }
        static void Main(string[] args)
        {
            personStore = new PersonStore();
            LoadPeople();

            FamilyGraph = new FamilyGraph(personStore);
            LoadRelationships();

            FamilyRelationships = new Relationships(FamilyGraph);
            using (var reader = new StreamReader(@"InputFiles\Testcase.txt"))
            {
                while (!reader.EndOfStream)
                {
                    var input  = reader.ReadLine();
                    var values = input.Split(" ").Select(m => m.Trim()).ToList();
                    Console.WriteLine($"TestCase: {input}");
                    if (values[0] == "ADD_CHILD")
                    {
                        AddChild(values);
                    }
                    else if (values[0] == "GET_RELATIONSHIP")
                    {
                        try
                        {
                            GetRelationship(values);
                        }
                        catch (Exception) { }
                    }
                    Console.WriteLine();
                }
            }
            Console.ReadKey();
        }
 public void SetUp()
 {
     PersonStore = new PersonStore();
     george      = PersonStore.AddPerson("George", Gender.Male);
     mary        = PersonStore.AddPerson("Mary", Gender.Female);
     bob         = PersonStore.AddPerson("Bob", Gender.Male);
     sally       = PersonStore.AddPerson("Sally", Gender.Female);
     dave        = PersonStore.AddPerson("Dave", Gender.Male);
 }
Exemple #4
0
        public void SetUp()
        {
            PersonStore = new PersonStore();
            Person george = PersonStore.AddPerson("George", Gender.Male);
            Person mary   = PersonStore.AddPerson("Mary", Gender.Female);
            Person bob    = PersonStore.AddPerson("Bob", Gender.Male);
            Person sally  = PersonStore.AddPerson("Sally", Gender.Female);

            familyGraph = new FamilyGraph(PersonStore);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ContextEnricher"/> class.
        /// </summary>
        /// <param name="next">The HTTP request delegate.</param>
        /// <param name="loggerFactory">The factory used to create loggers.</param>
        /// <param name="store">The repository used to retrieve aggregate profiles.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="next"/> request delegate is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="loggerFactory"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentNullException">The profile <paramref name="store"/> is <see langword="null"/>.</exception>
        public ContextEnricher(RequestDelegate next, ILoggerFactory loggerFactory, IPersonStore store)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _next   = next ?? throw new ArgumentNullException(nameof(next));
            _store  = store ?? throw new ArgumentNullException(nameof(store));
            _logger = loggerFactory.CreateLogger <ContextEnricher>();
        }
        public ActorGraph(IPersonStore personStore)
        {
            Name = "Actor";
            Field(a => a.ActorId);
            Field(a => a.ActivityId);
            Field(a => a.ActorCriteriaId);
            Field(a => a.ActorHanfordId);
            Field(a => a.ActorType);

            FieldAsync <UserGraph>("delegatorHanfordId", "The original actor, if the actor type is delegate",
                                   resolve: async(context) => await personStore.GetByIdAsync(context.Source.DelegatorHanfordId, context.CancellationToken));
        }
Exemple #7
0
 public PersonService(
     IPersonStore personStore,
     IGroupService groupService,
     IFaceStore faceStore,
     IThumbnailBlobStore thumbnailBlob,
     IBus bus)
 {
     _personStore   = personStore;
     _groupService  = groupService;
     _faceStore     = faceStore;
     _thumbnailBlob = thumbnailBlob;
     _bus           = bus;
 }
Exemple #8
0
 public MongoMediaStore(
     MediaStoreContext mediaStoreContext,
     IThumbnailBlobStore thumbnailBlobStore,
     IMediaBlobStore blobStore,
     IFaceStore faceStore,
     IAlbumStore albumStore,
     ICameraStore cameraStore,
     IPersonStore personStore)
 {
     _mediaStoreContext = mediaStoreContext;
     Thumbnails         = thumbnailBlobStore;
     Blob    = blobStore;
     Faces   = faceStore;
     Albums  = albumStore;
     Cameras = cameraStore;
     Persons = personStore;
 }
Exemple #9
0
        public ProcessGraph(IPersonStore personStore, IActivityFacade activityFacade)
        {
            Name = "Process";
            Field(p => p.ProcessId).Description("The unique identifier assigned to this process");
            Field(p => p.ProcessDefinitionId).Description("The unique identifier assigned to process definition that created this resource");
            Field(p => p.DocumentTypeName, nullable: true).Description("The document type name of this resource");
            Field(p => p.DocumentId, nullable: true).Description("The document id of the item provided by the user or the source system");
            Field(p => p.DocumentTitle, nullable: true).Description("The title of the document");
            Field(p => p.ProcessState, nullable: true).Description("The current state of the process");
            Field(p => p.ProcessStatus, nullable: true).Description("The current status of the process");
            Field(p => p.CreateDateTime).Description("The created date of the process");
            Field(p => p.LastChangeDateTime).Description("The last changed date of the process");

            FieldAsync <UserGraph>("originatorHanfordId", "The person who routed the process",
                                   resolve: async(context) => await personStore.GetByIdAsync(context.Source.OriginatorHanfordId, context.CancellationToken));
            FieldAsync <UserGraph>("beneficiaryHanfordId", "The beneficiary of the process",
                                   resolve: async(context) => await personStore.GetByIdAsync(context.Source.BeneficiaryHanfordId, context.CancellationToken));
            FieldAsync <UserGraph>("lastChangeHanfordId", "The person who last changed the process",
                                   resolve: async(context) => await personStore.GetByIdAsync(context.Source.LastChangeHanfordId, context.CancellationToken));
            FieldAsync <ListGraphType <ActivityGraph> >(
                name: "activities",
                description: "The list of activities in this process",
                arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "offset"
                },
                new QueryArgument <IntGraphType> {
                    Name = "limit"
                }
            },
                resolve: async(context) =>
            {
                var offset = context.GetArgument <int?>("offset");
                var limit  = context.GetArgument <int?>("limit");

                var activityIds = context
                                  .Source
                                  .Activities
                                  .Values
                                  .Select(a => a.ActivityId)
                                  .ToList();

                return(await activityFacade.GetAsync(activityIds, offset, limit, context.CancellationToken));
            });
        }
        public ActivityGraph(IPersonStore personStore)
        {
            Name = "Activity";
            Field(a => a.ActivityId);
            Field(a => a.ActivityName);
            Field(a => a.PendingDateTime, nullable: true);
            Field(a => a.LastChangeDateTime);
            Field(a => a.ActivityState, nullable: true);
            Field(a => a.ActivityStatus, nullable: true);
            Field(a => a.Comment, nullable: true);
            Field(a => a.ActedActorId, nullable: true);
            Field(a => a.IsGhost);
            Field(a => a.IsAdhoc);
            //Field(a => a.Actors);

            FieldAsync <UserGraph>("actedHanfordId", "The hanford id of the person who acted on the activity",
                                   resolve: async(context) => await personStore.GetByIdAsync(context.Source.ActedHanfordId, context.CancellationToken));
        }
Exemple #11
0
        public MainWindowViewModel()
        {
            this.People = new ObservableCollection <Person>();
            var documents                 = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var dataTransferPath          = System.IO.Path.Combine(documents, "FundManager");
            var dataTransferDirectoryInfo = new DirectoryInfo(dataTransferPath);
            var log = new CompositeLog(LoggerNames.DbLoggerName);

            this.personStore = new PersonStore(dataTransferDirectoryInfo, log);

            var peopleResult = this.personStore.GetAll();

            if (peopleResult.IsOk)
            {
                peopleResult.ResultValue
                .ToList()
                .ForEach(x => this.People.Add(x));

                this.SelectedPerson = peopleResult.ResultValue.Head;
            }
        }
Exemple #12
0
        public AskPerson(
            IPersonStore personStore,
            IStatePropertyAccessor <OnTurnProperty> onTurnPropertyAccessor,
            IStatePropertyAccessor <PersonInternState> personInternStateAccessor,
            IStatePropertyAccessor <DialogStateProperties> dialogStateProperties) : base(AskPersonInternId)
        {
            _personStore               = personStore;
            _onTurnPropertyAccessor    = onTurnPropertyAccessor;
            _personInternStateAccessor = personInternStateAccessor;
            _dialogStateProperties     = dialogStateProperties;

            var steps = new WaterfallStep[]
            {
                Initialize,
                CheckFirstState,
                CheckName,
                CheckDepartment
            };

            AddDialog(new WaterfallDialog(SearchDialog, steps));
            AddDialog(new TextPrompt(AskNameDialog));
            AddDialog(new TextPrompt(AskDepartmentDialog));
        }
Exemple #13
0
 public PersonController(IPersonStore personStore = null)
 {
     _personStore = personStore ?? new PersonStore();
 }
Exemple #14
0
 public PeopleController(IPersonStore store)
 {
     _store = store ?? throw new ArgumentNullException(nameof(store));
 }
 public FamilyGraph(IPersonStore personStore)
 {
     Families    = new Dictionary <Person, PersonRelationships>();
     PersonStore = personStore;
 }
Exemple #16
0
 /// <summary>
 /// 使用用户存储初始化用户管理器。
 /// </summary>
 /// <param name="store"></param>
 /// <param name="fileStore"></param>
 public PersonManager(IPersonStore store, IFileStore fileStore)
 {
     this.Store     = store;
     this.FileStore = fileStore;
 }