Exemplo n.º 1
0
        private void RefreshUserListView(GetUsersResult _data)
        {
            InitUserListView();
            if (_data != null && _data.mResult.mErrCode == 0)
            {
                mCurrUsers = _data.mUsers.ToList();
                foreach (var user in mCurrUsers)
                {
                    string[] dataItem = new string[2];
                    dataItem[0] = user.mId.ToString();
                    dataItem[1] = user.mName;
                    TreeNode item = new TreeNode("Id = " + dataItem[0] +
                                                 "  |    |  " + dataItem[1]);
                    item.Tag = user;

                    foreach (var group in user.Groups)
                    {
                        TreeNode subNode = new TreeNode(group.mName);
                        subNode.Tag = group;
                        item.Nodes.Add(subNode);
                    }

                    userTreeView.Nodes.Add(item);
                }
            }
        }
    private void OnGetUsersComplete(List <User> userList, GetUsersResult _result)
    {
        loadingWheel.SetActive(false);
        if (_result == GetUsersResult.Successfull)
        {
            RectTransform rt = Content.gameObject.GetComponent <RectTransform>();
            rt.sizeDelta = new Vector2(0, userList.Count * 55);

            userList     = userList.OrderByDescending(x => x.levelNumber).ToList();
            tempElements = new LeaderboardElement[userList.Count];
            foreach (User user in userList)
            {
                LeaderboardElement tempLeaderboardElement = Instantiate(leaderboardElement);
                tempLeaderboardElement.transform.SetParent(Content);
                tempLeaderboardElement.transform.LeanScale(new Vector3(1, 1, 1), 0f);
                tempElements[userList.IndexOf(user)] = tempLeaderboardElement;

                tempLeaderboardElement.LeaderboardElementSetup((userList.IndexOf(user) + 1), user.username, user.levelNumber);
            }
        }
        else
        {
            DisplayErrorMessage("Error, try again");
        }
    }
Exemplo n.º 3
0
        internal static async Task GetUsersAsync()
        {
            // [START bulk_get_users]
            GetUsersResult result = await FirebaseAuth.DefaultInstance.GetUsersAsync(
                new List <UserIdentifier>
            {
                new UidIdentifier("uid1"),
                new EmailIdentifier("*****@*****.**"),
                new PhoneIdentifier("+15555550003"),
                new ProviderIdentifier("google.com", "google_uid4"),
            });

            Console.WriteLine("Successfully fetched user data:");
            foreach (UserRecord user in result.Users)
            {
                Console.WriteLine($"User: {user.Uid}");
            }

            Console.WriteLine("Unable to find users corresponding to these identifiers:");
            foreach (UserIdentifier uid in result.NotFound)
            {
                Console.WriteLine($"{uid}");
            }

            // [END bulk_get_users]
        }
Exemplo n.º 4
0
        public async Task DeleteUsers()
        {
            UserRecord user1 = await NewUserWithParamsAsync();

            UserRecord user2 = await NewUserWithParamsAsync();

            UserRecord user3 = await NewUserWithParamsAsync();

            DeleteUsersResult deleteUsersResult = await this.SlowDeleteUsersAsync(
                new List <string> {
                user1.Uid, user2.Uid, user3.Uid
            });

            Assert.Equal(3, deleteUsersResult.SuccessCount);
            Assert.Equal(0, deleteUsersResult.FailureCount);
            Assert.Empty(deleteUsersResult.Errors);

            GetUsersResult getUsersResult = await FirebaseAuth.DefaultInstance.GetUsersAsync(
                new List <UserIdentifier>
            {
                new UidIdentifier(user1.Uid),
                new UidIdentifier(user2.Uid),
                new UidIdentifier(user3.Uid),
            });

            Assert.Empty(getUsersResult.Users);
            Assert.Equal(3, getUsersResult.NotFound.Count());
        }
Exemplo n.º 5
0
        public async Task <GetUsersResult> Handle()
        {
            ICollection <User> users = await _userRepository.GetUsers();

            GetUsersResult result = new GetUsersResult(users.Select(Map).ToList());

            return(result);
        }
