Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder("?");
        try
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Return Receipt Page");
            int qsCount = Request.QueryString.Count;

            if (qsCount > 0 && Request.QueryString["sta"] != null && Request.QueryString["tid"] != null)
            {
                TransactionRecord tr = new TransactionRecord();

                #region parsereference
                //tr.Status = Request.QueryString["sta"].ToString().Equals("0");
                tr.Status = false;
                if (Request.QueryString["enroll"].ToString().Equals("Y"))
                {
                    if (Request.QueryString["sta"].ToString().Equals("0") && (Request.QueryString["Safecode"].ToString().Equals("Y") || Request.QueryString["Safecode"].ToString().Equals("A")))
                    {
                        tr.Status = true;
                    }
                }
                else
                {
                    if (Request.QueryString["sta"].ToString().Equals("0") && Request.QueryString["response"].ToString().Equals("M"))
                    {
                        tr.Status = true;
                    }
                }
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Web payment transaction complete. Status: " + (tr.Status ? "Success" : "Failure"));

                String   refNo     = Request.QueryString["tid"].ToString();
                string[] refTokens = refNo.Split('_');
                KoDTicketing.GTICKV.LogEntry(refTokens[0], "Payment Getaway Response: " + (tr.Status ? "Success" : "Failure"), "14", "");
                if (refTokens.Length < 2)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Response from gateway received but query string does not have information about the transaction refernece: " + refNo);
                    return;
                }

                tr.ReferenceNo = long.Parse(refTokens[0].ToString());
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Transaction reference: " + tr.ReferenceNo.ToString());

                string[] refSubTokens = refTokens[1].Split('~');
                if (refTokens.Length < 2)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Tokenization of query string did not result in enough sub tokens. --> " + refNo);
                    return;
                }

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmExBooking ID: " + refSubTokens[0]);
                tr.BookingID = long.Parse(refSubTokens[0]);

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Agent Code: " + refSubTokens[1]);
                tr.AgentCode = refSubTokens[1];
                #endregion parsereference

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Amount: " + Request.QueryString["amt"].ToString());
                tr.TotalAmount = decimal.Parse(Request.QueryString["amt"].ToString());

                if (true == tr.Status) //successful
                {
                    #region handlesuccess

                    #region parsereceipt
                    if (Request.QueryString["rec"] != null)
                    {
                        try
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Receipt: " + Request.QueryString["rec"]);
                            tr.ReceiptNo = Request.QueryString["rec"];
                        }
                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Resposne: Error parsing receipt.");
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                        }
                    }
                    #endregion parsereceipt

                    try
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEX Payment Successful. Ensuring the seats are reserved...");
                        //****** Promo code usecase start here ************
                        KODHelper objKODHelper = new KODHelper();
                        tr = objKODHelper.GetPromotionDetails(tr);
                        tr.PaymentGateway = "AMEX";
                        //****** Promo code usecase END here ************
                        TransactionBOL.Update_PaymentStatus(tr);     //Update payment status in temp transection table
                        DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);

                        if (dt.Rows.Count == 0)
                        {
                            long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                            DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                            if (dt1 != null && dt1.Rows.Count > 0 && (Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                            {
                                ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                            }
                            //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                            qstring.Append("?err=seat");
                        }
                        else
                        {
                            bool seatsBooked      = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0);
                            bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Amex [{0},{1},{2}] Seats Booked.", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo));
                            if (!alreadyProcessed)
                            {
                                if (dt.Rows[0]["PromotionCode"].ToString() == "MMT")
                                {
                                    DataTable dt1 = TransactionBOL.Select_MMTTransaction_REFIDWISE(tr.BookingID.ToString());
                                    ReceiptUtils.MMTPaymentResponse(dt.Rows[0], dt1.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "MANA")
                                {
                                    DataTable dt2 = TransactionBOL.Select_MANATransaction_REFIDWISE(tr.BookingID.ToString());
                                    ReceiptUtils.MANAPaymentResponse(dt.Rows[0], dt2.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "MCOTHERS" || dt.Rows[0]["PromotionCode"].ToString() == "MCWORLD")
                                {
                                    DataTable dt3 = TransactionBOL.Select_MCTransaction_REFIDWISE(tr.ReferenceNo.ToString());
                                    ReceiptUtils.MCPaymentResponse(dt.Rows[0], dt3.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "JHUMROOOFFER")
                                {
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Enter into jhumroo offer mail content");
                                    ReceiptUtils.JHUMROOOFFERPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                                }
                                else
                                {
                                    ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                                }
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow");
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.ReferenceNo.ToString() + "," + tr.BookingID.ToString() + "," + tr.PromotionCode.ToString());
                                SendNotificationMailForHotels(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, tr.PromotionCode.ToString());
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow");
                            }
                            qstring.Clear();
                            qstring.Append("?b=");
                            qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
                            KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "AMEX Payment successful...", "16", tr.BookingID.ToString(), tr.ReceiptNo.ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Receipt: error getting transaction details - " + ex.Message);
                        String _refNo = tr.ReferenceNo.ToString();

                        KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Amex Error Occured -- Payment Not Successful", "27", tr.ReferenceNo.ToString());
                        long BookingID = long.Parse(tr.ReferenceNo.ToString());
                        try
                        {
                            DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);

                            if (dt.Rows.Count == 0)
                            {
                                ReceiptUtils.FailurePaymentResponse();
                            }
                            else
                            {
                                ReceiptUtils.FailurePaymentResponse(dt.Rows[0]);
                            }
                            qstring.Append("?err=seat");
                        }
                        catch (Exception ex1)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error occurred processing unsuccessful payment through Amex..." + ex1.Message);
                        }
                    }
                    #endregion handlesuccess
                }
                else //failure
                {
                    #region handlefailure
                    String _refNo = tr.ReferenceNo.ToString();
                    KoDTicketing.GTICKV.LogEntry(_refNo, "Payment Not Successful", "25", tr.BookingID.ToString());
                    GTICKBOL.ON_Session_out(_refNo);
                    KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "26", tr.BookingID.ToString());
                    long      BookingID = long.Parse(tr.ReferenceNo.ToString());
                    DataTable dt        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                    if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                    {
                        ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                    }
                    qstring.Append("err=pay");
                    #endregion handlefailure
                }
            }
            else
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response from gateway received but query string does not have information about the transaction.");
                qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Exception thrown processing receipt. " + ex.Message);
            qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
        }

        Response.Redirect("~/Payment/Print-Receipt.aspx" + qstring.ToString(), false);
    }
