示例#1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            string uid       = Configuration.SuvidhaUser;
            string pin       = Configuration.SuvidhaPin;
            string mobileno  = txtMobileno.Text;
            string beneName  = txtNameBene.Text;
            string accountno = txtAccountno.Text;
            string benetype  = ddBeneType.SelectedItem.ToString();
            string ifsc      = txtIfsccode.Text;

            string URL = "http://recharge.suvidhaarecharge.com/api/MoneyTransfer/AddNewBeneficiary?Username="******"&Password="******"&Mobile=" + mobileno + "&Name=" + beneName + "&AccNo=" + accountno + "&BeneType=" + benetype + "&ifsc=" + ifsc + "";

            var httpWebRequest = (HttpWebRequest)WebRequest.Create(URL);

            string postData = "http://recharge.suvidhaarecharge.com/api/MoneyTransfer/AddNewBeneficiary?Username="******"&Password="******"&Mobile=" + mobileno + "&Name=" + beneName + "&AccNo=" + accountno + "&BeneType=" + benetype + "&ifsc=" + ifsc + "";
            httpWebRequest.Method        = WebRequestMethods.Http.Post;
            httpWebRequest.ContentType   = "application/x-www-form-urlencoded";
            httpWebRequest.ContentLength = postData.Length;

            using (StreamWriter writer = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                writer.Write(postData);
            }

            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
                JavaScriptSerializer js = new JavaScriptSerializer();
                CustRegistraion      cr = js.Deserialize <CustRegistraion>(result);
                int    user_id          = cr.UserId;
                string benefictype      = cr.BeneficiaryType;
                string bankAcno         = cr.BankAccNo;
                string benename         = cr.BeneficiaryName;
                string sendermobile     = cr.SenderMobile;
                string ifsccode         = cr.IfscCode;
                string Requestno        = cr.requestNo;
                string type             = cr.Type;
                string errormsg         = cr.ErrorMsg;
                Session["OtcRef1"]  = Requestno;
                Session["Mobileno"] = sendermobile;

                string rtId = GetApiTIDByMobile(sendermobile);

                if (errormsg != null)
                {
                    lblMessage.ForeColor = Color.Red;
                    lblMessage.Text      = errormsg;
                }
                else
                {
                    lblMessage.ForeColor = Color.Green;
                    lblMessage.Text      = "OTP send on mobile";

                    obj_wallet.UpdateAPIaddnewBeneficiary(user_id, benefictype, accountno, benename, sendermobile, ifsccode, Requestno, type, rtId);
                }
                txtMobileno.Text         = "";
                txtAccountno.Text        = "";
                txtIfsccode.Text         = "";
                txtNameBene.Text         = "";
                ddBeneType.SelectedIndex = 0;
            }
        }
        catch
        { }
    }