Exemplo n.º 6
0
        public async Task <ActionResult <GetUsers.Response> > Get()
        {
            GetUsersResult getUsersResult = await _getUsersHandler.Handle();

            GetUsers.Response response = new GetUsers.Response(
                getUsersResult
                .Select(t => GetUsers.Response.Item.FromDto(t))
                .ToList()
                );

            return(Ok(response));
        }
        public ManagerResponse <GetUsersResult, IList <CommerceUser> > GetUsers(
            UserSearchCriteria userSearchCriteria)
        {
            var            getUsersRequest       = new GetUsersRequest(userSearchCriteria);
            GetUsersResult serviceProviderResult = this.customerServiceProvider.GetUsers(getUsersRequest);

            if (!serviceProviderResult.Success)
            {
                return(new ManagerResponse <GetUsersResult, IList <CommerceUser> >(serviceProviderResult, new List <CommerceUser>()));
            }

            return(new ManagerResponse <GetUsersResult, IList <CommerceUser> >(serviceProviderResult, serviceProviderResult.CommerceUsers));
        }
Exemplo n.º 8
0
        public Task <GetUsersResult> ExecuteAsync(CancellationToken cancellationToken = default)
        {
            var data = new List <User>
            {
                new User
                {
                    Id             = Guid.Parse("77a33260-0001-441f-ba60-b0a833803fab"),
                    Gender         = GenderType.Female,
                    FirstName      = "Hallo1",
                    LastName       = "Hallo11",
                    Email          = "*****@*****.**",
                    Color          = ColorType.Red,
                    HomeAddress    = new Address(),
                    CompanyAddress = new Address(),
                },
                new User
                {
                    Id             = Guid.Parse("77a33260-0002-441f-ba60-b0a833803fab"),
                    Gender         = GenderType.Female,
                    FirstName      = "Hallo2",
                    LastName       = "Hallo21",
                    Email          = "*****@*****.**",
                    Color          = ColorType.Red,
                    HomeAddress    = new Address(),
                    CompanyAddress = new Address(),
                },
                new User
                {
                    Id             = Guid.Parse("77a33260-0003-441f-ba60-b0a833803fab"),
                    Gender         = GenderType.Female,
                    FirstName      = "Hallo3",
                    LastName       = "Hallo31",
                    Email          = "*****@*****.**",
                    Color          = ColorType.Red,
                    HomeAddress    = new Address(),
                    CompanyAddress = new Address(),
                },
            };

            return(Task.FromResult(GetUsersResult.Ok(data)));
        }
Exemplo n.º 9
0
        /// <summary>
        /// Gets the set of users matching the specified usernames.
        /// </summary>
        /// <param name="usernames">The usernames to search for</param>
        /// <returns>The matching users.</returns>
        public async Task <IEnumerable <UserModel> > GetUsers(IEnumerable <string> usernames)
        {
            Validator.ValidateList(usernames, "usernames");

            JObject jobj = new JObject();
            JArray  jarr = new JArray();

            foreach (string username in usernames)
            {
                jarr.Add(username);
            }
            jobj["user"] = jarr;

            GetUsersResult result = await this.PostAsync <GetUsersResult>("getusers", AdvancedHttpClient.CreateContentFromObject(jobj));

            if (result != null)
            {
                return(result.users);
            }
            return(null);
        }
