public DataToSend Processing(DataToSend inputData)
        {
            ISocketService  socketService   = new SocketService();
            DataToSend      outputData      = new DataToSend();
            LoginMap        loginMap        = new LoginMap();
            DeviceMap       deviceMap       = new DeviceMap();
            AccountMap      accountMap      = new AccountMap();
            RegistrationMap registrationMap = new RegistrationMap();

            if (inputData.Action == MessageSocketData.SocketObj.Action.Login)
            {
                Console.WriteLine("Login...");
                LoginDTO   loginDTO   = loginMap.MapTo(inputData.FirstObject as LoginSocket);
                DeviceDTO  deviceDTO  = deviceMap.MapTo(inputData.SecondObject as DeviceSocket);
                AccountDTO accountDTO = new AccountDTO();
                accountDTO             = socketService.CheckUser(loginDTO, deviceDTO);
                outputData.FirstObject = accountMap.MapFrom(accountDTO);
            }
            if (inputData.Action == MessageSocketData.SocketObj.Action.Registration)
            {
                Console.WriteLine("Registration...");
                RegistrationDTO registrationDTO = registrationMap.MapTo(inputData.FirstObject as RegistrationSocket);


                bool answer = socketService.GetRegistration(registrationDTO);
                outputData.Boolean = answer;
            }


            return(outputData);
        }
 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     AccountMap.Map(modelBuilder.Entity <Account>());
     PermissionMap.Map(modelBuilder.Entity <Permission>());
     ObjectiveMap.Map(modelBuilder.Entity <Objective>());
     StatusMap.Map(modelBuilder.Entity <Status>());
 }
        public void Create_Activated()
        {
            Guid   id        = Guid.NewGuid();
            string name      = Guid.NewGuid().ToString();
            string activated = "Y";

            IDataReader stubReader = GetStubReader(id, name, activated);

            AccountMap map     = new AccountMap();
            Account    account = map.Create(stubReader);

            Assert.AreEqual(id, account.Id);
            Assert.AreEqual(name, account.Name);
            Assert.IsTrue(account.Activated);
        }
        public void Populate_Unactivated()
        {
            Guid id = Guid.NewGuid();
            string name = Guid.NewGuid().ToString();
            string activated = "N";

            IDataReader stubReader = GetStubReader(id, name, activated);

            AccountMap map = new AccountMap();
            Account account = map.Create(stubReader);

            Assert.AreEqual(id, account.Id);
            Assert.AreEqual(name, account.Name);
            Assert.IsFalse(account.Activated);
        }
        public void ProcessFrame(PXCMCapture.Sample sample)
        {
            if (this.faceData.Update().Succeeded())
            {
                var firstFace = this.faceData.QueryFaces().FirstOrDefault();

                if (firstFace != null)
                {
                    // face recognition. have we already identified?
                    if (string.IsNullOrEmpty(this.identifiedUserName))
                    {
                        var recognition = firstFace.QueryRecognition();

                        // does the camera recognise the user?
                        if (recognition.IsRegistered())
                        {
                            // ask the camera for the ID it knows the user under
                            var id = recognition.QueryUserID();

                            // map that ID to a name (stored in a local file)
                            var name = AccountMap.GetNameForId(id);

                            this.identifiedUserName = $"identified {name}";
                        }
                        else if (!string.IsNullOrEmpty(this.userNameToRegister))
                        {
                            // ask the camera to come up with an ID for this user
                            int userId = recognition.RegisterUser();

                            // store the map between their name and their id in a local file.
                            AccountMap.SetNameForIdAsync(userId, this.userNameToRegister);

                            // Write all stored faces to the local file
                            this.SaveStoredFacesToFile();

                            this.userNameToRegister = null;
                        }
                    }
                }
                else
                {
                    this.identifiedUserName = string.Empty;
                }
            }
        }
Exemple #6
0
        public async Task <VerificationResult> RecordAndVerifyUserAsync(
            string user, TimeSpan recordingTime)
        {
            VerificationResult result = null;

            Guid?accountGuid = await AccountMap.GetGuidForUserNameAsync(user);

            if (!accountGuid.HasValue)
            {
                throw new ArgumentException($"user name {user} is not recognised");
            }
            using (var recordedStream = await this.RecordSpeechToFileAsync(recordingTime))
            {
                result = await this.restClient.VerifyAsync(
                    accountGuid.Value, recordedStream);
            }
            return(result);
        }
Exemple #7
0
        public async Task <EnrollmentResult> RecordAndEnrollUserAsync(
            string user, TimeSpan recordingTime)
        {
            EnrollmentResult result = null;

            Guid?accountGuid = await AccountMap.GetGuidForUserNameAsync(user);

            if (accountGuid == null)
            {
                var profile = await this.restClient.AddVerificationProfileAsync();

                accountGuid = profile.VerificationProfileId;
                await AccountMap.SetGuidForUserNameAsync(user, accountGuid.Value);
            }
            using (var recordedStream = await this.RecordSpeechToFileAsync(recordingTime))
            {
                result = await this.restClient.EnrollAsync(accountGuid.Value, recordedStream);
            }
            return(result);
        }
 public void Constructor()
 {
     AccountMap map = new AccountMap();
 }
 public void Constructor()
 {
     AccountMap map = new AccountMap();
 }
Exemple #10
0
        public async Task <List <string> > GetUsersAsync()
        {
            var result = await AccountMap.GetUserNamesAsync();

            return(result);
        }