Exemplo n.º 1
0
        private void btnHGR_Click(object sender, EventArgs e)
        {
            try
            {
                string url = ConfigurationManager.AppSettings["httpurl"] + "/SMS/GetReport";
                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;
                }

                GetReportResult result = JsonConvert.DeserializeObject <GetReportResult>(sr);
                dgv.DataSource = result.Reports;
                MessageBox.Show(result.Result);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }