コード例 #1
0
        public IActionResult AddEmployee([FromBody] EmployeeDto employee)
        {
            ulong accountId = ulong.Parse(User.Identity.Name, CultureInfo.InvariantCulture);

            byte[] assetId = _assetsService.GenerateAssetId(AttributeType.IdCard, employee.RawRootAttribute);

            employee.EmployeeId = _dataAccessService.AddSpEmployee(accountId, employee.Description, employee.RawRootAttribute, assetId.ToHexString(), employee.GroupId);
            employee.AssetId    = assetId.ToHexString();

            return(Ok(employee));
        }
コード例 #2
0
        private void SetupServiceProviders(ScenarioDefinition scenarioDefinition, long scenarioSessionId)
        {
            foreach (var scenarioAccount in scenarioDefinition.Setup.Accounts.Where(a => a.AccountType == AccountType.ServiceProvider))
            {
                long accountId = _accountsService.Create(AccountType.ServiceProvider, scenarioAccount.AccountInfo, "qqq", true);
                _dataAccessService.AddScenarionSessionAccount(scenarioSessionId, accountId);
                AccountDescriptor accountDescriptor = _accountsService.Authenticate(accountId, "qqq");
                _executionContextManager.InitializeStateExecutionServices(accountId, accountDescriptor.SecretSpendKey);

                if (scenarioAccount.RelationGroups != null)
                {
                    foreach (var scenarioRelationGroup in scenarioAccount.RelationGroups)
                    {
                        long groupId = _dataAccessService.AddSpEmployeeGroup(accountId, scenarioRelationGroup.GroupName);

                        foreach (var scenarioRelation in scenarioRelationGroup.Relations)
                        {
                            _dataAccessService.AddSpEmployee(accountId, "", scenarioRelation.RootAttribute, groupId);
                        }
                    }
                }
            }
        }
コード例 #3
0
        public IActionResult AddEmployee(long accountId, [FromBody] EmployeeDto employee)
        {
            employee.EmployeeId = _dataAccessService.AddSpEmployee(accountId, employee.Description, employee.RawRootAttribute, employee.GroupId);

            return(Ok(employee));
        }