示例#1
0
        public async Task PostFormUrlEncodedAsync(string url, IEnumerable <KeyValuePair <string, string> > postData)
        {
            try
            {
                HttpResponseMessage response = null;
                using (var httpClient = new HttpClient(new HttpClientHandler {
                    UseProxy = false
                }))
                {
                    using (var content = new FormUrlEncodedContent(postData))
                    {
                        content.Headers.Clear();
                        content.Headers.Add("Content-Type", "application/x-www-form-urlencoded");

                        response       = httpClient.PostAsync(url, content).Result;
                        txtResult.Text = await response.Content.ReadAsStringAsync();

                        lblMessage.Text = ConfigurationManager.AppSettings["Successful"];

                        MPOP_Dashboard.MPTBillCharge mptbillcharge = new MPOP_Dashboard.MPTBillCharge();
                        DataExtract(mptbillcharge);
                        db.sp_MPOP_Dashboard_MPTBillCharge_CRUD(mptbillcharge.MPTBillChargeID, mptbillcharge.MSISDN, mptbillcharge.Amount, mptbillcharge.Result, mptbillcharge.CreatedDate, mptbillcharge.CreatedBy);
                    }
                }
            }
            catch
            {
                lblMessage.Text = ConfigurationManager.AppSettings["Unsuccessful"];
            }
        }
示例#2
0
 private void DataExtract(MPOP_Dashboard.MPTBillCharge mptbillcharge)
 {
     try
     {
         mptbillcharge.MPTBillChargeID = null;
         mptbillcharge.MSISDN          = txtMSISDNNo.Text.Trim();
         mptbillcharge.Amount          = int.Parse(txtAmount.Text);
         mptbillcharge.Result          = txtResult.Text.Trim();
         mptbillcharge.CreatedDate     = null;
         mptbillcharge.CreatedBy       = Session["username"].ToString();
     }
     catch (Exception ex)
     {
     }
 }