Esempio n. 1
0
        private void btnHGB_Click(object sender, EventArgs e)
        {
            try
            {
                string url = ConfigurationManager.AppSettings["httpurl"] + "/SMS/GetBalance";
                IDictionary <string, string> par = new Dictionary <string, string>();
                par.Add("User", txtAccount.Text);
                par.Add("Pass", txtPassword.Text);
                string sr = (string)HTTPRequest.Post(url, par, System.Text.Encoding.UTF8);
                if (sr == "")
                {
                    MessageBox.Show("请求接口失败!");
                    return;
                }

                GetBalanceResult        result = JsonConvert.DeserializeObject <GetBalanceResult>(sr);
                List <GetBalanceResult> data   = new List <GetBalanceResult>();
                data.Add(result);
                dgv.DataSource = data;
                MessageBox.Show(result.Result);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        private void btnHGB_Click(object sender, EventArgs e)
        {
            string url  = ConfigurationManager.AppSettings["httpurl"] + "GetBalance.aspx";
            string args = "";

            args += "User="******"&Pass="******"")
            {
                MessageBox.Show("请求接口失败!");
                return;
            }

            GetBalanceResult        result = JsonConvert.DeserializeObject <GetBalanceResult>(sr);
            List <GetBalanceResult> data   = new List <GetBalanceResult>();

            data.Add(result);
            dgv.DataSource = data;
            MessageBox.Show(result.Result);
        }
Esempio n. 3
0
        private void btnWGB_Click(object sender, EventArgs e)
        {
            string url = ConfigurationManager.AppSettings["wsurl"] + "SMWebService.asmx";

            string[] args = new string[2];
            args[0] = txtAccount.Text;
            args[1] = txtPassword.Text;

            string sr = (string)WSHelper.InvokeWebService(url, "GetBalance", args);

            if (sr == "")
            {
                MessageBox.Show("请求接口失败!");
                return;
            }

            GetBalanceResult        result = JsonConvert.DeserializeObject <GetBalanceResult>(sr);
            List <GetBalanceResult> data   = new List <GetBalanceResult>();

            data.Add(result);
            dgv.DataSource = data;
            MessageBox.Show(result.Result);
        }