Esempio n. 1
0
        /// <summary>
        /// get the user's infomation
        /// </summary>
        /// <param name="uName">the name of the user</param>
        private async void GetPersonalInfo(string uName)
        {
            //get the domain of the web request
            string domain = this.GetString(Resource.String.domain);
            string url    = domain + "user/getuserinfo";

            IDictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("uName", uName);

            var result = await EasyWebRequest.SendGetHttpRequestBaseOnHttpWebRequest(url, dic);

            var data = (JsonObject)result;

            if (data["Code"] == "0000")//success
            {
                string     user = data["Data"].ToString();
                JsonObject jo   = JsonObject.Parse(user) as JsonObject;

                etEmail.Text  = jo["UserEmail"];
                etName.Text   = jo["UserName"];
                tvGender.Text = jo["UserGender"];
            }
            else//fault
            {
                etEmail.Text  = "";
                etName.Text   = "";
                tvGender.Text = "";
            }
        }
Esempio n. 2
0
        private async void GetRequestByHWR(object sender, EventArgs e)
        {
            string url = "http://192.168.1.102:8077/User/GetThing";
            IDictionary <string, string> routeParames = new Dictionary <string, string>();

            routeParames.Add("str", this.txtInput.Text);
            var result = await EasyWebRequest.SendGetHttpRequestBaseOnHttpWebRequest(url, routeParames);

            var data = (JsonObject)result;

            this.tv.Text = "hey," + data["Val"] + ",  i am from httpwebrequest get";
        }
Esempio n. 3
0
        /// <summary>
        /// get the detials
        /// </summary>
        /// <param name="uName">the name of the user</param>
        /// <returns></returns>
        private async Task <JsonObject> GetMoneyDetial(string uName)
        {
            string domain = this.Activity.GetString(Resource.String.domain);
            string url    = domain + "money/getmoneydetial";
            IDictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("uName", uName);
            var result = await EasyWebRequest.SendGetHttpRequestBaseOnHttpWebRequest(url, dic);

            var data = (JsonObject)result;

            if (data["Code"] == "0000")
            {
                return(data);
            }
            else
            {
                return(new JsonObject());
            }
        }
Esempio n. 4
0
        /// <summary>
        /// request the categories
        /// </summary>
        /// <returns></returns>
        private async Task <JsonObject> GetCategory()
        {
            string domain = this.Activity.GetString(Resource.String.domain);
            string url    = domain + "category/getallcategory";
            IDictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("1", "1");
            var result = await EasyWebRequest.SendGetHttpRequestBaseOnHttpWebRequest(url, dic);

            var data = (JsonObject)result;

            if (data["Code"] == "0000")
            {
                return(data);
            }
            else
            {
                return(new JsonObject());
            }
        }
Esempio n. 5
0
        /// <summary>
        /// get the summary data
        /// </summary>
        /// <param name="uName">the name of the user</param>
        private async void GetSummaryDate(string uName)
        {
            string domain = this.Activity.GetString(Resource.String.domain);
            string url    = domain + "money/gettotalinfo";
            IDictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("uname", string.IsNullOrEmpty(uName) ? "" : uName);
            var result = await EasyWebRequest.SendGetHttpRequestBaseOnHttpWebRequest(url, dic);

            var data = (JsonObject)result;

            if (data["Code"] == "0000")
            {
                tvIncome.Text = "Your total income is гд " + data["Income"].ToString();
                tvPay.Text    = "Your total pay is гд " + data["Pay"].ToString();
            }
            else
            {
            }
        }