// TO DO:  Combine with CreateUserForAssociate
        private UserRM CreateUserForAgent(Commands.V1.AgentRelationship.User.CreateForAgent cmd)
        {
            User user = User.Create(_users++, cmd.ContactId, IDMSSID.Create(cmd.IDMSSID), cmd.DepartmentCodeId,
                                    cmd.IsInternal, cmd.IsActive, cmd.HasEGMSAccess, cmd.DeactivationDate);

            if (_repository.UserExistsForAssociate(user, cmd.AgentId))
            {
                throw new InvalidOperationException($"User already exists for Associate {cmd.AgentId}");
            }

            _repository.AddUserForAssociate(user, cmd.AgentId);

            return(Conversions.GetUserRM(user));
        }
Пример #2
0
 public static User Create(int userId, int contactId, IDMSSID idmssid, int departmentCodeId, bool isInternal,
                           bool isActive, bool hasEGMSAccess, DateTime deactivationDate)
 {
     return(new User
     {
         Id = userId,
         ContactId = contactId,
         IDMSSID = idmssid,
         DepartmentCodeId = departmentCodeId,
         IsInternal = isInternal,
         IsActive = isActive,
         HasEGMSAccess = hasEGMSAccess,
         DeactivationDate = deactivationDate
     });
 }