Esempio n. 1
0
        public async Task Create() {
            var user = new UserInfoDetails {
                EntityName = "Spécial_character_tést",
                UserId = Guid.NewGuid().ToString(),
                Email = "[email protected]",
                LastName = "ORION_LAST_TEST",
                Profiles = new List<Profile>()
            };

            user.Profiles.Add(new Profile {
                LoginEntityId = LoginEntityId.Representative,
                Entity = Entity.Representative,
                EntityId = 6723,
                IsUserDefault = true,
                IsInCurrentDb = true,
                AlClientId = AlClientId,
                // Only need these values in testapi.
                // Sigh.
                RoleId = 1458,
                RoleName = "Representative"
            });

            var result = await Client.Security.Users.CreateAsync(user);

            Assert.True(result.Success);
            Assert.NotNull(result.Data);
        }
Esempio n. 2
0
        public async Task <IResult <UserInfoDetails> > CreateAsync(UserInfoDetails user, bool sendEmail = false)
        {
            var request = new Request("Security/Users", Method.POST);

            request.AddParameter("application/json", JsonConvert.SerializeObject(user));
            request.AddQueryParameter("sendEmail", sendEmail.ToString());
            return(await client.ExecuteTaskAsync <UserInfoDetails>(request));
        }
Esempio n. 3
0
        public async Task <IResult <UserInfoDetails> > UpdateAsync(UserInfoDetails user)
        {
            var request = new Request("Security/Users/{id}", Method.PUT);

            request.AddUrlSegment("id", user.Id.ToString());
            request.AddParameter("application/json", JsonConvert.SerializeObject(user));

            return(await client.ExecuteTaskAsync <UserInfoDetails>(request));
        }
Esempio n. 4
0
        public static UserInfoDetails GetUserInfoDetails(string userId)
        {
            string url = XindianAppConfig.businessServiceUri + "/user/information?userId=" + userId;
            string rv  = RestCall.httpGetMethod(url);

            if (string.IsNullOrEmpty(rv))
            {
                return(null);
            }
            Result ret = Newtonsoft.Json.JsonConvert.DeserializeObject <Result>(rv);

            if (ret.resultCode == 0 && ret.data != null)
            {
                UserInfoDetails datas = Newtonsoft.Json.JsonConvert.DeserializeObject <UserInfoDetails>(ret.data.ToString());
                return(datas);
            }
            else
            {
                return(null);
            }
            //return null;
        }
Esempio n. 5
0
 public async Task <IResult <UserInfoDetails> > ResetPasswordAsync(UserInfoDetails user, bool sendEmail = false, bool newUser = false)
 {
     return(await ResetPasswordAsync(user.Id.Value, user.Password, sendEmail, newUser));
 }
Esempio n. 6
0
 public async Task <IResult> Delete(UserInfoDetails user)
 {
     return(await DeleteAsync(user.Id.Value));
 }
Esempio n. 7
0
 public async Task <IResult <UserInfoDetails> > CreateAsync(UserInfoDetails user)
 {
     return(await CreateAsync(user, false));
 }
Esempio n. 8
0
 public async Task <IResult <UserInfoDetails> > SetPasswordAsync(UserInfoDetails user)
 {
     return(await SetPasswordAsync((long)user.Id, user.Password));
 }