Example #1
0
        protected void gvTm_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "TmStatusClick")
            {
                GridViewRow namingContainer = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int rowIndex = namingContainer.RowIndex;
                e.CommandArgument.ToString();
                string item_code = gvTm.Rows[rowIndex].Cells[1].Text;
                string transID = gvTm.Rows[rowIndex].Cells[4].Text;
                string f_amt = gvTm.Rows[rowIndex].Cells[5].Text; f_amt = f_amt.Replace(",", "").Substring(0, f_amt.IndexOf(".") - 1);
                int amt = Convert.ToInt32(f_amt);
                TextBox product_title_tm = (TextBox)gvTm.Rows[rowIndex].Cells[3].FindControl("txt_product_title_tm");
                ImageButton btnMakePaymentTm = (ImageButton)gvTm.Rows[rowIndex].Cells[6].FindControl("btnMakePaymentTm");
                string[] strArray = transID.Split(new char[] { '-' });
                if (product_title_tm.Text != "")
                {
                    c_app = ret.getApplicantByID(ret.getTwalletByTransID(strArray[0].Trim()).applicantID);

                    ti.item_code = item_code; Session["item_code"] = ti.item_code; Session["pc"] = ti.item_code; ti.pc = ti.item_code;
                    ti.hwalletID = strArray[2].Trim();
                    ti.amt = amt.ToString();
                    ti.transID = transID.Trim();
                    ti.fee_detailsID = strArray[1].Trim();
                    ti.product_title = product_title_tm.Text;
                    ti.xgt = "xpay";
                    ti.xmemberID = adminID;
                    ti.applicant_name = c_app.xname;
                    ti.applicant_addy = c_app.address;
                    ti.applicant_email = c_app.xemail;
                    ti.applicant_no = c_app.xmobile;
                    ti.vid = transID;
                    if (Session["Sys_ID"] != null) { agent = Session["Sys_ID"].ToString(); ti.aid = agent; ti.agent = agent; }
                    if (Session["cname"] != null) { agentname = Session["cname"].ToString(); ti.agentname = agentname; }
                    if (Session["agentemail"] != null) { agentemail = Session["agentemail"].ToString(); ti.agentemail = agentemail; }
                    if (Session["agentpnumber"] != null) { agentpnumber = Session["agentpnumber"].ToString(); ti.agentpnumber = agentpnumber; }

                    Session["Trademark_item"] = ti;

                    Response.Redirect("confirm_basket_details.aspx");
                }
            }
        }