Exemplo n.º 10
0
        public async Task DeleteExistingAndNonExistingUsers()
        {
            UserRecord user1 = await NewUserWithParamsAsync();

            DeleteUsersResult deleteUsersResult = await this.SlowDeleteUsersAsync(
                new List <string> {
                user1.Uid, "uid-that-doesnt-exist"
            });

            Assert.Equal(2, deleteUsersResult.SuccessCount);
            Assert.Equal(0, deleteUsersResult.FailureCount);
            Assert.Empty(deleteUsersResult.Errors);

            GetUsersResult getUsersResult = await FirebaseAuth.DefaultInstance.GetUsersAsync(
                new List <UserIdentifier>
            {
                new UidIdentifier(user1.Uid),
                new UidIdentifier("uid-that-doesnt-exist"),
            });

            Assert.Empty(getUsersResult.Users);
            Assert.Equal(2, getUsersResult.NotFound.Count());
        }
        public Task <GetUsersResult> ExecuteAsync(CancellationToken cancellationToken = default)
        {
            var data = new List <User>
            {
                new User
                {
                    Id          = Guid.Parse("77a33260-0001-441f-ba60-b0a833803fab"),
                    Gender      = GenderType.Female,
                    FirstName   = "Hallo11",
                    LastName    = "Hallo12",
                    Email       = "*****@*****.**",
                    Homepage    = new Uri("http://www.dr.dk"),
                    Color       = ColorType.Red,
                    HomeAddress = new Address
                    {
                        StreetName   = "Hallo1",
                        StreetNumber = "Hallo11",
                        PostalCode   = "Hallo12",
                        CityName     = "Hallo13",
                        MyCountry    = new Country
                        {
                            Name       = "Hallo11",
                            Alpha2Code = "Ha",
                            Alpha3Code = "Hal",
                        },
                    },
                    CompanyAddress = new Address
                    {
                        StreetName   = "Hallo1",
                        StreetNumber = "Hallo11",
                        PostalCode   = "Hallo12",
                        CityName     = "Hallo13",
                        MyCountry    = new Country
                        {
                            Name       = "Hallo11",
                            Alpha2Code = "Ha",
                            Alpha3Code = "Hal",
                        },
                    },
                },
                new User
                {
                    Id          = Guid.Parse("77a33260-0002-441f-ba60-b0a833803fab"),
                    Gender      = GenderType.Female,
                    FirstName   = "Hallo21",
                    LastName    = "Hallo22",
                    Email       = "*****@*****.**",
                    Homepage    = new Uri("http://www.dr.dk"),
                    Color       = ColorType.Red,
                    HomeAddress = new Address
                    {
                        StreetName   = "Hallo2",
                        StreetNumber = "Hallo21",
                        PostalCode   = "Hallo22",
                        CityName     = "Hallo23",
                        MyCountry    = new Country
                        {
                            Name       = "Hallo21",
                            Alpha2Code = "Ha",
                            Alpha3Code = "Hal",
                        },
                    },
                    CompanyAddress = new Address
                    {
                        StreetName   = "Hallo2",
                        StreetNumber = "Hallo21",
                        PostalCode   = "Hallo22",
                        CityName     = "Hallo23",
                        MyCountry    = new Country
                        {
                            Name       = "Hallo21",
                            Alpha2Code = "Ha",
                            Alpha3Code = "Hal",
                        },
                    },
                },
                new User
                {
                    Id          = Guid.Parse("77a33260-0003-441f-ba60-b0a833803fab"),
                    Gender      = GenderType.Female,
                    FirstName   = "Hallo31",
                    LastName    = "Hallo32",
                    Email       = "*****@*****.**",
                    Homepage    = new Uri("http://www.dr.dk"),
                    Color       = ColorType.Red,
                    HomeAddress = new Address
                    {
                        StreetName   = "Hallo3",
                        StreetNumber = "Hallo31",
                        PostalCode   = "Hallo32",
                        CityName     = "Hallo33",
                        MyCountry    = new Country
                        {
                            Name       = "Hallo31",
                            Alpha2Code = "Ha",
                            Alpha3Code = "Hal",
                        },
                    },
                    CompanyAddress = new Address
                    {
                        StreetName   = "Hallo3",
                        StreetNumber = "Hallo31",
                        PostalCode   = "Hallo32",
                        CityName     = "Hallo33",
                        MyCountry    = new Country
                        {
                            Name       = "Hallo31",
                            Alpha2Code = "Ha",
                            Alpha3Code = "Hal",
                        },
                    },
                },
            };

            return(Task.FromResult(GetUsersResult.Ok(data)));
        }