protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string InvoiceID        = Request.QueryString["InvoiceID"];
        string PT_CustomerName  = Request.QueryString["PT_CustomerName"];
        string PT_PaymentAmount = Request.QueryString["PT_PaymentAmount"];
        string PT_ReturnUrl     = Request.QueryString["PT_ReturnUrl"];

        string DB = null;

        if (Request.QueryString["id"] != null)
        {
            Tuple <string, int> formParams = GetFormParams(false);

            Invoice invoice = InvoiceDB.GetByID(formParams.Item2, formParams.Item1);
            if (invoice == null)
            {
                HideTableAndSetErrorMessage("Invalid invoice ID");
                return;
            }
            InvoiceID = invoice.InvoiceID.ToString();
            DB        = formParams.Item1;
        }
        else
        {
            DB = Session["DB"].ToString();
        }


        int paymentPendingID = PaymentPendingDB.Insert(DB, Convert.ToInt32(InvoiceID), Convert.ToDecimal(PT_PaymentAmount), PT_CustomerName);

        string url = ConfigurationManager.AppSettings["EziDebit_URL"] + "/Payment.aspx" +
                     "?PT_DigitalKey=" + SystemVariableDB.GetAll(DB)["EziDebit_DigitalKey"].Value +
                     "&PT_PaymentReference=" + paymentPendingID +
                     "&PT_CustomerName=" + PT_CustomerName +
                     "&PT_PaymentAmount=" + PT_PaymentAmount +
                     "&PT_ReturnURL=" + PT_ReturnUrl;

        Response.Redirect(url);
    }