Ejemplo n.º 2
0
    protected void HandleSuccess(ref TransactionRecord tr, ref System.Text.StringBuilder qstring)
    {
        qstring.Clear();

        #region handlesuccess
        GTICKV.LogEntry(tr.ReferenceNo.ToString(), "IDBI Payment successful...", "16", tr.BookingID.ToString(), tr.ReceiptNo.ToString());

        #region parsereceipt
        if (Request.QueryString["rec"] != null)
        {
            try
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Receipt: " + Request.QueryString["rec"]);
                tr.ReceiptNo = Request.QueryString["rec"].ToString();
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Response: Error parsing receipt.");
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
            }
        }
        #endregion parsereceipt

        try
        {
            //****** Promo code usecase start here ************
            KODHelper objKODHelper = new KODHelper();
            tr = objKODHelper.GetPromotionDetails(tr);
            tr.PaymentGateway = "IDBI";
            //****** Promo code usecase END here ************
            TransactionBOL.Update_PaymentStatus(tr);     //Update payment status in temp transection table
            DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);


            if (dt != null && dt.Rows.Count > 0)
            {
                bool seatsBooked      = (dt.Rows[0]["SeatBooked"].ToString() == "1");
                bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                if (seatsBooked)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Transaction : Seats Booked for " + tr.BookingID.ToString());
                }
                if (!alreadyProcessed)
                {
                    if (dt.Rows[0]["PromotionCode"].ToString() == "MMT")
                    {
                        DataTable dt1 = TransactionBOL.Select_MMTTransaction_REFIDWISE(tr.BookingID.ToString());
                        ReceiptUtils.MMTPaymentResponse(dt.Rows[0], dt1.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                    }
                    else if (dt.Rows[0]["PromotionCode"].ToString() == "MANA")
                    {
                        DataTable dt2 = TransactionBOL.Select_MANATransaction_REFIDWISE(tr.BookingID.ToString());
                        ReceiptUtils.MANAPaymentResponse(dt.Rows[0], dt2.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                    }
                    else if (dt.Rows[0]["PromotionCode"].ToString() == "MCOTHERS" || dt.Rows[0]["PromotionCode"].ToString() == "MCWORLD")
                    {
                        DataTable dt3 = TransactionBOL.Select_MCTransaction_REFIDWISE(tr.ReferenceNo.ToString());
                        ReceiptUtils.MCPaymentResponse(dt.Rows[0], dt3.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                    }
                    else if (dt.Rows[0]["PromotionCode"].ToString() == "JHUMROOOFFER")
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Enter into jhumroo offer mail content");
                        ReceiptUtils.JHUMROOOFFERPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                    }
                    else
                    {
                        ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                    }
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.ReferenceNo.ToString() + "," + tr.BookingID.ToString() + "," + tr.PromotionCode.ToString());
                    SendNotificationMailForHotels(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, tr.PromotionCode.ToString());
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow");
                }
                qstring.Clear();
                qstring.Append("?b=");
                qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
            }
            else
            {
                long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                DataTable dt2        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                if (dt2 != null && dt2.Rows.Count > 0 && (Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                {
                    ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt2.Rows[0], "");
                }
                //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                qstring.Append("?err=seat");
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Receipt: error getting transaction details - " + ex.Message);
            HandleFailure(tr);
            long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
            DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
            if (dt1 != null && dt1.Rows.Count > 0 && (Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
            {
                ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
            }
            qstring.Append("?err=seat");
        }
        #endregion handlesuccess
    }
Ejemplo n.º 3
0
    protected String UpdateResponse(String trackid, String reference, String result, String postdate, String auth)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder();
        try
        {
            TransactionRecord tr = new TransactionRecord();

            string IpAddress = System.Configuration.ConfigurationManager.AppSettings["KoDTicketingIPAddress"];

            #region parsereference
            //HDFC Track ID: 1000109173_1100065925-WEB

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Transaction reference: " + trackid);
            string   refNo     = trackid;
            string[] refTokens = refNo.Split(new char[] { '_', '-' });
            if (refTokens.Length < 3)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment Response: Tokenization of reference string did not result in enough sub tokens. --> " + refNo);
                return("?err=pay");
            }

            tr.ReferenceNo = long.Parse(refTokens[0]);
            tr.BookingID   = long.Parse(refTokens[1]);
            tr.AgentCode   = refTokens[2];

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("HDFC Payment Response: Reference[{0}], Booking ID [{1}], Agent Code [{2}] ", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.AgentCode));

            #endregion parsereference

            if (Request["amt"] != null)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amount: " + Request["amt"].ToString());
                tr.TotalAmount = decimal.Parse(Request["amt"].ToString());
            }

            if (Request["paymentid"] != null)
            {
                try
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: " + Request["paymentid"].ToString());
                    tr.ReceiptNo = Request["paymentid"].ToString();
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Response: Error parsing receipt.");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                }
            }

            if (result == "CAPTURED")
            {
                # region CAPTURED
                //string retURL = UpdateResponseByTranId(status, amount, transactionId);
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC payment captured.");
                try
                {
                    //****** Promo code usecase start here ************
                    KODHelper objKODHelper = new KODHelper();
                    tr = objKODHelper.GetPromotionDetails(tr);
                    tr.PaymentGateway = "HDFC";
                    //****** Promo code usecase END here ************
                    TransactionBOL.Update_PaymentStatus(tr);     //Update payment status in temp transection table
                    DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        try
                        {
                            //String dbamount = dt.Rows[0]["TotalAmount"].ToString();
                            //String dbTrackID = dt.Rows[0]["BookingID"].ToString() + "_" + dt.Rows[0]["ReferenceNo"].ToString() + "-" + dt.Rows[0]["AgentCode"].ToString();
                            ////Validating the Booking Amount and Track ID
                            //if (Request.QueryString["amt"].ToString() == dbamount && Request.QueryString["trackid"].ToString() == dbTrackID)
                            //{
                            bool seatsBooked      = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0);
                            bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                            if (seatsBooked)
                            {
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Seats booked against HDFC payment.");
                            }
                            if (!alreadyProcessed)
                            {
                                if (dt.Rows[0]["PromotionCode"].ToString() == "MMT")
                                {
                                    DataTable dt1 = TransactionBOL.Select_MMTTransaction_REFIDWISE(tr.BookingID.ToString());
                                    ReceiptUtils.MMTPaymentResponse(dt.Rows[0], dt1.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "MANA")
                                {
                                    DataTable dt2 = TransactionBOL.Select_MANATransaction_REFIDWISE(tr.BookingID.ToString());
                                    ReceiptUtils.MANAPaymentResponse(dt.Rows[0], dt2.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "MCOTHERS" || dt.Rows[0]["PromotionCode"].ToString() == "MCWORLD")
                                {
                                    DataTable dt3 = TransactionBOL.Select_MCTransaction_REFIDWISE(tr.ReferenceNo.ToString());
                                    ReceiptUtils.MCPaymentResponse(dt.Rows[0], dt3.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "JHUMROOOFFER")
                                {
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Enter into jhumroo offer mail content");
                                    ReceiptUtils.JHUMROOOFFERPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                                }
                                else
                                {
                                    ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                                }
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow");
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.ReferenceNo.ToString() + "," + tr.BookingID.ToString() + "," + tr.PromotionCode.ToString());
                                SendNotificationMailForHotels(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, tr.PromotionCode.ToString());
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow");
                            }
                            qstring.Append("?b=");
                            qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
                            GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Payment successful...", "16", tr.BookingID.ToString(), tr.ReceiptNo.ToString());
                            //}
                            //else
                            //{
                            //    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amounts mismatch customer asked to call to confirm transaction.");
                            //    ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                            //}
                        }
                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error processing receipt post booking. " + ex.Message);
                            if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                            {
                                ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                            }
                            //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                            qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                        }
                    }
                    else
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC successful booking but ask customer to call");;
                        long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                        DataTable dt2        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                        if (dt2 != null && dt2.Rows.Count > 0 && (Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                        {
                            ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt2.Rows[0], "");
                        }
                        //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                        qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                    }

                    return(qstring.ToString());
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: error getting transaction details - " + ex.Message); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                }
                //if you reach here problem occurred

                String _refNo = tr.ReferenceNo.ToString();
                KoDTicketing.GTICKV.LogEntry(_refNo, "HDFC Payment Not Successful", "25", tr.BookingID.ToString());
                GTICKBOL.ON_Session_out(_refNo);
                KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "26", tr.BookingID.ToString());
                qstring.Append("err=pay");

                KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Error Occurred -- Payment Not Successful", "27", tr.BookingID.ToString());
                long BookingID = long.Parse(tr.ReferenceNo.ToString());
                try
                {
                    DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);

                    if (dt.Rows.Count == 0)
                    {
                        ReceiptUtils.FailurePaymentResponse();
                    }
                    else
                    {
                        ReceiptUtils.FailurePaymentResponse(dt.Rows[0]);
                    }
                    qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
                    return(qstring.ToString());
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error occurred processing unsuccessful payment..." + ex.Message);
                }

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Final Call");
                Response.Redirect(IpAddress + "Payment/FinalCall.aspx" + qstring.ToString(), false);
                #endregion
            }
            else
            {
                GTICKV.LogEntry(tr.ReferenceNo.ToString(), "User Press Cancel Button", "15", tr.BookingID.ToString());
                GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Payment Not Successful", "25", tr.BookingID.ToString());
                GTICKBOL.ON_Session_out(tr.ReferenceNo.ToString());
                GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Seats Unlocked", "26", tr.BookingID.ToString());
                long      BookingID = long.Parse(tr.ReferenceNo.ToString());
                DataTable dt        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                {
                    ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                }
                qstring.Append("?err=pay");
            }
        }