Esempio n. 1
0
        private void ExecutePersonFaceCreation()
        {
            WriteLine("\n\tYou have selected the option for adding a face data to a person.");
            WriteLine("\t\t* Valid image size is from 1KB to 6MB.");

            var validators = new Validators();

            Write("\n\n\tEnter the person group for which you would like to add the face data to: ");
            string personGroupId = ReadLine();

            validators.PersonGroup(personGroupId);

            Write("\n\n\tEnter the ID of the person for which you would like to add the face data to: ");
            string personId = ReadLine();

            validators.Id(personId);

            Write("\n\n\tEnter the file path of the image that you would like to add to {0}: ", personId);
            string imagePath = ReadLine();

            validators.ImagePath(imagePath);

            _taskList.Add(Task.Factory.StartNew(() =>
            {
                try
                {
                    var result = _personLogic.AddFace(personGroupId,
                                                      personId,
                                                      imagePath);
                    WriteLine("\t" + result.Message);

                    var persistedFace = (PersistedFaceDto)result.Data;

                    if (persistedFace != null)
                    {
                        WriteLine("\tPersisted Face ID: " + persistedFace.PersistedFaceId);
                    }
                }

                catch (Exception exception)
                {
                    WriteLine($"\n\tError Message: { exception.Message }");
                    WriteLine($"\n\tInner Exception: { exception.InnerException }");
                    WriteLine($"\n\tStackTrace: { exception.StackTrace }");
                    ReadLine();
                }
            }));
        }