Ejemplo n.º 1
0
 private void UpdateProfile(Profile profile)
 {
     if (profile != null)
     {
         DateOfBirth         = GuestControllerUtils.ParseDateTime(logger, profile.dateOfBirth);
         AgeBandKey          = profile.ageBand;
         AgeBandAssumed      = profile.ageBandAssumed;
         Email               = profile.email;
         EmailVerified       = profile.emailVerified;
         FirstName           = profile.firstName;
         LastName            = profile.lastName;
         MiddleName          = profile.middleName;
         ParentEmail         = profile.parentEmail;
         ParentEmailVerified = profile.parentEmailVerified;
         Username            = profile.username;
         LanguagePreference  = profile.languagePreference;
         CountryCode         = GuestControllerUtils.GetCountryCode(profile);
         AccountStatus       = AccountStatusFactory.Create(profile.status);
         IsAdultVerified     = profile.isAdultVerified;
     }
 }
Ejemplo n.º 2
0
 private static void HandleGetUsersByIdSuccess(AbstractLogger logger, GetUsersResponse response, IList <Profile> profiles, Action <LinkedUser[]> callback)
 {
     try
     {
         if (response.Users == null)
         {
             logger.Critical("Returned users array is null");
             callback(null);
             return;
         }
         Dictionary <Profile, User> profileToUser = new Dictionary <Profile, User>();
         foreach (Profile profile2 in profiles)
         {
             List <User>       users     = response.Users;
             Func <User, bool> predicate = (User u) => profile2.swid == u.UserId;
             User user = users.FirstOrDefault(predicate);
             if (user == null)
             {
                 logger.Critical("Returned users doesn't have " + profile2.swid + ": " + response.Users);
                 callback(null);
                 return;
             }
             profileToUser[profile2] = user;
         }
         LinkedUser[] obj = profiles.Select(delegate(Profile profile)
         {
             DateTime?dateOfBirth    = GuestControllerUtils.ParseDateTime(logger, profile.dateOfBirth);
             AgeBandType ageBand     = AgeBandTypeConverter.Convert(profile.ageBand);
             User user2              = profileToUser[profile];
             DisplayName displayName = new DisplayName(user2.DisplayName);
             return(new LinkedUser(profile.username, profile.firstName, profile.lastName, displayName, profile.email, profile.parentEmail, ageBand, dateOfBirth, profile.swid));
         }).ToArray();
         callback(obj);
     }
     catch (Exception ex)
     {
         logger.Critical("Unhandled exception: " + ex);
         callback(null);
     }
 }