예제 #1
0
        public void Create(UserRegistration user)
        {
            log.Debug("Performing Create on User '" + user.Uuid + "'");

            ValidateAndEnforceCasing(user);

            try
            {
                var addressRefs = ImportAddresses(user);

                // create person object
                string personUuid = null;
                ServiceHelper.UpdatePerson(user, null, out personUuid);

                // create the position
                ServiceHelper.UpdatePosition(user);

                // create User object
                brugerStub.Importer(MapRegistrationToUserDTO(user, addressRefs, personUuid));

                log.Debug("Create successful on User '" + user.Uuid + "'");
            }
            catch (Exception ex) when(ex is STSNotFoundException || ex is ServiceNotFoundException)
            {
                log.Warn("Create on UserService failed for '" + user.Uuid + "' due to unavailable KOMBIT services", ex);
                throw new TemporaryFailureException(ex.Message);
            }
        }
예제 #2
0
        public void Create(UserRegistration user)
        {
            log.Debug("Performing Create on User '" + user.Uuid + "'");

            ValidateAndEnforceCasing(user);

            try
            {
                string uuid = null;

                // create addresses
                ServiceHelper.ImportAddress(user.Phone, user.Timestamp, out uuid);
                if (uuid != null)
                {
                    user.Phone.Uuid = uuid;
                }

                ServiceHelper.ImportAddress(user.Email, user.Timestamp, out uuid);
                if (uuid != null)
                {
                    user.Email.Uuid = uuid;
                }

                ServiceHelper.ImportAddress(user.Location, user.Timestamp, out uuid);
                if (uuid != null)
                {
                    user.Location.Uuid = uuid;
                }

                // create person object
                ServiceHelper.UpdatePerson(user, null);

                // create the position
                ServiceHelper.UpdatePosition(user);

                // create User object
                brugerStub.Importer(MapRegistrationToUserDTO(user));

                log.Debug("Create successful on User '" + user.Uuid + "'");
            }
            catch (Exception ex) when(ex is STSNotFoundException || ex is ServiceNotFoundException)
            {
                log.Warn("Create on UserService failed for '" + user.Uuid + "' due to unavailable KOMBIT services", ex);
                throw new TemporaryFailureException(ex.Message);
            }
        }