Example #1
0
        private async void readData()
        {
            try
            {
                c_Http.NewPostField();
                c_Http.AddPostField("id", ID);
                var postData = c_Http.GetPostField();

                var sendData = await c_Http.sendData(c_Http.url, "user", "user_show", postData);

                var jsonResponse = JObject.Parse(sendData);
                var status       = (bool)jsonResponse["status"];
                var pesan        = jsonResponse["pesan"];

                if (!status)
                {
                    await DisplayAlert("Gagal", pesan.ToString(), "OK");

                    return;
                }

                var row = jsonResponse["DataUser"][0];
                txtUsername.Text  = (string)row["username"];
                txtPassword.Text  = (string)row["password"];
                txtNama.Text      = (string)row["nama"];
                txtNotelepon.Text = (string)row["notelepon"];
            }
            catch (Exception ex)
            {
                await DisplayAlert("Gagal", ex.Message, "OK");
            }
        }
Example #2
0
        private async Task ReadData()
        {
            var katakunci = txtKataKunci.Text;

            c_Http.NewPostField();
            c_Http.AddPostField("katakunci", katakunci);
            c_Http.AddPostField("limit", "10");
            c_Http.AddPostField("page", "1");
            var postData = c_Http.GetPostField();

            var sendData = await c_Http.sendData(c_Http.url, "user", "user_list", postData);

            JObject jsonResponse = JObject.Parse(sendData);
            //Console.WriteLine(jsonResponse);

            var resDataPaging = jsonResponse["DataPaging"];
            var resDataUser   = jsonResponse["DataUser"];

            //Console.WriteLine(resDataPaging["totaldata"]);

            UserView.ItemsSource = userDatas;
            userDatas.Clear();

            foreach (var row in resDataUser)
            {
                var dataTemp = new UserData();
                dataTemp.Username = (string)row["username"];
                dataTemp.Nama     = (string)row["nama"];
                userDatas.Add(dataTemp);
            }
        }