Example #2
0
 public XObjs.Applicant getApplicantByID(string xid)
 {
     XObjs.Applicant x = new XObjs.Applicant();
     SqlConnection connection = new SqlConnection(this.ConnectXpay());
     SqlCommand command = new SqlCommand("SELECT * FROM applicant WHERE xid='" + xid + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         x.xid = reader["xid"].ToString();
         x.xname = reader["xname"].ToString();
         x.address = reader["address"].ToString();
         x.xemail = reader["xemail"].ToString();
         x.xmobile = reader["xmobile"].ToString();
     }
     reader.Close();
     return x;
 }
        protected void gvTm_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if ((Session["tm_cnt"] != null) && (Session["tm_cnt"].ToString() != ""))
            {
                tm_cnt = Convert.ToInt32(Session["tm_cnt"]);
            }
            if ((Session["lt_ri"] != null) && (Session["lt_ri"].ToString() != ""))
            {
                lt_ri = (List<XObjs.ReportItem>)Session["lt_ri"];
            }
            gvTm.DataSource = lt_ri;
            gvTm.DataBind();
            if (e.CommandName == "TmPayClick")
            {
                GridViewRow namingContainer = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int rowIndex = namingContainer.RowIndex;
                string txnref = e.CommandArgument.ToString();
                xispf = ret.getISWtransactionByTransactionID(txnref);
                if ((xispf.xid != null) && (xispf.xid != null))
                {
                    Session["xispf"] = xispf;
                    base.Response.Redirect("../xis/pd/tx/re_payment_details.aspx");
                }
            }
            if (e.CommandName == "TmReqClick")
            {
                string str2 = DateTime.Now.ToString("dd-MMM-yy HH:MM:ss");
                GridViewRow row2 = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int num2 = row2.RowIndex;
                string str3 = e.CommandArgument.ToString();
                int num = 0;
                isw_fields = ret.getISWtransactionByTransactionID(str3);
                string inputString = isw_fields.product_id + isw_fields.txn_ref + isw_fields.mackey;
                string headerValue = hash_value.GetGetSHA512String(inputString);
                isr = tx.myRedirect(check_trans_page + "?productid=" + isw_fields.product_id + "&transactionreference=" + isw_fields.txn_ref + "&amount=" + isw_fields.amount, "Hash", headerValue);
                if ((((isr.ResponseCode != "") && (isr.ResponseCode != null)) && ((isr.PaymentReference != "") && (isr.PaymentReference != null))) && ((isr.ResponseDescription != "") && (isr.ResponseDescription != null)))
                {
                    if (isw_fields.txn_ref == null)
                    {
                        isw_fields.txn_ref = "";
                    }
                    if (isw_fields.pay_ref == null)
                    {
                        isw_fields.pay_ref = "";
                    }
                    if (isw_fields.ret_ref == null)
                    {
                        isw_fields.ret_ref = "";
                    }
                    if (isr.ResponseCode == null)
                    {
                        isr.ResponseCode = "";
                    }
                    if (isr.TransactionDate == null)
                    {
                        isr.TransactionDate = "";
                    }
                    if (isr.MerchantReference == null)
                    {
                        isr.MerchantReference = "";
                    }
                    if (isr.ResponseDescription == null)
                    {
                        isr.ResponseDescription = "";
                    }
                    xstring.AppendLine("Sent Amount: " + isw_fields.amount + "\r\n Product ID: " + isw_fields.product_id + "\r\n Hash: " + headerValue + "\r\n Amount: " + isr.Amount + "\r\n CardNumber: " + isr.CardNumber + "\r\n MerchantReference: " + isr.MerchantReference + "\r\n PaymentReference: " + isr.PaymentReference + "\r\n RetrievalReferenceNumber: " + isr.RetrievalReferenceNumber + "\r\n LeadBankCbnCode: " + isr.LeadBankCbnCode + "\r\n TransactionDate: " + isr.TransactionDate + "\r\n ResponseCode: " + isr.ResponseCode + "\r\n ResponseDescription: " + isr.ResponseDescription + "\r\n Json Page: " + check_trans_page);
                    if (isw_fields.txn_ref != "")
                    {
                        docpath = base.Server.MapPath("~/") + "LiveInterLogs/Ag/" + isw_fields.txn_ref + ".txt";
                        num = x.WriteToFile(xstring.ToString(), docpath);
                    }
                    else
                    {
                        docpath = base.Server.MapPath("~/") + "LiveInterLogs/Ag/xxx.txt";
                        num = x.WriteToFile(xstring.ToString(), docpath);
                    }
                    if ((isr.ResponseCode == "") || (isr.ResponseCode == null))
                    {
                        xpay_status = "2";
                    }
                    else if (isr.ResponseCode == "00")
                    {
                        xpay_status = "1";
                    }
                    else
                    {
                        xpay_status = "3";
                    }
                    num = reg.updateInterSwitchRecords(isw_fields.txn_ref, isw_fields.pay_ref, isw_fields.ret_ref, isr.ResponseCode, isr.TransactionDate, isr.MerchantReference, isr.ResponseDescription);
                    reg.updateTwalletPaymentStatus(isw_fields.txn_ref, xpay_status);
                    reg.updateInterSwitchPostFieldsDate(isw_fields.txn_ref, str2);
                    base.Response.Redirect("./xreport_payments.aspx");
                    if (num == 0)
                    {
                    }
                }
                else
                {
                    base.Response.Redirect("./xreport_payments.aspx");
                }
            }
            if (e.CommandName == "TmDeleteClick")
            {
                GridViewRow row3 = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int num3 = row3.RowIndex;
                string transID = e.CommandArgument.ToString();
                reg.updateInterSwitchVisibleStatus(transID, "0");
                base.Response.Redirect("./xreport_payments.aspx");
            }
            if (e.CommandName == "TmDetailsClick")
            {
                GridViewRow row4 = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int num4 = row4.RowIndex;
                string str7 = e.CommandArgument.ToString();
                lt_twall = ret.getTwalletByMemberID(adminID, str7, Session["agentType"].ToString());
                //if (lt_twall.Count > 0) {  }

                if (lt_twall.Count > 0)
                {
                    isw_fields = ret.getISWtransactionByTransactionID(lt_twall[0].transID);
                    isw_fields.TransactionDate = isw_fields.TransactionDate.Substring(0, 11).Trim();

                    c_app = ret.getApplicantByID(lt_twall[0].applicantID);
                    string str8 = lt_twall[0].xpay_status;
                    lt_fdets = ret.getFee_detailsByTwalletID(lt_twall[0].xid);
                    Session["transID"] = str7;
                    Session["memberID"] = adminID;
                    show_inv = 1;
                    switch (str8)
                    {
                        case "0":
                            str8 = "PAYMENT UNCOMPLETED!!!";
                            return;

                        case "1":
                            str8 = "PAYMENT SUCCESSFUL!!!";
                            return;

                        case "2":
                            str8 = "PAYMENT PENDING!!!";
                            return;

                        case "3":
                            str8 = "PAYMENT UNSUCCESSFUL!!!";
                            break;
                    }
                }
            }
        }
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     this.xsearch = this.txt_status.Text.Trim();
     string txnref;
     if (this.xsearch.Contains("-"))
     {
         txnref = this.xsearch.Trim().Split(new char[]
         {
             '-'
         })[0];
     }
     else
     {
         txnref = this.xsearch;
     }
     this.c_twall = this.ret.getTwalletByTransIDAdminID(txnref, this.adminID, this.agentType);
     this.c_app = this.ret.getApplicantByID(this.c_twall.applicantID);
     if (this.c_twall.xid != null)
     {
         if (this.c_twall.xgt == "xpay_bk")
         {
             this.xgt_type = "Bank";
         }
         else
         {
             if (this.c_twall.xgt == "xpay_isw")
             {
                 this.xgt_type = "Inter switch";
             }
             else
             {
                 this.xgt_type = "None";
             }
         }
         if (this.c_twall.xpay_status == "1")
         {
             this.payment_status = "Paid";
         }
         else
         {
             if (this.c_twall.xpay_status == "2")
             {
                 this.payment_status = "Pending";
             }
             else
             {
                 this.payment_status = "Failed";
             }
         }
         this.Session["c_twall"] = this.c_twall;
         this.lt_fdets = this.ret.getFee_detailsByTwalletID(this.c_twall.xid);
         if (this.lt_fdets.Count > 0)
         {
             this.Session["lt_fdets"] = this.lt_fdets;
         }
         this.lt_hwall = this.ret.getHwalletByTransID(txnref);
         this.isw_fields = this.ret.getISWtransactionByTransactionID(txnref);
         this.isw_fields.TransactionDate = this.isw_fields.TransactionDate.Substring(0, 11).Trim();
         int num = 1;
         int num2 = 0;
         foreach (XObjs.Hwallet current in this.lt_hwall)
         {
             XObjs.PaymentReciept paymentReciept = new XObjs.PaymentReciept();
             XObjs.Fee_list fee_list = new XObjs.Fee_list();
             fee_list = this.ret.getFee_listByID(this.ret.getFee_detailsByID(current.fee_detailsID).fee_listID);
             paymentReciept.sn = num.ToString();
             paymentReciept.item_code = fee_list.item_code;
             paymentReciept.item_desc = fee_list.xdesc;
             int num3 = Convert.ToInt32(fee_list.init_amt) + Convert.ToInt32(fee_list.tech_amt);
             paymentReciept.amount = string.Format("{0:n}", num3);
             paymentReciept.transID = string.Concat(new string[]
             {
                 current.transID,
                 "-",
                 current.fee_detailsID,
                 "-",
                 current.xid
             });
             num2 += Convert.ToInt32(num3);
             this.lt_pr.Add(paymentReciept);
             num++;
         }
         this.total_amt = string.Format("{0:n}", (double)num2 + Math.Round(Convert.ToDouble(this.isw_fields.isw_conv_fee), 2));
         this.show_receipt = 1;
         this.show_search = 0;
         return;
     }
     this.show_receipt = 0;
     this.show_search = 1;
 }