예제 #1
0
        /// <summary>
        /// 初始显示数据
        /// </summary>
        public async void InitializeUser()
        {
            JToken roles = await userRequest.GetRequest(Uris.BaseUrl + Uris.User + "GetRoles");

            JToken result = await userRequest.GetRequest(Uris.BaseUrl + Uris.User + "Get", new entity <long>() { id = long.Parse(ID) });

            userName.Text     = result["userName"].ToString();
            name.Text         = result["name"].ToString();
            surname.Text      = result["surname"].ToString();
            emailAddress.Text = result["emailAddress"].ToString();
            fullname.Text     = result["fullName"].ToString();
            if (result["isActive"].ToString().Equals("true"))
            {
                isActive.IsChecked = true;
            }
            else
            {
                isActive.IsChecked = false;
            }
            foreach (var item in roles["items"])
            {
                CheckBox checkBox = new CheckBox();
                checkBox.Content = item["name"];

                foreach (var i in result["roleNames"])
                {
                    if (i.ToString().ToLower().Equals(item["name"].ToString().ToLower()))
                    {
                        checkBox.IsChecked = true;
                    }
                }
                roleNames.Children.Add(checkBox);
            }
        }
예제 #2
0
        /// <summary>
        /// 初始显示数据
        /// </summary>
        public async void InitializeUser()
        {
            JToken result = await userRequest.GetRequest(Uris.BaseUrl + Uris.User + "GetRoles");

            //JToken result =await userRequest.GetRequest(Uris.BaseUrl + Uris.User + "Get", new entity<long>() { id = long.Parse(token.login_Id) });
            //userName.Text = result["username"].ToString();
            //name.Text = result["name"].ToString();
            //surname.Text = result["surname"].ToString();
            //emailAddress.Text = result["emailAddress"].ToString();
            //password.Password = result["password"].ToString();
            foreach (var item in result["items"])
            {
                //MessageBox.Show(item["name"].ToString());
                CheckBox checkBox = new CheckBox();
                checkBox.Content = item["name"].ToString();
                roleNames.Children.Add(checkBox);
            }
        }