Example #1
0
    protected void btnGo_Click(object sender, EventArgs e)
    {
        decimal discountamt = 0;
        TransactionRecord tr = new TransactionRecord();
        tr.BookingID = txt_BookingID.Text.Length > 0 ? long.Parse(txt_BookingID.Text) : 0;
        tr.ReceiptNo = txt_ReceiptNo.Text.Length > 0 ? txt_ReceiptNo.Text : "0";
        tr.DateOfBooking = txt_BookingDate.Text.Length > 0 ? txt_BookingDate.Text : "0";
        tr.Location = txt_bookingDateTo.Text.Length > 0 ? txt_bookingDateTo.Text : "0";
        tr.ShowDate = txt_ShowDate.Text.Length > 0 ? txt_ShowDate.Text : "0";
        tr.MobileNo = txt_ShowDateTo.Text.Length > 0 ? txt_ShowDateTo.Text : "0";
        tr.Name = txt_Name.Text.Length > 0 ? txt_Name.Text : "0";
        tr.AgentCode = ddlAgent.SelectedValue;
        DataSet ds = TransactionBOL.Select_Report_FromTransactionTable(tr);
        if (ds.Tables[0].Rows.Count > 0)
        {
            Btn_Excel.Enabled = true;
            btnPrint.Disabled = false;
            //for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            //{
            //    if (ds.Tables[0].Rows[i][10].ToString() == "")
            //    {
            //        discountamt = discountamt + decimal.Parse(dr[2].ToString());
            //    }
            //}
            gv_Report.DataSource = ds.Tables[0];
            lblMess.Text = "";


            gv_Report.DataBind();
            if (ds.Tables[1].Rows.Count > 0)
            {
                string card = "";
                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    Seats = Seats + int.Parse(dr[0].ToString());
                    totamt = totamt + decimal.Parse(dr[1].ToString());
                    if (dr[2].ToString() !="")
                    {
                        discountamt = discountamt + decimal.Parse(dr[2].ToString());
                        card += "<br/>Amount Received Using " + dr[3] + " : " + dr[2];
                    }
                    //card += "<br/>Amount Received Using " + dr[3] + " : " + dr[2];
                }
                lblTotSeats.Text = card;
            }
            gv_Report.FooterRow.Cells[0].Text = "Total";
            gv_Report.FooterRow.Cells[1].Text = Seats.ToString();
            gv_Report.FooterRow.Cells[2].Text = totamt.ToString();
            gv_Report.FooterRow.Cells[3].Text = discountamt.ToString();
        }
        else
        {
            btnPrint.Disabled = true;
            Btn_Excel.Enabled = false;
            lblMess.Text = "No Records Found!";
        }

    }
    protected void btnGo_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsPostBack)
            {
                lblMess.Text = "No Records Found!";
                gv_Failed.Dispose();
                gv_Report.Dispose();
                gv_Report.DataBind();
                gv_Failed.DataBind();
            }

            long BookingID = txt_BookingID.Text.Length > 0 ? long.Parse(txt_BookingID.Text) : 0;
            string ReceiptNo = txt_ReceiptNo.Text.Length > 0 ? txt_ReceiptNo.Text : "0";
            string Name = txt_Name.Text.Length > 0 ? txt_Name.Text : "0";
            string today = DateTime.Today.ToShortDateString();
            string daysfromtoday = DateTime.Today.Subtract(TimeSpan.FromDays(30)).ToShortDateString();
            DataSet ds = TransactionBOL.Select_Report_SearchFromTransactions_DS(BookingID, ReceiptNo, daysfromtoday, today, "0", "0", Name, "0");
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                gv_Report.DataSource = ds;
                lblMess.Text = "BOOKINGS IN LAST 30 DAYS";
                gv_Report.DataBind();
            }
            else
            {
                lblMess.Text = "NO BOOKINGS IN LAST 30 DAYS";
            }

            TransactionRecord tr = new TransactionRecord();
            tr.BookingID = txt_BookingID.Text.Length > 0 ? long.Parse(txt_BookingID.Text) : 0;
            tr.ReceiptNo = txt_ReceiptNo.Text.Length > 0 ? txt_ReceiptNo.Text : "0";
            tr.DateOfBooking = daysfromtoday;
            //location is bookingDate to
            tr.Location = today;
            tr.ShowDate = "0";  // ShowDateFrom
            tr.MobileNo = "0";  //used as ShowDateTo

            tr.Name = txt_Name.Text.Length > 0 ? txt_Name.Text : "0";
            ds = TransactionBOL.Select_Report_SearchFromTransactionsTemp_DS(tr);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                gv_Failed.DataSource = ds;
                lblMess2.Text = "FAILED TRANSACTIONS IN LAST 30 DAYS";
                gv_Failed.DataBind();
            }
            else
            {
                lblMess2.Text = "NO FAILED TRANSACTION IN LAST 30 DAYS";
            }

        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
        }
    }
    protected void btnGo_Click(object sender, EventArgs e)
    {
        int Seats = 0; decimal totamt = 0; decimal discountamt = 0;

        TransactionRecord tr = new TransactionRecord();
        tr.DateOfBooking = txt_BookingDate.Text.Length > 0 ? txt_BookingDate.Text : "0";
        tr.Location = txt_bookingDateTo.Text.Length > 0 ? txt_bookingDateTo.Text : "0";
        tr.AgentCode = ddlAgent.SelectedValue;

        DataSet ds = TransactionBOL.Hotel_Report(tr.DateOfBooking, tr.Location, tr.AgentCode);
        
        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        {
            Btn_Excel.Enabled = true;
            btnPrint.Disabled = false;
            gv_Report.DataSource = ds.Tables[0];
            lblMess.Text = "";
            
        }
        else
        {
            btnPrint.Disabled = true;
            Btn_Excel.Enabled = false;
            lblMess.Text = "No Records Found!";
        }
        gv_Report.DataBind();

        if (gv_Report.Rows.Count > 0)
        {
            foreach (GridViewRow Gr in gv_Report.Rows)
            {
                Seats = Seats + int.Parse(Gr.Cells[7].Text);
                totamt = totamt + decimal.Parse(Gr.Cells[8].Text);
                discountamt = discountamt + decimal.Parse(Gr.Cells[10].Text);
            }
            gv_Report.FooterRow.Cells[6].Text = "Total";
            gv_Report.FooterRow.Cells[7].Text = Seats.ToString();
            gv_Report.FooterRow.Cells[8].Text = totamt.ToString();
            gv_Report.FooterRow.Cells[10].Text = discountamt.ToString();
        }
    }
Example #4
0
 public static int Check_Seats_BeforeProceed(TransactionRecord _tr)
 {
     return(int.Parse(GTICKDAL._Check_Seats_BeforeProceed(_tr.BookingID, _tr.SeatInfo, _tr.Play).Rows[0][0].ToString()));
 }
Example #5
0
 public static int Check_Seats_BeforeProceed(TransactionRecord _tr)
 {
     return int.Parse(GTICKDAL._Check_Seats_BeforeProceed(_tr.BookingID, _tr.SeatInfo, _tr.Play).Rows[0][0].ToString());
 }
Example #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tr"></param>
        /// <returns></returns>
        public static DataTable _Get_Transaction_Detail(TransactionRecord tr)
        {
            SqlCommand command = new SqlCommand();
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Booking ID Response from PG " + tr.BookingID.ToString());
            DataTable chkID = TransactionBOL.Select_MarchPromotionTransactionCounter_IDWise(tr.BookingID);
            if (chkID.Rows.Count > 0)
            {
                if (chkID.Rows[0][0].ToString().Substring(0, 2) == "31")
                {
                    tr.BookingID = long.Parse(chkID.Rows[0][0].ToString());
                }

            }
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Booking ID after converting " + tr.BookingID.ToString());
            Connection.LogEntry(tr.ReferenceNo.ToString(), "Updating Navision-Booking Master Table...", "17", tr.BookingID.ToString());
            int chkdata = 0;
            int exisitng_ticket_booked_count = 0;//to check if the request is again from payment gateway
            try
            {
                ushort attempts = 0;
                do
                {
                    string[] AgentCodeTokens = tr.AgentCode.Split('-');
                    string webpromoID = string.Empty;
                    if (tr.WebPromotionId == null)
                        webpromoID = "''";
                    else
                        webpromoID = "'" + tr.WebPromotionId + "'";
                    if (AgentCodeTokens.Length == 1 && AgentCodeTokens[0] == "WEB")
                    {
                        DataTable dtGcell_count = new DataTable();

                        command.CommandText = "Select Count(1) from " + table_BookingMaster + " WITH(NOLOCK) WHERE [Lock For Booking] = 1 AND [Booked] = 1 AND" +
                                                " [Web Promotion Id] = " + webpromoID + " AND [Web Disc %] = " + tr.DiscountPercentage.ToString() + " AND [Web Booking ID] = '"
                                                + tr.BookingID.ToString() + "' AND [Payment Ref_ No_]= '" + tr.ReferenceNo.ToString() + "' AND  [Agent Code] = ''";
                        dtGcell_count = Connection.readTab(command, connWebBooking);

                        if (dtGcell_count.Rows.Count > 0)
                        {
                            exisitng_ticket_booked_count = int.Parse(dtGcell_count.Rows[0][0].ToString());
                        }
                        if (exisitng_ticket_booked_count > 0)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Payment Gateway freez case detected : [{0}]", command.CommandText));
                            chkdata = 1;
                            /*******************Payement Gateway Error Value Code**********************/
                            #region PG_DB for Payment Gateway freez case
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Payment Gateway freez case detected entry in PG_DB");
                            int j = GTICKBOL.Insert_Payment_DB("Payment Gateway freez case detected", tr.BookingID.ToString(), tr.PaymentGateway.ToString());
                            #endregion PG_DB for Payment Gateway freez case
                            /*********************End******************************/
                        }
                        command.CommandText = "Update " + table_BookingMaster + " WITH(HOLDLOCK,UPDLOCK) Set [Lock For Booking] = 1 , [Booked] = 1 ," +
                                    " [Web Promotion Id] = " + webpromoID +
                                    ", [Web Disc %] = " + tr.DiscountPercentage.ToString() +
                                    ", [Web Booking ID] = " + tr.BookingID.ToString() + " , [Payment Ref_ No_]= " + tr.ReferenceNo.ToString() + " , [Booking End Date_Time]=getutcdate()," +
                                    " [Agent Code] = '' where  [Agent Code] = '" + tr.ReferenceNo.ToString() + "'";
                    }
                    else
                    {
                        command.CommandText = "Update " + table_BookingMaster + " WITH(HOLDLOCK,UPDLOCK) Set [Lock For Booking] = 1 , [Booked] = 1 ," +
                             " [Web Promotion Id] = " + webpromoID +
                             ", [Web Disc %] = " + tr.DiscountPercentage.ToString() +
                            ", [Web Booking ID] = " + tr.BookingID.ToString() + " , [Payment Ref_ No_]= " + tr.ReferenceNo.ToString() + " , [Booking End Date_Time]=getutcdate()," +
                            " [Agent Code] = '" + AgentCodeTokens[0] + "', [Agent Sub-Code]='" +
                            AgentCodeTokens[1] + "' where  [Agent Code] = '" + tr.ReferenceNo.ToString() + "'";
                    }

                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Executing attempt {0}: [{1}]", attempts.ToString(), command.CommandText));
                    if (chkdata == 0)
                    {
                        //chkdata = Connection.EXECommand(command, connWebBooking);
                        DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(long.Parse(tr.ReferenceNo.ToString()));
                        if (chkID.Rows.Count > 0)
                        {
                            if (chkID.Rows[0][0].ToString().Substring(0, 2) == "31")
                            {
                                dt.Rows[0]["ID"] = long.Parse(chkID.Rows[0][0].ToString());
                            }

                        }
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Booking ID after converting for updating booking master " + dt.Rows[0]["ID"].ToString());
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Row Count : " + dt.Rows.Count);
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Date of booking for updating booking master:" + Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()));
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Present Date:" + Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()));
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Present Date:" + Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString()));
                        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())))
                        {
                            try
                            {
                                string WebPromotionID = dt.Rows[0]["WebPromotionId"] != null ? dt.Rows[0]["WebPromotionId"].ToString() : "";
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("WebPromotionID : " + WebPromotionID);
                                decimal TotalAmount = string.IsNullOrEmpty(dt.Rows[0]["TotalAmount"].ToString()) ? 0 : Convert.ToDecimal(dt.Rows[0]["TotalAmount"]);
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amount : " + TotalAmount);
                                string Play = dt.Rows[0]["Play"] != null ? dt.Rows[0]["Play"].ToString() : "";
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Play : " + Play);
                                string MobileNo = dt.Rows[0]["MobileNo"] != null ? dt.Rows[0]["MobileNo"].ToString() : "";
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mobile No. : " + MobileNo);
                                string BookingID = dt.Rows[0]["ID"] != null ? dt.Rows[0]["ID"].ToString() : "";
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Web Booking ID : " + BookingID);
                                string ReferenceNo = dt.Rows[0]["BookingID"] != null ? dt.Rows[0]["BookingID"].ToString() : "";
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Reference No. : " + ReferenceNo);
                                int Totalseats = string.IsNullOrEmpty(dt.Rows[0]["TotalSeats"].ToString()) ? 0 : Convert.ToInt32(dt.Rows[0]["TotalSeats"]);
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Total Seats : " + Totalseats);
                                string PaymentGateway = dt.Rows[0]["PaymentGateway"] != null ? dt.Rows[0]["PaymentGateway"].ToString() : "";
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("PG : " + PaymentGateway);
                                string AgentCode = AgentCodeTokens[0] != null ? AgentCodeTokens[0].ToString() : "";
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Agent Code : " + AgentCode);
                                string AgentCodeSubcode = string.Empty;
                                if (AgentCodeTokens.Length == 1 && AgentCodeTokens[0] == "WEB")
                                {
                                    AgentCodeSubcode = "";
                                }
                                else
                                {
                                    AgentCodeSubcode = AgentCodeTokens[1] != null ? AgentCodeTokens[1].ToString() : "";
                                }
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Agent Code Sub-code  : " + AgentCodeSubcode);
                                decimal DiscountPercentage = string.IsNullOrEmpty(dt.Rows[0]["DiscountPercentage"].ToString()) ? 0 : Convert.ToDecimal(dt.Rows[0]["DiscountPercentage"]);
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discount % : " + DiscountPercentage);
                                string ReceiptNo = string.IsNullOrEmpty(tr.ReceiptNo.ToString()) ? "" : tr.ReceiptNo.ToString();
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Receipt No.  : " + ReceiptNo);
                                decimal AvailedAmount = string.IsNullOrEmpty(dt.Rows[0]["AvailedAmount"].ToString()) ? 0 : Convert.ToDecimal(dt.Rows[0]["AvailedAmount"]);
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Availed Amount  : " + AvailedAmount);
                                decimal AvailedPoints = string.IsNullOrEmpty(dt.Rows[0]["AvailedPoints"].ToString()) ? 0 : Convert.ToDecimal(dt.Rows[0]["AvailedPoints"]);
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Availed Points  : " + AvailedPoints);
                                string isexecuted = TransactionBOL.Successful_BookingByMsTicket(TotalAmount, Play, MobileNo, ReferenceNo,
                                    Totalseats, PaymentGateway, AgentCode, DiscountPercentage, ReceiptNo, AvailedAmount, AvailedPoints, BookingID, AgentCodeSubcode, WebPromotionID);
                                if (Convert.ToInt32(isexecuted.ToString()) > 0)
                                {
                                    chkdata = Convert.ToInt32(isexecuted.ToString());
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("NMLIVEDB Updated from PG : " + PaymentGateway);
                                    SqlCommand cmdlog = new SqlCommand("select [Pre Booking Receipt No_],[Booking ID] from [NMLIVEDB].[dbo].[Great Indian Nautanki Company$Booking Master]  where [Web Booking ID]='" + BookingID + "'", connWebBooking);
                                    cmdlog.Connection.Open();
                                    SqlDataAdapter dadplog = new SqlDataAdapter(cmdlog);
                                    DataTable dtbllog = new DataTable();
                                    dadplog.Fill(dtbllog);
                                    if (dtbllog.Rows.Count > 0)
                                    {
                                        for (int i = 0; i < dtbllog.Rows.Count; i++)
                                        {
                                            DataRow drlog = dtbllog.Rows[i];
                                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Updated pre booking recipt no in booking master and prebooking recipt no is " + drlog["Pre Booking Receipt No_"] + "," + drlog["Booking ID"]);
                                        }
                                    }
                                    else
                                    {
                                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Unable to fetch information for web integration");
                                    }
                                    cmdlog.Connection.Close();
                                }
                                else
                                {
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Unable to update NMLIVEDB." + isexecuted);
                                    /*******************Payement Gateway Error Value Code**********************/
                                    #region PG_DB for Unable to update NMLIVEDB
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Unable to update NMLIVEDB Entry in PG_DB");
                                    int j = GTICKBOL.Insert_Payment_DB("Unable to update NMLIVEDB", BookingID, PaymentGateway);
                                    #endregion PG_DB for Unable to update NMLIVEDB
                                    /*********************End******************************/
                                }

                            }
                            catch (Exception ex)
                            {
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Unable to update NMLIVEDB. " + ex.Message);
                                /*******************Payement Gateway Error Value Code**********************/
                                #region PG_DB for Unable to update NMLIVEDB
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Unable to update NMLIVEDB Entry in PG_DB");
                                int j = GTICKBOL.Insert_Payment_DB("Unable to update NMLIVEDB", tr.BookingID.ToString(), tr.PaymentGateway.ToString());
                                #endregion PG_DB for Unable to update NMLIVEDB
                                /*********************End******************************/
                            }
                        }
                    }
                    attempts++;
                }
                while (chkdata == 0 && attempts < 3);

            }
            catch (Exception ex)
            {
                Connection.LogEntry(tr.ReferenceNo.ToString(), "Error occurred while adding transaction-- " + ex, "18", tr.BookingID.ToString());
            }
            finally
            {
                if (connWebBooking.State == ConnectionState.Open)
                    connWebBooking.Close();
            }
            DataTable dtNav = new DataTable();

            if (chkdata > 0)
            {
                if (exisitng_ticket_booked_count == 0)
                {
                    Connection.LogEntry(tr.ReferenceNo.ToString(), "Transaction added to Navision-Booking Master", "19", tr.BookingID.ToString());
                }
            }
            else
            {
                Connection.LogEntry(tr.ReferenceNo.ToString(), "FAILURE: NOT ABLE TO UPDATE Navision-Booking Master", "18", tr.BookingID.ToString());
                command.CommandText = " Select *,[SeatBooked] = 0 From  [GINC$BookingTransaction_temp] where [ID] = " + tr.BookingID.ToString();
                dtNav = Connection.readTab(command, connMSTicket);
                return dtNav;
            }

            //Move succesful transactions into new table...

            DataTable dtGcell = new DataTable();

            command = new SqlCommand();
            try
            {
                command = new SqlCommand();

                Connection.LogEntry(tr.ReferenceNo.ToString(), "Writing Data To GCELL-Transaction Table", "20", tr.BookingID.ToString());
                if (exisitng_ticket_booked_count == 0)
                {
                    command.CommandText = " if  not EXISTS (Select id from ginc$bookingTransaction where [ReferenceNo] ='" + tr.ReferenceNo.ToString() + "') begin " +
                        " insert into GINC$BookingTransaction ([BookingID] ,[ReferenceNo],[Source],[DateOfBooking],[TimeOfBooking]," +
                        " [Location],[Play],[ShowTime],[ShowDate],[Category],[TotalSeats],[TotalAmount],[PaymentType],[CardType],[CardNo]," +
                        " [MobileNo],[EmailID],[Name],[PaymentGateway],[Amex Street],[Amex Pin],[Amex Country],[AgentCode],[BookingType],[Status],[SeatInfo], ReceiptNo, [Address],[IP],[Remark],[PromotionCode],[DiscountPercentage],[WebPromotionId],[RegId],[AvailedAmount],[AvailedPoints],[TopUpAmount],[TopUpTransactionId],[OptionalEmail],[OptionalContact],[IsChecked],[PlaceOfPick],[TimeOfPick],[PlaceOfDrop],[TimeOfDrop],[WantComplimentary],[WantComplimentaryDrop],[PayableAmount],[RoutedThrough]) " +
                        " (SELECT  " + tr.BookingID.ToString() + "," + tr.ReferenceNo.ToString() + ",[Source],'" + DateTime.Now.Date.ToShortDateString() + "','" +
                        DateTime.Now.ToShortTimeString() + "' ,[Location],[Play],[ShowTime],[ShowDate],[Category], [TotalSeats],[TotalAmount]  ," +
                        " [PaymentType],[CardType],[CardNo],[MobileNo],[EmailID],[Name],[PaymentGateway],[Amex Street],[Amex Pin],[Amex Country],[AgentCode],[BookingType],'True'," +
                        " [SeatInfo], '" + tr.ReceiptNo + "', [Address], [IP], [Remark] ,[PromotionCode],[DiscountPercentage],[WebPromotionId],[RegId],[AvailedAmount],[AvailedPoints],[TopUpAmount],[TopUpTransactionId],[OptionalEmail],[OptionalContact],[IsChecked],[PlaceOfPick],[TimeOfPick],[PlaceOfDrop],[TimeOfDrop],[WantComplimentary],[WantComplimentaryDrop],[PayableAmount],[RoutedThrough] from [GINC$BookingTransaction_temp] where  [BookingID] = " + tr.ReferenceNo.ToString() + ")  end " +
                        " Select *, [SeatBooked] = 1, [AlreadyProcessed] = 0 from [GINC$BookingTransaction] where [BookingID] ='" + tr.BookingID.ToString() + "'";
                }
                else
                {
                    command.CommandText = " Select *, [SeatBooked] = 1, [AlreadyProcessed] = 1 from [GINC$BookingTransaction] where [BookingID] ='" + tr.BookingID.ToString() + "'";
                }

                dtGcell = Connection.readTab(command, connMSTicket);

                if (exisitng_ticket_booked_count == 0 && tr.PromotionCode == "MARCHPROMOTION" || tr.PromotionCode == "MONTHOFMARCH")
                {
                    SqlCommand comand = new SqlCommand();
                    comand.CommandText = "Update [dbo].[March_Promotion] set [PGIsPaymentSuccess]=1 where [BookingId]='" + tr.ReferenceNo.ToString() + "'";
                    Connection.EXECommand(comand, connMSTicket);
                }
                if (exisitng_ticket_booked_count == 0 && tr.PromotionCode == "MMT")
                {
                    SqlCommand comand = new SqlCommand();
                    comand.CommandText = "Update [dbo].[tbl_mmtpromotion] set IsPaymentSuccess=1 ,[ReceiptId]='" + tr.ReceiptNo.ToString() + "' where [BookingId] = '" + tr.ReferenceNo.ToString() + "'";
                    Connection.EXECommand(comand, connMSTicket);
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("update mmt promotion table");
                }
                if (exisitng_ticket_booked_count == 0 && tr.PromotionCode == "MANA")
                {
                    SqlCommand comand = new SqlCommand();
                    comand.CommandText = "Update [dbo].[tbl_manapromotion] set IsPaymentSuccess=1 ,[ReceiptId]='" + tr.ReceiptNo.ToString() + "' where [BookingId] = '" + tr.ReferenceNo.ToString() + "'";
                    Connection.EXECommand(comand, connMSTicket);
                }
                if (exisitng_ticket_booked_count == 0 && tr.PromotionCode == "YATRA")
                {
                    SqlCommand comand = new SqlCommand();
                    comand.CommandText = "Update [dbo].[tbl_yatrapromotion] set IsPaymentSuccess=1 ,[ReceiptId]='" + tr.ReceiptNo.ToString() + "' where [BookingId] = '" + tr.ReferenceNo.ToString() + "'";
                    Connection.EXECommand(comand, connMSTicket);
                }
                if (exisitng_ticket_booked_count == 0 && (tr.PromotionCode == "MCOTHERS" || tr.PromotionCode == "MCWORLD"))
                {
                    SqlCommand comand = new SqlCommand();
                    comand.CommandText = "Update [dbo].[MCPROMOTIONS_DETAIL] set IsPaymentSuccess=1 ,[ReceiptId]='" + tr.ReceiptNo.ToString() + "' where [BookingId] = '" + tr.ReferenceNo.ToString() + "'";
                    Connection.EXECommand(comand, connMSTicket);
                }
                if (exisitng_ticket_booked_count == 0)
                {
                    SqlCommand com = new SqlCommand();
                    com.CommandText = "UPDATE [GINC$BookingTransaction_temp] SET [IsProcessed] = 6 where [BookingID]=" + tr.ReferenceNo + "";
                    Connection.EXECommand(com, connMSTicket);
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Update Isprocessed to 6 (Successful Transaction) in booking Transaction_temp table for Reference ID" + tr.ReferenceNo);
                }

                if (dtGcell.Rows.Count > 0)
                {
                    Connection.LogEntry(tr.ReferenceNo.ToString(), "Successfully Written Data To GCELL-Transaction Table", "21", tr.BookingID.ToString());

                    string _totalSeats = "0";
                    decimal totalSeats = 0;

                    if (dtGcell.Rows[0]["TotalSeats"] != null)
                    {
                        totalSeats = decimal.Parse(dtGcell.Rows[0]["TotalSeats"].ToString()) == 0 ? 1 : decimal.Parse(dtGcell.Rows[0]["TotalSeats"].ToString());
                        _totalSeats = totalSeats.ToString();
                    }

                    //Connection.LogEntry(tr.ReferenceNo.ToString(), "Writing Data To SAN CRM", "15", tr.BookingID.ToString());
                    command = new SqlCommand();
                    command.CommandText = "exec ImportMaster '" + dtGcell.Rows[0]["MobileNo"] + "', '" + dtGcell.Rows[0]["Name"] + "','-','" + dtGcell.Rows[0]["EmailID"]
                    + "','WEB','Ticket Book from Internet','" + dtGcell.Rows[0]["BookingID"] + "','" +
                    Convert.ToDateTime(dtGcell.Rows[0]["ShowDate"]).ToShortDateString() + " " + Convert.ToDateTime(dtGcell.Rows[0]["ShowTime"]).ToShortTimeString()
                    + "','" + _totalSeats + "','" + dtGcell.Rows[0]["Category"] + "','" + decimal.Parse(dtGcell.Rows[0]["TotalAmount"].ToString()) + " / " + totalSeats + "','" + dtGcell.Rows[0]["TotalAmount"] + "','" + dtGcell.Rows[0]["SeatInfo"] + "'";

                    Connection.EXECommand(command, connWebCRM);
                }
                else
                {
                    Connection.LogEntry(tr.ReferenceNo.ToString(), "Unable to write Data To GCELL-Transaction Table", "22", tr.BookingID.ToString());
                    /*******************Payement Gateway Error Value Code**********************/
                    #region PG_DB for Unable to write Data To GCELL-Transaction Table
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Unable to write Data To GCELL-Transaction Table Entry in PG_DB");
                    int j = GTICKBOL.Insert_Payment_DB("Unable to write Data To GCELL-Transaction Table", tr.BookingID.ToString(), tr.PaymentGateway.ToString());
                    #endregion PG_DB for Unable to write Data To GCELL-Transaction Table
                    /*********************End******************************/
                }
                return dtGcell;
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("" + ex.Message);
            }
            finally
            {
                if (connMSTicket.State == ConnectionState.Open)
                    connMSTicket.Close();
            }
            return dtNav;
        }
Example #7
0
 public static void Update_PaymentStatus(TransactionRecord tr)
 {
     TransactionDAL.Update_PaymentStatus(tr);
 }
Example #8
0
    protected void btnProceed_Click(object sender, EventArgs e)
    {
        if (Session_value!=null)
        {
            try
            {
                string[] date = null;
                
                    if (Session_value != "")
                    {
                        date = Session_value.Split(',');
                    }
                    else
                    {
                        Response.Redirect("Default.aspx", false);
                    }
                
               
                if (date.Length < 4)
                {
                    String err = "Cannot render seat layour because seat selection in Session invalid or expired. Session: " + Session_value;
                    throw new Exception(err);
                }
                else
                {
                    string filmCode = date[3].ToString();

                    string[] confimseats = hidtempseats.Value.Split('|');
                    int totalSeats = int.Parse(confimseats[0]);

                    string strchktempseat = "", Seat_info = "";
                    for (int u = 0; u < totalSeats; u++)
                    {
                        strchktempseat += confimseats[2 + u].Split('_')[0] + ",";
                        Seat_info += confimseats[2 + u].Split('_')[1] + ",";
                    }
                    string SeatNo = strchktempseat.TrimEnd(',');

                    int status;
                    TransactionRecord _tr = new TransactionRecord();
                    //assign filmCode from Session
                    _tr.Play = filmCode;
                    _tr.TotalSeats = totalSeats;
                    //Generate Transaction ID
                    _tr.SeatInfo = SeatNo;
                   // _tr.BookingID = GTICKBOL.TransactionCounter_Max();
                    _tr.BookingID = Convert.ToInt64(trnsectioncounter);
                    status = GTICKBOL.Check_Seats_BeforeProceed(_tr);
                    if (status == 0)
                    {
                        KoDTicketing.GTICKV.LogEntry(_tr.BookingID.ToString(), "User Detail > " + Session_value + ", Browser Version : " + HiddenBrowser.Value, "2", "");
                        KoDTicketing.GTICKV.LogEntry(_tr.BookingID.ToString(), "Checking Seats Availability", "4", "");
                        ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('The seats you have selected are not available at this time, please select different seats');</script>");
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Setting up the seat layout again as the selected seats are not available. Session : " + Session_value);
                        set_seatLayout();
                        return;
                    }
                    else
                    {
                        KoDTicketing.GTICKV.LogEntry(_tr.BookingID.ToString(), "Seats are available.", "5", "");
                        GTICKBOL.Insert_SeatInfo(Seat_info.TrimEnd(','), _tr.BookingID);
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Request Contact Details for Transaction... : " + Decrypt(Request.QueryString["SessionId"]));
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(trnsectioncounter);
                        Response.Redirect("ContactDetails.aspx?SessionId=" + Encrypt(trnsectioncounter), false);
                    }
                }
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Seat Layout Page Error: " + ex.Message);
                Session.Abandon();
                ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start" +
                    " the transaction again');window.location.href='Default.aspx';</script>");
            }
        }
        else
        {
            ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start" +
                    " the transaction again');window.location.href='Default.aspx';</script>");
        }
    }
Example #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tr"></param>
        /// <returns></returns>
        public static DataTable _Select_Report_SearchFromTransactionsTemp(TransactionRecord tr, bool details = true)
        {
            string sqlQuery = "SELECT row_number() over (order by ID) as ID,[BookingID],Convert(nvarchar,[DateOfBooking],107) as [DateOfBooking]" +
                " ,Convert(nvarchar,[TimeOfBooking],108) as [TimeOfBooking] ,[Location],[Play],Convert(nvarchar,[ShowDate],107) as [ShowDate]" +
                " ,Convert(nvarchar,[ShowTime],108) as [ShowTime] ,[Category],[TotalSeats],[TotalAmount],[CardType],[Name],";

            if (details)
                sqlQuery += "[MobileNo],[EmailID],";

            sqlQuery += "[PaymentGateway],[SeatInfo] FROM [GINC$BookingTransaction_temp] where" +
                " BookingID like '%" + tr.BookingID + "%' and [Name] like '%" + tr.Name + "%' ";

            if (tr.DateOfBooking != "")
                sqlQuery += " and Convert(Datetime,[DateOfBooking]) like Convert(datetime, '" + tr.DateOfBooking + "')";
            if (tr.ShowDate != "")
                sqlQuery += " and Convert(Datetime,[ShowDate]) like Convert(datetime, '" + tr.ShowDate + "')";
            sqlQuery += " ORDER BY BookingID";
            return Connection.readTab(sqlQuery, connMSTicket);
        }
Example #10
0
 public static DataTable Select_Report_SearchFromTransactions(TransactionRecord tr)
 {
     return(TransactionDAL._Select_Report_SearchFromTransactions(tr));
 }
Example #11
0
 public static void Update_PaymentStatus(TransactionRecord tr)
 {
     TransactionDAL.Update_PaymentStatus(tr);
 }
Example #12
0
 public static int Transaction_Temp_Insert(TransactionRecord tr)
 {
     return(TransactionDAL._Transaction_Temp_Insert(tr));
 }
Example #13
0
    protected string UpdateResponseByTranId()
    {
        try
        {
            TransactionRecord tr = new TransactionRecord();
            tr.BookingID = tr.VoucherBookingID;
            tr.ReceiptNo = "''";
            tr.ReferenceNo = long.Parse(PayDetailsTemp[1].Split('_')[0]);
            tr.AgentCode = PayDetailsTemp[1].Split('_')[1].Split('~')[1];
            //****** Promo code usecase start here ************
            KODHelper objKODHelper = new KODHelper();
            tr = objKODHelper.GetPromotionDetails(tr);
            //****** Promo code usecase END here ************
            DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);
            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[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("Voucher Transaction : Seats Booked for " + tr.BookingID.ToString());
                if (!alreadyProcessed)
                {
                    ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo,"");
                }
            }
         }
        catch (Exception ex)
        {
            if (qstring == "")
                qstring += "?err=seat";
            else
                qstring += "&err=seat";
            GTICKV.LogEntry(merchantReferenceNo, "Error Occured --" + ex.Message.Replace("'", ""), "19", MainBookingID);
        }
        Session["bookid"] = qstring;


        return qstring;
    }
Example #14
0
    protected void btnVarify_Click(object sender, EventArgs e)
    {
        //varify the vaoucher Nos from databse and execute this routine
        if (Session["seat_Val"] != null)
        {
            if (Session["PayDetailsTemp"] != null)
            {
                TransactionRecord tr = new TransactionRecord();
                PayDetailsTemp = Session["PayDetailsTemp"].ToString().Split('|');
                string[] Straa = Session["seat_Val"].ToString().Split(',');
                string BookingID = PayDetailsTemp[1].Split('_')[1].Split('~')[0];
                tr.BookingID = long.Parse(BookingID);
                tr.TotalSeats = int.Parse(PayDetailsTemp[2]);
                tr.Category = Straa[4];
                string[] datarr = Straa[2].Split('/');
                tr.ShowDate = datarr[1] + "/" + datarr[0] + "/" + datarr[2];                
                tr.Day = Convert.ToDateTime(tr.ShowDate).DayOfWeek.ToString();
                switch (tr.Day.ToLower())
                {
                    case "monday":
                    case "tuesday":
                    case "wednesday":
                    case "thursday":
                    case "friday":
                        tr.Day = "1";
                        break;
                    case "saturday":
                    case "sunday":
                        tr.Day = "2";
                        break;
                }
                string VoucherNo = "";
                for (int U = 0; U < rep_Vouchers.Items.Count; U++)
                {
                    VoucherNo += ((TextBox)rep_Vouchers.Items[U].FindControl("txtSerials")).Text + "-" + ((TextBox)rep_Vouchers.Items[U].FindControl("txtvasls")).Text + "|";
                }
                tr.VoucherType = PayDetailsTemp[0];
                tr.VoucherNo = VoucherNo.TrimEnd('|');
                tr.VoucherBookingID = long.Parse("65" + BookingID.Remove(0, 2));
                if (TransactionBOL._Voucher_Varification_Update(tr) > 0)
                {
                    IAsyncResult ar = DoSomethingAsync("abc");
                    Session["result"] = ar;
                    Server.Transfer("~/Payment/Please-Wait.aspx", false);
                }
                else
                {
                    lblMess.Text = "Voucher No(s). Provided above are not valid!";
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='../../Default.aspx';</script>");
            }
        }
        else
        {
            ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='../../Default.aspx';</script>");

        }
    }
Example #15
0
    //public DataTable FinalBooking()
    public DataSet funFinalBooking(String TransactionID, String Source, String DateOfBooking, String TimeOfBooking, String Location,
        String Play, String ShowTime, String ShowDate, String Category, String PaymentType, String AgentCode, String SeatInfo,
        String MobileNo, String EmailID, String CustomerName, int TotalSeats, decimal TotalAmount, String strPaymentReceiptNo)
    {
        try
        {
            if (SecurityHeaderValidation.Validate(objSecurity))
            {
                DataTable dt = VistaDAL._Select_Time_Api(TransactionID);
                DateTime startdatetime = Convert.ToDateTime(dt.Rows[0][0]);
                if (startdatetime.AddMinutes(25) >= DateTime.UtcNow)
                {
                    TransactionRecord _tr = new TransactionRecord();
                    _tr.BookingID = long.Parse(TransactionID);
                    _tr.Location = Location;
                    _tr.Play = Play.ToUpper();
                    _tr.ShowTime = ShowTime;
                    _tr.ShowDate = ShowDate;
                    _tr.Category = Category;
                    _tr.SeatInfo = SeatInfo;
                    _tr.TotalSeats = TotalSeats;
                    _tr.Name = CustomerName;
                    _tr.MobileNo = MobileNo;
                    _tr.EmailID = EmailID;
                    _tr.AgentCode = AgentCode;
                    _tr.ReceiptNo = strPaymentReceiptNo;
                    _tr.DateOfBooking = DateOfBooking;
                    _tr.TimeOfBooking = TimeOfBooking;
                    _tr.Source = Source;
                    _tr.TotalAmount = TotalAmount;
                    _tr.TotalSeats = TotalSeats;
                    _tr.BookingID = long.Parse(TransactionID);

                    return GTICKDAL.funFinalBooking(_tr);
                }
                else
                {
                    DataSet dsexcep = new DataSet();
                    DataTable dtexcep = new DataTable();
                    dtexcep.Columns.Add("Column1", typeof(string));
                    dtexcep.Rows.Add("Session Time Out");
                    dsexcep.Tables.Add(dtexcep);
                    return dsexcep;
                }
                
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
        }
        return null;
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //string ShowDate = "";
        //string[] datarr1 = sessionvalue[2].ToString().Split('/');
        //ShowDate = datarr1[1] + "/" + datarr1[0] + "/" + datarr1[2];
        //String Enddate = "2014.04.10";
        //DateTime End = Convert.ToDateTime(Enddate);
        //String Presentdate = Convert.ToDateTime(ShowDate).ToString("yyyy-MM-dd");
        //DateTime Present = Convert.ToDateTime(Presentdate);
        if (Decrypt(Request.QueryString["SessionId"]) == sessionvalue[12].ToString()&& Session[Decrypt(Request.QueryString["SessionId"])] != "")
        {
            long transid = 0;
            TransactionRecord tr = new TransactionRecord();
            tr.Street = txt_street.Text;
            tr.Pin = txt_pin.Text;
            tr.Country = ddl_country.SelectedValue;
            string tital = Ddl_title.SelectedValue;
            string fname = Txtfname.Text;
            string mname = Txtmname.Text;
            string lname = Txtlname.Text;
            string city = Txtcity.Text;
            string state = Txtstate.Text;
            string country = txt_country.SelectedValue;

            try
            {
                #region Session based
                if (Session_value != "" && Request.QueryString["SessionId"] != null)
                {
                    try
                    {
                        string[] strarr;
                        strarr = Session_value.Split(',');
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Transaction [{0}]  ", strarr[12]));
                        tr.BookingID = long.Parse(strarr[12]);
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Seats  " + Session_value));
                        if (Session["AgentCode"] != null)
                        {
                            tr.AgentCode = Session["AgentCode"].ToString();
                            tr.Source = "MSAGENT";
                        }
                        else
                        {
                            tr.AgentCode = "WEB";
                            tr.Source = "WEB";
                        }
                        tr.BookingType = "INDIVIDUAL";
                        //tr.VoucherType = rblVoucher.SelectedValue;
                        //tr.VoucherNo = "";
                        //tr.VoucherBookingID = 0;

                        tr.CardType = rbl_CardType.SelectedItem.Text;
                        tr.PaymentGateway = rbl_CardType.SelectedValue;
                        tr.CardNo = "1111222233334444";
                        tr.MobileNo = txtContactNo.Text;
                        tr.Name = txtName.Text;
                        tr.PaymentType = ddlPaymentMode.SelectedItem.Text;
                        tr.DateOfBooking = DateTime.Now.Date.ToShortDateString();
                        tr.IsProcessed = 0;
                        tr.PaymentStatus = 0;
                        //*************if routed from other website***********
                        if (Session["Router"] != null)
                        {
                            tr.router = Session["Router"].ToString();
                        }
                        else
                        {
                            tr.router = "";
                        }
                        //*****************************************************
                        bool istrue = false;
                        Session["Complimentary"] = istrue;
                        Session["ComplimentaryDrop"] = istrue;
                        tr.WantComplimentary = istrue;
                        tr.WantComplimentaryDrop = istrue;
                        tr.PlaceOfDrop = "";
                        tr.PlaceOfPick = "";
                        tr.TimeOfPick = drpHrs.SelectedItem.Text + ":" + drpMins.SelectedItem.Text + " " + drp_Shift.SelectedItem.Text;
                        tr.TimeOfDrop = timed_hours.SelectedItem.Text + ":" + timed_minutes.SelectedItem.Text + " " + timed_formate.SelectedItem.Text;
                        if (strarr[10] == "PULMAN" && chkGCab.Checked)
                        {
                            tr.PlaceOfPick = "PULLMAN GURGAON";
                            tr.TimeOfPick = drpHrs.SelectedItem.Text + ":" + drpMins.SelectedItem.Text + " " + drp_Shift.SelectedItem.Text;
                            istrue = chkGCab.Checked;
                            Session["Complimentary"] = istrue;
                            tr.WantComplimentary = istrue;
                        }
                        if (strarr[10].ToString() == "LEELAKEMPINSKI" && chkGCab.Checked)
                        {
                            tr.PlaceOfPick = "LEELA KEMPINSKI GURGAON";
                            tr.TimeOfPick = drpHrs.SelectedItem.Text + ":" + drpMins.SelectedItem.Text + " " + drp_Shift.SelectedItem.Text;
                            istrue = chkGCab.Checked;
                            Session["Complimentary"] = istrue;
                            tr.WantComplimentary = istrue;
                        }
                        if (strarr[10].ToString() == "CROWNPLAZA" && (chkGCabPick.Checked || chkGCabDrop.Checked))
                        {
                            if (chkGCabPick.Checked)
                            {
                                tr.PlaceOfPick = "CROWNPLAZA GURGAON";
                                tr.TimeOfPick = timep_hours.SelectedItem.Text + ":" + timep_minutes.SelectedItem.Text + " " + timep_formate.SelectedItem.Text;
                                istrue = chkGCabPick.Checked;
                                Session["Complimentary"] = istrue;
                                tr.WantComplimentary = istrue;
                            }
                            if (chkGCabDrop.Checked)
                            {
                                tr.PlaceOfDrop = "KINGDOM OF DREAMS GURGAON";
                                tr.TimeOfDrop = timed_hours.SelectedItem.Text + ":" + timed_minutes.SelectedItem.Text + " " + timed_formate.SelectedItem.Text;
                                istrue = chkGCabDrop.Checked;
                                Session["ComplimentaryDrop"] = istrue;
                                tr.WantComplimentaryDrop = istrue;
                            }
                        }



                        tr.EmailID = txtEmailAddress.Text;
                        tr.Status = false;
                        tr.TimeOfBooking = DateTime.Now.ToShortTimeString();
                        tr.TotalSeats = int.Parse(strarr[5].ToString());
                        tr.Category = strarr[8];
                        tr.Location = strarr[6];
                        tr.Play = strarr[1];

                        string[] datarr = strarr[2].ToString().Split('/');//for live server
                        //string[] datarr = strarr[2].ToString().Split('-');// for dev/local

                        tr.ShowDate = datarr[1] + "/" + datarr[0] + "/" + datarr[2];//for live server
                        //tr.ShowDate = datarr[0] + "/" + datarr[1] + "/" + datarr[2]; // for dev/local


                        tr.ShowTime = strarr[7];
                        tr.Day = Convert.ToDateTime(tr.ShowDate).DayOfWeek.ToString();
                        //tr.ShowDate = datarr[1] + "/" + datarr[0] + "/" + datarr[2];//for local
                        tr.Remark = "";
                        tr.TotalAmount = GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID);
                        tr.SeatInfo = SeatVal;
                        tr.Address = txtAddress.Text.Trim();
                        tr.IP = GetIP();
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Date : " + tr.DateOfBooking);
                        //******Promotion code related changes START*****


                        if (strarr[10] != "")
                        {
                            KoDTicketingLibrary.DTO.Promotion PromoSession = (KoDTicketingLibrary.DTO.Promotion)Session[strarr[10]];
                            if (PromoSession.PromotionCode == "VIVANTABYTAJ")
                            {
                                string Cat = strarr[4].ToString();
                                string category;
                                string filmcode = strarr[3].ToString();
                                decimal price;
                                DataTable dt;
                                if (Cat == "DM")
                                {
                                    category = "GL"; // pay gold price instead of diamond
                                    dt = VistaBOL.Select_Category_Price(filmcode, category);
                                    price = decimal.Parse(dt.Rows[0][0].ToString());
                                    tr.DiscountedAmount = price * (tr.TotalSeats);
                                    tr.PayableAmount = tr.DiscountedAmount;
                                }
                                else
                                {
                                    tr.PayableAmount = tr.TotalAmount;
                                }
                            }
                            else if (PromoSession.PromotionCode == "TRIDENT" || PromoSession.PromotionCode == "OBEROI" || PromoSession.PromotionCode == "CROWNEPLAZAROHINI")                       //for oberoi and trident hotel
                            {
                                string Cat = strarr[4].ToString();
                                string category;
                                string filmcode = strarr[3].ToString();
                                decimal price;
                                DataTable dt;
                                if (Cat == "PL")
                                {
                                    category = "GL";                                                        // pay gold price instead of Platinum
                                    dt = VistaBOL.Select_Category_Price(filmcode, category);
                                    price = decimal.Parse(dt.Rows[0][0].ToString());
                                    tr.DiscountedAmount = price * (tr.TotalSeats);
                                    tr.PayableAmount = tr.DiscountedAmount;
                                }
                                else if (Cat == "DM")
                                {
                                    category = "PL";                                                        // pay platinum price instead of Diamond
                                    dt = VistaBOL.Select_Category_Price(filmcode, category);
                                    price = decimal.Parse(dt.Rows[0][0].ToString());
                                    tr.DiscountedAmount = price * (tr.TotalSeats);
                                    tr.PayableAmount = tr.DiscountedAmount;
                                }
                                else
                                {
                                    tr.PayableAmount = tr.TotalAmount;
                                }

                            }
                            else if (PromoSession.PromotionCode == "OBEROIDELHI")                       //for oberoi and trident hotel
                            {
                                string Cat = strarr[4].ToString();
                                string category;
                                string filmcode = strarr[3].ToString();
                                decimal price;
                                DataTable dt;
                                if (Cat == "GL")
                                {
                                    category = "SL";                                                        // pay gold price instead of Platinum
                                    dt = VistaBOL.Select_Category_Price(filmcode, category);
                                    price = decimal.Parse(dt.Rows[0][0].ToString());
                                    tr.DiscountedAmount = price * (tr.TotalSeats);
                                    tr.PayableAmount = tr.DiscountedAmount;
                                }
                                else if (Cat == "PL")
                                {
                                    category = "GL";                                                        // pay platinum price instead of Diamond
                                    dt = VistaBOL.Select_Category_Price(filmcode, category);
                                    price = decimal.Parse(dt.Rows[0][0].ToString());
                                    tr.DiscountedAmount = price * (tr.TotalSeats);
                                    tr.PayableAmount = tr.DiscountedAmount;
                                }
                                else if (Cat == "DM")
                                {
                                    category = "PL";                                                        // pay platinum price instead of Diamond
                                    dt = VistaBOL.Select_Category_Price(filmcode, category);
                                    price = decimal.Parse(dt.Rows[0][0].ToString());
                                    tr.DiscountedAmount = price * (tr.TotalSeats);
                                    tr.PayableAmount = tr.DiscountedAmount;
                                }
                                else
                                {
                                    tr.PayableAmount = tr.TotalAmount;
                                }

                            }
                            else if (PromoSession.PromotionCode == "MMTDOMESTIC")
                            {
                                string Cat = strarr[4].ToString();
                                string filmcode = strarr[3].ToString();
                                decimal price;
                                DataTable dt;
                                if ((Cat == "GL" || Cat == "PL" || Cat == "DM") && (Session["day"].ToString() == "SUNDAY" || Session["day"].ToString() == "SATURDAY"))
                                {
                                    dt = VistaBOL.Select_Category_Price(filmcode, Cat);
                                    price = decimal.Parse((dt.Rows[0][0]).ToString()) - 1000;
                                    tr.DiscountedAmount = decimal.Truncate(price * (tr.TotalSeats));
                                    tr.PayableAmount = decimal.Truncate(tr.DiscountedAmount);
                                }
                                else if ((Cat == "GL" || Cat == "PL" || Cat == "DM") && (Session["day"].ToString() != "SUNDAY" && Session["day"].ToString() != "SATURDAY"))
                                {
                                    dt = VistaBOL.Select_Category_Price(filmcode, Cat);
                                    price = decimal.Parse((dt.Rows[0][0].ToString())) - 500;
                                    tr.DiscountedAmount = decimal.Truncate(price * (tr.TotalSeats));
                                    tr.PayableAmount = decimal.Truncate(tr.DiscountedAmount);
                                }
                                else
                                {
                                    tr.PayableAmount = tr.TotalAmount;
                                }
                            }
                            else if (PromoSession.PromotionCode == "MANA" && strarr[11] != "")
                            {
                                if (strarr[11] == "Weekday,Rs.3999" && PromoSession.PromotionCode == "MANA")
                                {
                                    decimal amount = 3999 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    tr.DiscountedAmount = (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100));
                                    tr.PayableAmount = amount;
                                }
                                else if (strarr[11] == "Weekend,Rs.4999" && PromoSession.PromotionCode == "MANA")
                                {
                                    decimal amount = 4999 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    tr.DiscountedAmount = (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100));
                                    tr.PayableAmount = amount;
                                }
                            }
                            else if (PromoSession.PromotionCode == "FAMILYOFFER" && strarr[11] != "")
                            {
                                if (strarr[11] == "Weekday-Rs.9796" && PromoSession.PromotionCode == "FAMILYOFFER")
                                {
                                    //decimal discountamount = ((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID)) - ((Convert.ToDecimal(Session["TotalAmount"].ToString()) + (2600 * Convert.ToDecimal(strarr[5].ToString()) / 4)) - 4999)) / tr.TotalSeats;
                                    PromoSession.DiscountPercentage = decimal.Round((((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) / tr.TotalSeats) - 600) / ((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) / tr.TotalSeats)) * 100), 2, MidpointRounding.AwayFromZero);
                                    // PromoSession.DiscountPercentage = decimal.Round((((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - 4797)) / ((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) / tr.TotalSeats)) * 100), 2, MidpointRounding.AwayFromZero);
                                    decimal amount = 2400 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    tr.DiscountedAmount = decimal.Round(GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100));
                                    tr.PayableAmount = amount;
                                }
                                else if (strarr[11] == "Weekend-Rs.13196" && PromoSession.PromotionCode == "FAMILYOFFER")
                                {
                                    //decimal discountamount = ((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID)) - ((Convert.ToDecimal(Session["TotalAmount"].ToString()) + (3200 * Convert.ToDecimal(strarr[5].ToString()) / 4)) - 7999)) / tr.TotalSeats;
                                    PromoSession.DiscountPercentage = decimal.Round((((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) / tr.TotalSeats) - 1200) / ((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) / tr.TotalSeats)) * 100), 2, MidpointRounding.AwayFromZero);
                                    //PromoSession.DiscountPercentage = decimal.Round((((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) / tr.TotalSeats) - discountamount) / ((GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) / tr.TotalSeats)) * 100), 2, MidpointRounding.AwayFromZero);
                                    decimal amount = 4800 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    tr.DiscountedAmount = decimal.Round(GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100));
                                    tr.PayableAmount = amount;
                                }
                            }
                            else if (PromoSession.PromotionCode == "MMT")
                            {
                                if (strarr[11] != "")
                                {
                                    if (strarr[11] == "4500" || PromoSession.PromotionCode == "MMT")
                                    {
                                        decimal amount = 4500 * (Convert.ToDecimal(Session["NoofPackages"]));
                                        tr.DiscountedAmount = (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100));
                                        tr.PayableAmount = amount;
                                    }
                                }
                            }
                            else if (PromoSession.PromotionCode == "OCTOBERFEST")
                            {
                                tr.DiscountedAmount = (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100));
                                tr.PayableAmount = tr.DiscountedAmount;
                            }
                            else if (PromoSession.PromotionCode == "JHUMROOOFFER")
                            {
                                tr.DiscountedAmount = (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100));
                                tr.PayableAmount = tr.DiscountedAmount;
                            }

                            //else if (PromoSession.PromotionCode == "MCOTHERS" && strarr[11] != "")
                            //{
                            //    if (strarr[11] != "")
                            //    {
                            //        if (strarr[11] == "5597" || PromoSession.PromotionCode == "MCOTHERS")
                            //        {
                            //            tr.DiscountPercentage = 20;
                            //            PromoSession.DiscountPercentage = 20;
                            //            decimal amount = 5597 * (Convert.ToDecimal(Session["MCOTHERSNOOFPACKAGE"]));
                            //            tr.DiscountedAmount = (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100));
                            //            tr.PayableAmount = amount;
                            //        }
                            //    }
                            //}
                            else
                            {
                                if (PromoSession.PromotionCode == "YATRA")
                                {
                                    if (strarr[4].ToString() == "SL" || strarr[4].ToString() == "GL")
                                    {
                                        PromoSession.DiscountPercentage = 15;
                                    }
                                    if (strarr[4].ToString() == "PL" || strarr[4].ToString() == "DM")
                                    {
                                        PromoSession.DiscountPercentage = 20;
                                    }
                                }
                                if (PromoSession.PromotionCode == "MCWORLD")
                                {
                                    if (strarr[4].ToString() == "PL")
                                    {
                                        PromoSession.DiscountPercentage = 15;
                                    }
                                    if (strarr[4].ToString() == "DM")
                                    {
                                        PromoSession.DiscountPercentage = 25;
                                    }
                                }
                                if (PromoSession.PromotionCode == "MCOTHERS")
                                {
                                    if (strarr[4].ToString() == "GL")
                                    {
                                        PromoSession.DiscountPercentage = 20;
                                    }
                                    if (strarr[4].ToString() == "SL")
                                    {
                                        PromoSession.DiscountPercentage = 15;
                                    }
                                }
                                tr.DiscountedAmount = (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100));
                            }
                            tr.PromotionCode = PromoSession.PromotionCode;
                            tr.DiscountPercentage = PromoSession.DiscountPercentage;
                            tr.WebPromotionId = PromoSession.WebPromotionId;
                        }
                        if (sessionvalue[1].ToString() == "NEW YEAR")
                        {
                            tr.PromotionCode = "NEW YEAR PARTY";
                        }
                        //******Promotion code related changes END*****
                        //******Jhumroo Offer (1+1) code related changes*****
                        //if (strarr[1].ToString() == "JHUMROO" && (strarr[4].ToString() == "GLY" || strarr[4].ToString() == "SL" || strarr[4].ToString() == "GL" || strarr[4].ToString() == "PL" || strarr[4].ToString() == "DM") && strarr[10].ToString() == "" && Present <= End)
                        //{
                        //    tr.DiscountedAmount = Convert.ToDecimal(Session["PayableAmount"].ToString());
                        //    tr.PayableAmount = tr.DiscountedAmount;
                        //    tr.DiscountPercentage = 100 - decimal.Round(((tr.PayableAmount * 100) / (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID))), 2, MidpointRounding.AwayFromZero);
                        //}
                        //******Jhumroo Offer (1+1) code related changes END*****
                        transid = TransactionBOL.Transaction_Temp_Insert(tr);
                        GTICKV.LogEntry(tr.BookingID.ToString(), "Starting to write Information to temp Session Table", "7", "");

                        if ((strarr[11] != "" && strarr[10] != "FAMILYOFFER") || (strarr[10] == "OCTOBERFEST" || strarr[10] == "JHUMROOOFFER"))
                            {
                                transid = GTICKBOL.MarchPromotionTransactionCounter_Max(transid);
                            }
                            if (sessionvalue[1].ToString() == "NEW YEAR")
                            {
                                transid = GTICKBOL.MarchPromotionTransactionCounter_Max(transid);
                            }
                        
                    }
                    catch (Exception ex)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Transaction Preparation Error: " + ex.Message);
                        ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
                    }
                    GTICKV.LogEntry(tr.BookingID.ToString(), "Category : " + tr.Category + " ,Seat Info : " + tr.SeatInfo +
                        ", Total Amt : " + tr.TotalAmount, "8", "");

                    // ******Promotion code send discounted AMOUNT to payment gateway changes START*****
                    if (sessionvalue[10] != "" || sessionvalue[10] != "")
                    {
                        KoDTicketingLibrary.DTO.Promotion ObjPromoSession = (KoDTicketingLibrary.DTO.Promotion)Session[sessionvalue[10]];
                        string[] strarr = Session_value.Split(',');
                        if (ObjPromoSession.PromotionCode == "VIVANTABYTAJ")
                        {
                            string Cat = strarr[4].ToString();
                            string category;
                            string filmcode = strarr[3].ToString();
                            decimal price;
                            DataTable dt;
                            if (Cat == "DM")
                            {
                                category = "GL"; // pay gold price instead of Platinum
                                dt = VistaBOL.Select_Category_Price(filmcode, category);
                                price = decimal.Parse(dt.Rows[0][0].ToString());
                                tr.TotalAmount = price * (tr.TotalSeats);
                                for (int i = 0; i < tr.TotalSeats; i++)
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discounted Price For a Ticket" + tr.TotalAmount.ToString());
                            }
                        }
                        else if (ObjPromoSession.PromotionCode == "TRIDENT" || ObjPromoSession.PromotionCode == "OBEROI" || ObjPromoSession.PromotionCode == "CROWNEPLAZAROHINI")                    //for oberoi and trident hotel
                        {
                            string Cat = strarr[4].ToString();
                            string category;
                            string filmcode = strarr[3].ToString();
                            decimal price, DiscountedPrice;
                            DataTable dt;
                            if (Cat == "PL")
                            {
                                category = "GL";                                                      // pay gold price instead of Platinum
                                dt = VistaBOL.Select_Category_Price(filmcode, category);
                                price = decimal.Parse(dt.Rows[0][0].ToString());
                                DiscountedPrice = price;
                                tr.TotalAmount = price * (tr.TotalSeats);
                                for (int i = 0; i < tr.TotalSeats; i++)
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discounted Price For a Ticket" + DiscountedPrice.ToString());
                            }
                            else if (Cat == "DM")
                            {
                                category = "PL";                                                      // pay platinum price instead of Diamond
                                dt = VistaBOL.Select_Category_Price(filmcode, category);
                                price = decimal.Parse(dt.Rows[0][0].ToString());
                                DiscountedPrice = price;
                                tr.TotalAmount = price * (tr.TotalSeats);
                                for (int i = 0; i < tr.TotalSeats; i++)
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discounted Price For a Ticket" + DiscountedPrice.ToString());
                            }
                        }
                        else if (ObjPromoSession.PromotionCode == "OBEROIDELHI")                    //for oberoi and trident hotel
                        {
                            string Cat = strarr[4].ToString();
                            string category;
                            string filmcode = strarr[3].ToString();
                            decimal price, DiscountedPrice;
                            DataTable dt;
                            if (Cat == "GL")
                            {
                                category = "SL";                                                      // pay gold price instead of Platinum
                                dt = VistaBOL.Select_Category_Price(filmcode, category);
                                price = decimal.Parse(dt.Rows[0][0].ToString());
                                DiscountedPrice = price;
                                tr.TotalAmount = price * (tr.TotalSeats);
                                for (int i = 0; i < tr.TotalSeats; i++)
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discounted Price For a Ticket" + DiscountedPrice.ToString());
                            }
                            else if (Cat == "PL")
                            {
                                category = "GL";                                                      // pay platinum price instead of Diamond
                                dt = VistaBOL.Select_Category_Price(filmcode, category);
                                price = decimal.Parse(dt.Rows[0][0].ToString());
                                DiscountedPrice = price;
                                tr.TotalAmount = price * (tr.TotalSeats);
                                for (int i = 0; i < tr.TotalSeats; i++)
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discounted Price For a Ticket" + DiscountedPrice.ToString());
                            }
                            else if (Cat == "DM")
                            {
                                category = "PL";                                                      // pay platinum price instead of Diamond
                                dt = VistaBOL.Select_Category_Price(filmcode, category);
                                price = decimal.Parse(dt.Rows[0][0].ToString());
                                DiscountedPrice = price;
                                tr.TotalAmount = price * (tr.TotalSeats);
                                for (int i = 0; i < tr.TotalSeats; i++)
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discounted Price For a Ticket" + DiscountedPrice.ToString());
                            }
                        }
                        else if (ObjPromoSession.PromotionCode == "MMTDOMESTIC")
                        {
                            string Cat = strarr[4].ToString();
                            string filmcode = strarr[3].ToString();
                            decimal price;
                            decimal DiscountedPrice;
                            DataTable dt;
                            if ((Cat == "GL" || Cat == "PL" || Cat == "DM") && (Session["day"].ToString() == "SUNDAY" || Session["day"].ToString() == "SATURDAY"))
                            {
                                dt = VistaBOL.Select_Category_Price(filmcode, Cat);
                                price = decimal.Parse((dt.Rows[0][0].ToString())) - 1000;
                                DiscountedPrice = decimal.Truncate(price);
                                tr.TotalAmount = decimal.Truncate(price * (tr.TotalSeats));
                                for (int i = 0; i < tr.TotalSeats; i++)
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discounted Price For a Ticket" + DiscountedPrice.ToString());
                            }
                            else if ((Cat == "GL" || Cat == "PL" || Cat == "DM") && (Session["day"].ToString() != "SUNDAY" && Session["day"].ToString() != "SATURDAY"))
                            {
                                dt = VistaBOL.Select_Category_Price(filmcode, Cat);
                                price = decimal.Parse((dt.Rows[0][0].ToString())) - 500;
                                DiscountedPrice = decimal.Truncate(price);
                                tr.TotalAmount = decimal.Truncate(price * (tr.TotalSeats));
                                for (int i = 0; i < tr.TotalSeats; i++)
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discounted Price For a Ticket" + DiscountedPrice.ToString());
                            }

                        }
                        else if (ObjPromoSession.PromotionCode == "MANA")
                        {
                            if (strarr[11] != "")
                            {
                                if (ObjPromoSession.PromotionCode.ToUpper() == "MANA" && strarr[11] == "Weekday,Rs.3999")
                                {
                                    decimal amount = 3999 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    tr.TotalAmount = amount;
                                    tr.PayableAmount = amount;
                                    string date4 = tr.ShowDate.ToString();
                                    DateTime day1 = Convert.ToDateTime(date4);
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("values Mana Weekday Package : " + Convert.ToInt16(Session["NoofPackages"]) + Convert.ToDecimal(Session["TotalAmount"].ToString()) + Convert.ToDecimal(Session["PayableAmount"].ToString()) + Convert.ToDateTime(tr.DateOfBooking.ToString()) + tr.BookingID.ToString() + day1 + tr.Name.ToString() + tr.EmailID.ToString() + tr.MobileNo.ToString() + tr.PaymentGateway.ToString() + false + "" + Session["PackageType"].ToString() + transid.ToString());
                                    transid = GTICKBOL.MANABooking_Details(Convert.ToInt16(Session["NoofPackages"]), Convert.ToDecimal(Session["TotalAmount"].ToString()), Convert.ToDecimal(Session["PayableAmount"].ToString()), Convert.ToDateTime(tr.DateOfBooking.ToString()), tr.BookingID.ToString(), day1, tr.Name.ToString(), tr.EmailID.ToString(), tr.MobileNo.ToString(), tr.PaymentGateway.ToString(), false, "", Session["PackageType"].ToString(), transid.ToString());
                                }
                                else if (strarr[11] == "Weekend,Rs.4999" && ObjPromoSession.PromotionCode == "MANA")
                                {

                                    decimal amount = 4999 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    tr.TotalAmount = amount;
                                    tr.PayableAmount = amount;
                                    string date4 = tr.ShowDate.ToString();
                                    DateTime day1 = Convert.ToDateTime(date4);
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("values for Mana Weekend Package : " + Convert.ToInt16(Session["NoofPackages"]) + Convert.ToDecimal(Session["TotalAmount"].ToString()) + Convert.ToDecimal(Session["PayableAmount"].ToString()) + Convert.ToDateTime(tr.DateOfBooking.ToString()) + tr.BookingID.ToString() + day1 + tr.Name.ToString() + tr.EmailID.ToString() + tr.MobileNo.ToString() + tr.PaymentGateway.ToString() + false + "" + Session["PackageType"].ToString() + transid.ToString());
                                    transid = GTICKBOL.MANABooking_Details(Convert.ToInt16(Session["NoofPackages"]), Convert.ToDecimal(Session["TotalAmount"].ToString()), Convert.ToDecimal(Session["PayableAmount"].ToString()), Convert.ToDateTime(tr.DateOfBooking.ToString()), tr.BookingID.ToString(), day1, tr.Name.ToString(), tr.EmailID.ToString(), tr.MobileNo.ToString(), tr.PaymentGateway.ToString(), false, "", Session["PackageType"].ToString(), transid.ToString());
                                }
                            }
                        }
                        else if (ObjPromoSession.PromotionCode == "FAMILYOFFER")
                        {
                            if (strarr[11] != "")
                            {
                                if ((ObjPromoSession.PromotionCode.ToUpper() == "FAMILYOFFER" && strarr[11] == "Weekday-Rs.9796") && strarr[4] == "GL")
                                {
                                    decimal pcktotal = 9796 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    decimal tckpaybale = 600 * tr.TotalSeats;
                                    Session["TicketPaybale"] = tckpaybale;
                                    Session["PackageTotal"] = pcktotal;
                                    decimal amount = 4999 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    tr.TotalAmount = amount;
                                    tr.PayableAmount = amount;
                                    string date4 = tr.ShowDate.ToString();
                                    DateTime day1 = Convert.ToDateTime(date4);
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("values Family Offer Weekday Package : " + Convert.ToInt16(Session["NoofPackages"]) + Convert.ToDecimal(Session["TotalAmount"].ToString()) + Convert.ToDecimal(Session["PayableAmount"].ToString()) + Convert.ToDateTime(tr.DateOfBooking.ToString()) + tr.BookingID.ToString() + day1 + tr.Name.ToString() + tr.EmailID.ToString() + tr.MobileNo.ToString() + tr.PaymentGateway.ToString() + false + "" + Session["PackageType"].ToString() + transid.ToString());
                                    transid = GTICKBOL.FAMILYOFFERBooking_Details(Convert.ToInt16(Session["NoofPackages"]), Convert.ToDecimal(Session["TotalAmount"].ToString()), Convert.ToDecimal(Session["PayableAmount"].ToString()), Convert.ToDateTime(tr.DateOfBooking.ToString()), tr.BookingID.ToString(), day1, tr.Name.ToString(), tr.EmailID.ToString(), tr.MobileNo.ToString(), tr.PaymentGateway.ToString(), false, "", Session["PackageType"].ToString(), transid.ToString(), Session["royalno"].ToString(), Convert.ToDecimal(Session["PackageTotal"].ToString()), Convert.ToDecimal(Session["TicketPaybale"].ToString()));
                                }
                                else if ((strarr[11] == "Weekend-Rs.13196" && ObjPromoSession.PromotionCode == "FAMILYOFFER") && strarr[4] == "GL")
                                {
                                    decimal pcktotal = 13196 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    Session["PackageTotal"] = pcktotal;
                                    decimal tckpaybale = 1200 * tr.TotalSeats;
                                    Session["TicketPaybale"] = tckpaybale;
                                    decimal amount = 7999 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    tr.TotalAmount = amount;
                                    tr.PayableAmount = amount;
                                    string date4 = tr.ShowDate.ToString();
                                    DateTime day1 = Convert.ToDateTime(date4);
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("values for Family Offer Weekend Package : " + Convert.ToInt16(Session["NoofPackages"]) + Convert.ToDecimal(Session["TotalAmount"].ToString()) + Convert.ToDecimal(Session["PayableAmount"].ToString()) + Convert.ToDateTime(tr.DateOfBooking.ToString()) + tr.BookingID.ToString() + day1 + tr.Name.ToString() + tr.EmailID.ToString() + tr.MobileNo.ToString() + tr.PaymentGateway.ToString() + false + "" + Session["PackageType"].ToString() + transid.ToString());
                                    transid = GTICKBOL.FAMILYOFFERBooking_Details(Convert.ToInt16(Session["NoofPackages"]), Convert.ToDecimal(Session["TotalAmount"].ToString()), Convert.ToDecimal(Session["PayableAmount"].ToString()), Convert.ToDateTime(tr.DateOfBooking.ToString()), tr.BookingID.ToString(), day1, tr.Name.ToString(), tr.EmailID.ToString(), tr.MobileNo.ToString(), tr.PaymentGateway.ToString(), false, "", Session["PackageType"].ToString(), transid.ToString(), Session["royalno"].ToString(), Convert.ToDecimal(Session["PackageTotal"].ToString()), Convert.ToDecimal(Session["TicketPaybale"].ToString()));
                                }
                            }
                        }
                        else if (ObjPromoSession.PromotionCode == "MMT")
                        {
                            if (strarr[11] != "")
                            {
                                if (strarr[11] == "4500" || ObjPromoSession.PromotionCode == "MMT")
                                {
                                    decimal amount = 4500 * (Convert.ToDecimal(Session["NoofPackages"]));
                                    tr.TotalAmount = amount;
                                    tr.PayableAmount = amount;
                                    DateTime day1 = Convert.ToDateTime(tr.ShowDate.ToString());
                                    transid = GTICKBOL.MMTBooking_Details(Convert.ToInt16(Session["NoofPackages"]), Session["pnr"].ToString(), sessionvalue[10], Convert.ToDecimal(Session["TotalAmount"].ToString()), Convert.ToDecimal(Session["PayableAmount"].ToString()), Convert.ToDateTime(tr.DateOfBooking.ToString()), tr.BookingID.ToString(), day1, tr.Name.ToString(), tr.EmailID.ToString(), tr.MobileNo.ToString(), tr.PaymentGateway.ToString(), false, "", transid.ToString());
                                }
                            }
                        }
                        else if (ObjPromoSession.PromotionCode == "OCTOBERFEST")
                        {
                            tr.TotalAmount = tr.TotalAmount / 2;
                            tr.PayableAmount = tr.TotalAmount;  
                        }
                        else if (ObjPromoSession.PromotionCode == "JHUMROOOFFER")
                        {
                            tr.TotalAmount = tr.TotalAmount / 2;
                            tr.PayableAmount = tr.TotalAmount;
                        }
                        
                        //else if (ObjPromoSession.PromotionCode == "MCOTHERS" && strarr[11] != "")
                        //{
                        //    if (strarr[11] != "")
                        //    {
                        //        if (strarr[11] == "5597" || ObjPromoSession.PromotionCode == "MCOTHERS")
                        //        {
                        //            decimal amount = 5597 * (Convert.ToDecimal(Session["MCOTHERSNOOFPACKAGE"]));
                        //            decimal totalamount = 6996 * (Convert.ToDecimal(Session["MCOTHERSNOOFPACKAGE"]));
                        //            tr.TotalAmount = amount;
                        //            tr.PayableAmount = amount;
                        //            DateTime day1 = Convert.ToDateTime(tr.ShowDate.ToString());
                        //            GTICKBOL.McPromotionBooking_Details(Convert.ToInt16(tr.TotalSeats), Convert.ToInt16(int.Parse(Session["MCOTHERSNOOFPACKAGE"].ToString())), Convert.ToDecimal(totalamount.ToString()), Convert.ToDecimal(tr.TotalAmount.ToString()), Convert.ToDateTime(tr.DateOfBooking.ToString()), tr.BookingID.ToString(), Convert.ToDateTime(tr.ShowDate.ToString()), tr.Name.ToString(), tr.EmailID.ToString(), tr.MobileNo.ToString(), tr.PaymentGateway.ToString(), false, "", "PACKAGE", tr.PromotionCode.ToString(), Session["NWPMCBANKNAME"].ToString(), Session["NWPMCCARDNO"].ToString(), Session["MCPROMOCODE"].ToString());
                        //        }
                        //    }
                        //}
                        else
                        {
                            DataTable prices = GTICKBOL.Get_AllSeatPrice_SeatKeyNoWise(tr.BookingID);
                            if (ObjPromoSession.PromotionCode == "YATRA")
                            {
                                if (strarr[4].ToString() == "GL" || strarr[4].ToString() == "SL")
                                {
                                    ObjPromoSession.DiscountPercentage = 15;
                                }
                                if (strarr[4].ToString() == "DM" || strarr[4].ToString() == "PL")
                                {
                                    ObjPromoSession.DiscountPercentage = 20;
                                }
                                tr.DiscountedAmount = decimal.Truncate(tr.DiscountedAmount);
                                if (tr.DiscountedAmount == 1274)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                else if (tr.DiscountedAmount == 2124)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                else if (tr.DiscountedAmount == 2974)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                else if (tr.DiscountedAmount == 4249)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                tr.DiscountedAmount = tr.DiscountedAmount;
                                transid = GTICKBOL.YATRABooking_Details(Convert.ToInt16(Session["NoofTickets"]), Session["yatrapnr"].ToString(), Session["promocode"].ToString(), strarr[4].ToString(), tr.DiscountPercentage, tr.TotalAmount, tr.DiscountedAmount, Convert.ToDateTime(tr.DateOfBooking.ToString()), tr.BookingID.ToString(), Convert.ToDateTime(tr.ShowDate.ToString()), tr.Name.ToString(), tr.EmailID.ToString(), tr.MobileNo.ToString(), tr.PaymentGateway.ToString(), false, "", transid.ToString());
                            }
                            if (ObjPromoSession.PromotionCode == "MCWORLD")
                            {
                                if (strarr[4].ToString() == "PL")
                                {
                                    ObjPromoSession.DiscountPercentage = 15;
                                }
                                if (strarr[4].ToString() == "DM")
                                {
                                    ObjPromoSession.DiscountPercentage = 25;
                                }
                                tr.DiscountedAmount = decimal.Truncate(tr.DiscountedAmount);
                                if (tr.DiscountedAmount == 1274)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                else if (tr.DiscountedAmount == 2124)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                else if (tr.DiscountedAmount == 2974)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                else if (tr.DiscountedAmount == 4249)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                tr.DiscountedAmount = tr.DiscountedAmount;
                                GTICKBOL.McPromotionBooking_Details(Convert.ToInt16(tr.TotalSeats), 0, Convert.ToDecimal(tr.TotalAmount), Convert.ToDecimal(tr.DiscountedAmount), Convert.ToDateTime(tr.DateOfBooking.ToString()), tr.BookingID.ToString(), Convert.ToDateTime(tr.ShowDate.ToString()), tr.Name.ToString(), tr.EmailID.ToString(), tr.MobileNo.ToString(), tr.PaymentGateway.ToString(), false, "", "TICKET", tr.PromotionCode.ToString(), Session["MCBANKNAME"].ToString(), Session["MCCARDNO"].ToString(), Session["worldcardpromocode"].ToString());
                            }
                            if (ObjPromoSession.PromotionCode == "MCOTHERS")
                            {
                                if (strarr[4].ToString() == "GL")
                                {
                                    ObjPromoSession.DiscountPercentage = 20;
                                }
                                if (strarr[4].ToString() == "SL")
                                {
                                    ObjPromoSession.DiscountPercentage = 15;
                                }
                                tr.DiscountedAmount = decimal.Truncate(tr.DiscountedAmount);
                                if (tr.DiscountedAmount == 1274)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                else if (tr.DiscountedAmount == 2124)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                else if (tr.DiscountedAmount == 2974)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                else if (tr.DiscountedAmount == 4249)
                                    tr.DiscountedAmount = tr.DiscountedAmount + 1;
                                tr.DiscountedAmount = tr.DiscountedAmount;
                                GTICKBOL.McPromotionBooking_Details(Convert.ToInt16(tr.TotalSeats), 0, Convert.ToDecimal(tr.TotalAmount), Convert.ToDecimal(tr.DiscountedAmount), Convert.ToDateTime(tr.DateOfBooking.ToString()), tr.BookingID.ToString(), Convert.ToDateTime(tr.ShowDate.ToString()), tr.Name.ToString(), tr.EmailID.ToString(), tr.MobileNo.ToString(), tr.PaymentGateway.ToString(), false, "", "TICKET", tr.PromotionCode.ToString(), Session["NWTMCBANKNAME"].ToString(), Session["NWTMCCARDNO"].ToString(), Session["MCPROMOCODE"].ToString());
                            }
                            tr.TotalAmount = 0;
                            if (prices != null)
                            {
                                foreach (DataRow dr in prices.Rows)
                                {
                                    decimal SinglePrice = decimal.Parse(dr[0].ToString());
                                    decimal DiscountedPrice = SinglePrice - (SinglePrice * ObjPromoSession.DiscountPercentage / 100);
                                    DiscountedPrice = decimal.Truncate(DiscountedPrice);
                                    if (DiscountedPrice == 1274)
                                        DiscountedPrice = DiscountedPrice + 1;
                                    else if (DiscountedPrice == 2124)
                                        DiscountedPrice = DiscountedPrice + 1;
                                    else if (DiscountedPrice == 2974)
                                        DiscountedPrice = DiscountedPrice + 1;
                                    else if (DiscountedPrice == 4249)
                                        DiscountedPrice = DiscountedPrice + 1;
                                    tr.TotalAmount += DiscountedPrice;
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discounted Price For a Ticket" + DiscountedPrice.ToString());
                                }
                            }
                        }
                        if (strarr[11] != "")
                        {
                            if (strarr[11] == "Rs.1275")
                            {
                                decimal amount = 500 * Convert.ToDecimal(tr.TotalSeats);
                                tr.TotalAmount = tr.TotalAmount + amount;
                                GTICKBOL.March_Promotion(tr.Category, tr.BookingID, tr.DateOfBooking, tr.TotalSeats, tr.TotalAmount, strarr[11], 0);
                            }
                            else if (strarr[11] == "Rs.4999")
                            {
                                decimal amount = 2501 * (Convert.ToDecimal(tr.TotalSeats) / 2);
                                tr.TotalAmount = tr.TotalAmount + amount;
                                GTICKBOL.March_Promotion(tr.Category, tr.BookingID, tr.DateOfBooking, tr.TotalSeats, tr.TotalAmount, strarr[11], 0);
                            }
                        }
                    }
                    //*******Promotion code send discounted AMOUNT to payment gateway changes END here **********
                    //*******Jhumroo Offer (1+1) code send discounted AMOUNT to payment gateway changes START here **********
                    //if (sessionvalue[1].ToString() == "JHUMROO" && (sessionvalue[4].ToString() == "GLY" || sessionvalue[4].ToString() == "SL" || sessionvalue[4].ToString() == "GL" || sessionvalue[4].ToString() == "PL" || sessionvalue[4].ToString() == "DM") && sessionvalue[10].ToString() == "" && Present <= End)
                    //{
                    //    decimal amount = Convert.ToDecimal(Session["PayableAmount"].ToString());
                    //    tr.TotalAmount = amount;
                    //    tr.PayableAmount = tr.TotalAmount;
                    //}
                    //*******Jhumroo Offer (1+1) code send discounted AMOUNT to payment gateway changes END here **********
                    if (transid > 0)
                    {
                        Session["AgentCode"] = null;
                        GTICKV.LogEntry(tr.BookingID.ToString(), "Data Successfully Written to Temp Transaction Table", "9", transid.ToString());

                        string URL = "";
                        //Pay Details , Sent To Loyalty Card Page --  CardType,TransID,Amt,ShowName
                        //Session["PayDetailsTemp"] = rblVoucher.SelectedValue + "|" + tr.BookingID.ToString() + "_" + transid + "~" + tr.AgentCode + "|" + tr.TotalAmount + "|" + tr.Play;
                        Session["PayDetailsTemp"] = tr.BookingID.ToString() + "_" + transid + "~" + tr.AgentCode + "|" + tr.TotalAmount + "|" + tr.Play;

                        if (ddlPaymentMode.SelectedValue == "CREDIT")
                        {
                            if (rbl_CardType.SelectedValue == "IDBI")
                            {
                                GTICKV.LogEntry(tr.BookingID.ToString(), "Sending to IDBI Payment Gateway", "12", transid.ToString());

                                /*******************Payement Gateway Error Value Code**********************/
                                #region PG_DB for Contact Details
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Contact Details Page PG_DB");
                                int i = GTICKBOL.Insert_Payment_DB("Sending to IDBI Payment Gateway and no logs trace after that", transid.ToString(), "IDBI");
                                #endregion PG_DB for Contact Details
                                /*********************End******************************/

                                URL = "Payment/Idbi/Default.aspx?type=idbi&transid=" + tr.BookingID.ToString() + "_" + transid + "~" + tr.AgentCode + "&amt=" + tr.TotalAmount
                                    + "&show=" + tr.Play;
                            }
                            else if (rbl_CardType.SelectedValue == "AMEX")
                            {
                                GTICKV.LogEntry(tr.BookingID.ToString(), "Sending to AMEX Payment Gateway", "12", transid.ToString());

                                /*******************Payement Gateway Error Value Code**********************/
                                #region PG_DB for Contact Details 
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Contact Details Page PG_DB");
                                int i = GTICKBOL.Insert_Payment_DB("Sending to AMEX Payment Gateway and no logs trace after that", transid.ToString(), "AMEX");
                                #endregion PG_DB for Contact Details
                                /*********************End******************************/

                                //tr.TotalAmount = 1;
                                if (ddl_country.SelectedValue == "india")
                                    URL = "Payment/Web/Default.aspx?type=amex&transid=" + tr.BookingID.ToString() + "_" + transid + "~" + tr.AgentCode + "&amt=" + tr.TotalAmount
                                        + "&show=" + tr.Play + "&title=" + "" + "&fname=" + "" + "&mname=" + "" + "&lname=" + "" + "&street=" + "NA" + "&city=" + "NA" + "&state=" + "NA" + "&pin=" + "NA" + "&country=" + "";
                                else
                                    URL = "Payment/Web/Default.aspx?type=amex&transid=" + tr.BookingID.ToString() + "_" + transid + "~" + tr.AgentCode + "&amt=" + tr.TotalAmount
                                            + "&show=" + tr.Play + "&title=" + tital + "&fname=" + fname + "&mname=" + mname + "&lname=" + lname + "&street=" + tr.Street + "&city=" + city + "&state=" + state + "&pin=" + tr.Pin + "&country=" + country;
                            }
                            //**************************************PAYTM GateWay*******************
                            else if (rbl_CardType.SelectedValue == "PAYTM")
                            {
                                //string payment_type_id = ddl_paymentmodetype.SelectedValue.ToString();
                                string payment_type_id;
                                string auth_mode;
                                if (Radio1.Checked == true || Radio2.Checked == true)
                                {
                                    auth_mode = "3D";
                                }
                                else
                                {
                                    auth_mode = "USRPWD";
                                }
                                if (Radio1.Checked)
                                {
                                    payment_type_id = "CC";
                                }
                                else if (Radio2.Checked)
                                {
                                    payment_type_id = "DC";
                                }
                                else if (Radio3.Checked)
                                {
                                    payment_type_id = "NB";
                                }
                                else
                                {
                                    payment_type_id = "PPI";
                                }
                                GTICKV.LogEntry(tr.BookingID.ToString(), "Sending to PAYTM Payment Gateway", "12", transid.ToString());

                                /*******************Payement Gateway Error Value Code**********************/
                                #region PG_DB for Contact Details
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Contact Details Page PG_DB");
                                int i = GTICKBOL.Insert_Payment_DB("Sending to PAYTM Payment Gateway and no logs trace after that", transid.ToString(), "PAYTM");
                                #endregion PG_DB for Contact Details
                                /*********************End******************************/
                                URL = "Payment/paytm/PostRequest.aspx?type=paytm&transid=" + tr.BookingID.ToString() + "Z" + transid + "Y" + tr.AgentCode + "&amt=" + tr.TotalAmount.ToString()
                                + "&payment_type_id=" + payment_type_id + "&auth_mode=" + auth_mode + "&name=" + tr.BookingID.ToString();

                            }
                            //**********************************************************************
                            else if (rbl_CardType.SelectedValue == "HDFC")
                            {
                                //string check = gb.HDFCLogCheck(transid.ToString()).Rows[0]["Amount"].ToString();
                                GTICKV.LogEntry(tr.BookingID.ToString(), "Sending to HDFC Payment Gateway", "12", transid.ToString());

                                /*******************Payement Gateway Error Value Code**********************/
                                #region PG_DB for Contact Details
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Contact Details Page PG_DB");
                                int i = GTICKBOL.Insert_Payment_DB("Sending to HDFC Payment Gateway and no logs trace after that", transid.ToString(), "HDFC");
                                #endregion PG_DB for Contact Details
                                /*********************End******************************/

                                string trackId, amount;
                                //Random Rnd = new Random();
                                //trackId = Rnd.Next().ToString();		//Merchant Track ID, this is as per merchant logic
                                trackId = tr.BookingID.ToString() + "_" + transid + "-" + tr.AgentCode;
                                Session["trackId"] = trackId;
                                amount = tr.TotalAmount.ToString();
                                Session["amount"] = amount;

                                String ErrorUrl = KoDTicketingIPAddress + "Payment/HDFC/Error.aspx";
                                String ResponseUrl = KoDTicketingIPAddress + "Payment/HDFC/ReturnReceipt.aspx";

                                //string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA&currencycode=356&amt=" + Server.UrlEncode(amount)
                                //    + "&responseURL=" + Server.UrlEncode(ResponseUrl) + "&errorURL=" + Server.UrlEncode(ErrorUrl)
                                //    + "&trackid=" + trackId
                                //    + "&udf1=TicketBooking&udf2=" + Server.UrlEncode(txtEmailAddress.Text.Trim())
                                //    + "&udf3=" + Server.UrlEncode(txtISDCode.Text + txtContactNo.Text) + "&udf4=" + Server.UrlEncode(txtAddress.Text.Trim()) + "&udf5=" + tr.BookingID;

                                string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA&currencycode=356&amt=" + amount
                                   + "&responseURL=" + Server.UrlEncode(ResponseUrl) + "&errorURL=" + Server.UrlEncode(ErrorUrl)
                                   + "&trackid=" + trackId
                                   + "&udf1=TicketBooking&udf2=" + txtEmailAddress.Text.Trim()
                                   + "&udf3=" + Server.UrlEncode(txtISDCode.Text.TrimStart('+') + txtContactNo.Text) + "&udf4=" + Server.UrlEncode(txtAddress.Text.Trim()) + "&udf5=" + tr.BookingID.ToString();

                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Preparing for HDFC Payment..." + qrystr);

                                //Writefile_new("\n***************Initial Request********************", Server.MapPath("~"));
                                //Writefile_new("\n\nDateTime:" + DateTime.Now.ToString("dd/MM/yy HH:mm:ss") + " Reference No:" + trackId + "Request XML:" + qrystr, Server.MapPath("~"));

                                System.IO.StreamWriter requestWriter = null;
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Redirecting for HDFC Payment..." + HDFCTransUrl);
                                System.Net.HttpWebRequest objRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(HDFCTransUrl);	//create a SSL connection object server-to-server
                                objRequest.Method = "POST";
                                objRequest.ContentLength = qrystr.Length;
                                objRequest.ContentType = "application/x-www-form-urlencoded";
                                objRequest.CookieContainer = new System.Net.CookieContainer();
                                try
                                {
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Processing request for HDFC Payment...");
                                    requestWriter = new System.IO.StreamWriter(objRequest.GetRequestStream());	// here the request is sent to payment gateway
                                    requestWriter.Write(qrystr);
                                }
                                catch (Exception ex)
                                {
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Excetion while processing HDFC payment: " + trackId + ex.Message);
                                    ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
                                }

                                if (requestWriter != null)
                                    requestWriter.Close();

                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Review validation response from HDFC Payment Gateway...");
                                System.Net.HttpWebResponse objResponse = (System.Net.HttpWebResponse)objRequest.GetResponse();

                                //System.Net.CookieContainer responseCookiesContainer = new System.Net.CookieContainer();
                                //foreach (System.Net.Cookie cook in objResponse.Cookies)
                                //{
                                //    responseCookiesContainer.Add(cook);
                                //}

                                using (System.IO.StreamReader sr =
                                       new System.IO.StreamReader(objResponse.GetResponseStream()))
                                {
                                    String NSDLval = sr.ReadToEnd();
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response: " + NSDLval);
                                    if (NSDLval.Contains("Invalid User Defined Field"))
                                    {
                                        GTICKV.LogEntry(tr.BookingID.ToString(), "Invalid cherecter is used by User.", "10", transid.ToString());
                                        //lblMess.Text = "The information submitted contains some invalid character, please avoid using [+,-,#] etc.";
                                        ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('The information submitted contains some invalid character, please avoid using [+,-,#] etc. Please start the transaction again');window.location.href='Default.aspx';</script>");
                                        return;
                                    }

                                    //Writefile_new("\n***************Initial Response********************", Server.MapPath("~"));
                                    //Writefile_new("\n\nDateTime:" + DateTime.Now.ToString("dd/MM/yy HH:mm:ss") + " Reference No:" + trackId + "Request XML:" + NSDLval, Server.MapPath("~"));
                                    if (NSDLval.IndexOf("http") == -1)
                                    {
                                        GTICKV.LogEntry(tr.BookingID.ToString(), "error in provided information", "11", transid.ToString());
                                        //lblMess.Text = "Payment cannot be processed with information provided.";
                                        ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Payment cannot be processed with information provided. Please start the transaction again');window.location.href='Default.aspx';</script>");
                                        return;
                                    }

                                    // gb.HDFCLog(transid.ToString(), "", trackId, "***Initial Response*** : " + NSDLval);                                
                                    string strPmtId = NSDLval.Substring(0, NSDLval.IndexOf(":http"));	// Merchant MUST map (update) the Payment ID received with the merchant Track Id in his database at this place.
                                    string strPmtUrl = NSDLval.Substring(NSDLval.IndexOf("http"));
                                    if (strPmtId != String.Empty && strPmtUrl != String.Empty)
                                    {
                                        URL = strPmtUrl.ToString() + "?PaymentID=" + strPmtId;
                                    }
                                    else
                                    {
                                        //lblMess.Text = "Invalid Response!";
                                        ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Invalid Response!. Please start the transaction again');window.location.href='Default.aspx';</script>");
                                    }
                                    sr.Close();
                                    TransactionBOL.Transaction_Temp_Insert_PaymentId(tr.BookingID, strPmtId);
                                }

                            }//HDFC
                        }
                        //else if (ddlPaymentMode.SelectedValue == "VOUCHER")
                        //{
                        //    Session["PayDetailsTemp"] = rblVoucher.SelectedValue + "|" + tr.BookingID.ToString() + "_" + transid + "~" + tr.AgentCode + "|" + tr.TotalSeats;
                        //    URL = "~/Payment/Voucher/Voucher.aspx";
                        //}
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Payment Redirection: " + URL);
                        Response.Redirect(URL, false);
                        Session[Decrypt(Request.QueryString["SessionId"])] = "";
                        
                    }
                    else
                    {
                        lblMess.Text = "Session Timeout. Please start the transaction again by clicking \"Back\" button";
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Session Timeout. Need to restart transaction");
                        ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
                    }
                }
                else //no Session[seat_val]
                {
                    ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
                }
                #endregion
            }
            catch (Exception ex)
            {
                GTICKV.LogEntry(tr.BookingID.ToString(), "Error Occurred - " + ex.Message.Replace("'", ""), "8", transid.ToString());
                ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
            }
        }
        else
        {
            Session.Clear();
            ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
        }
    }
Example #17
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tr"></param>
 /// <returns></returns>
 public static DataSet _Select_Report_SearchFromTransactionsTemp_DS(TransactionRecord tr)
 {
     SqlCommand command = new SqlCommand();
     string sqlQuery = "Create Table #_Total(RowNumber   Int,ID   bigint,BookingID bigint,ErrorTxt  nvarchar(max),PaymentGateway nvarchar(50))" +
         "Insert Into #_Total Select * From((SELECT * FROM (SELECT ROW_NUMBER() OVER (PARTITION BY bookingID  ORDER BY ID DESC) AS RowNumber,ID,BookingID,ErrorTxt,PaymentGateway FROM [dbo].[PG_DB]) T WHERE RowNumber = 1 ) )as k " +
         "SELECT row_number() over (order by a.ID desc) as SNO,a.ID as 'Booking ID', a.ReferenceNo as 'Receipt No',(Convert(nvarchar," +
         "a.[DateOfBooking],105)+' '+ Convert(nvarchar(5),a.[TimeOfBooking],108)) as [Booking Date] ,a.[Play], (Convert(nvarchar,a.[ShowDate],105)+" +
         "' '+ Convert(nvarchar(5),a.[ShowTime],108)) as [Show Date],a.[Category],a.[TotalSeats] as [Seats], a.[TotalAmount]," +
         "a.PaymentGateway as [Card Type],a.[Name] as [Customer Name],a.[MobileNo],a.[EmailID],Replace(a.[SeatInfo],',',', ') as [SeatInfo], a.[AgentCode],b.ErrorTxt,f.[Error_Detail] as [Utility Result] ";
     sqlQuery += " FROM [GINC$BookingTransaction_temp] as a left join #_Total as b ON cast(a.ID as nvarchar)=b.bookingID left join [IDBI_PG_Details] as f on a.ID=f.[Id] where a.id > 0 and a.bookingid <> a.ReferenceNo and a.id not in(select bookingid from [GINC$BookingTransaction]) " +
         "and a.id not in (select b.Id from [GINC$BookingTransaction] a join [GINC$MarchPromoTransactionCounter] b on a.bookingid=b.counter)";
     if (tr.AgentCode == "1")
         sqlQuery += " and a.AgentCode = 'WEB' ";
     if (tr.AgentCode == "2")
         sqlQuery += " and a.AgentCode != 'WEB' ";
     if (tr.BookingID != 0)
         sqlQuery += " and a.ID like '%" + tr.BookingID + "%'";
     if (tr.ReceiptNo != "0")
         sqlQuery += " and a.ReferenceNo like '%" + tr.ReceiptNo + "%'";
     if (tr.Name != "0")
         sqlQuery += " and  a.[Name] like '%" + tr.Name + "%' ";
     if (tr.DateOfBooking != "0")
         sqlQuery += " and  Convert(Datetime,a.[DateOfBooking]) >= Convert(datetime, '" + tr.DateOfBooking + "') ";
     if (tr.Location != "0")
         sqlQuery += " and  Convert(Datetime,a.[DateOfBooking]) <= Convert(datetime, '" + tr.Location + "') ";
     if (tr.ShowDate != "0")
         sqlQuery += " and  Convert(Datetime,a.[ShowDate]) >= Convert(datetime, '" + tr.ShowDate + "') ";
     if (tr.MobileNo != "0")
         sqlQuery += " and  Convert(Datetime,a.[ShowDate]) <= Convert(datetime, '" + tr.MobileNo + "')";
     sqlQuery += " ORDER BY a.ID";
     //string sqlQuery = "SELECT GINC$BookingTransaction_temp.ID, GINC$BookingTransaction_temp.Source, GINC$BookingTransaction_temp.DateOfBooking, GINC$BookingTransaction_temp.TimeOfBooking, GINC$BookingTransaction_temp.ShowDate, GINC$BookingTransaction_temp.ShowTime, GINC$BookingTransaction_temp.Play, GINC$BookingTransaction_temp.TotalAmount, GINC$BookingTransaction_temp.TotalSeats, GINC$BookingTransaction_temp.Category, GINC$BookingTransaction_temp.PaymentType, GINC$BookingTransaction_temp.CardType, GINC$BookingTransaction_temp.MobileNo, GINC$BookingTransaction_temp.EmailID, GINC$BookingTransaction_temp.Name, GINC$BookingTransaction_temp.PaymentGateway, GINC$BookingTransaction_temp.AgentCode, GINC$BookingTransaction_temp.Status, GINC$BookingTransaction_temp.SeatInfo FROM GINC$BookingTransaction_temp WHERE GINC$BookingTransaction_temp.ID NOT IN (SELECT GINC$BookingTransaction.BookingID FROM GINC$BookingTransaction WHERE GINC$BookingTransaction.DateOfBooking > '2012-05-01') and GINC$BookingTransaction_temp.DateOfBooking > '2012-05-01'";
     command.CommandText = sqlQuery;
     command.CommandTimeout = 6000;
     Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("unsucessfull query: " + sqlQuery);
     return Connection.readDataSet(command, connMSTicket);
 }
Example #18
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="TransactionID"></param>
        /// <param name="Source"></param>
        /// <param name="DateOfBooking"></param>
        /// <param name="TimeOfBooking"></param>
        /// <param name="Location"></param>
        /// <param name="Play"></param>
        /// <param name="ShowTime"></param>
        /// <param name="ShowDate"></param>
        /// <param name="Category"></param>
        /// <param name="PaymentType"></param>
        /// <param name="AgentCode"></param>
        /// <param name="SeatInfo"></param>
        /// <param name="MobileNo"></param>
        /// <param name="EmailID"></param>
        /// <param name="CustomerName"></param>
        /// <param name="TotalSeats"></param>
        /// <param name="TotalAmount"></param>
        /// <param name="strPaymentReceiptNo"></param>
        /// <returns></returns>
        public static DataSet funFinalBooking(TransactionRecord tr)
        {
            DataSet dsexcep = new DataSet();
            DataTable dtexcep = new DataTable();
            try
            {

                int intBookingID = 0;
                int isexecute = 0;
                DataSet objDataSet = new DataSet();
                SqlCommand command = new SqlCommand();
                try
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("funFinalBooking: Updating GCELL temp transaction table.");

                    command.CommandText = "if  not EXISTS (Select id from ginc$bookingTransaction_temp where BookingID =" + tr.BookingID + ")" +
                        " begin INSERT INTO [GINC$BookingTransaction_temp] ([BookingID],[ReferenceNo],[Source],[DateOfBooking],[TimeOfBooking]," +
                        " [Location],[Play],[ShowTime],[ShowDate],[Category],[TotalSeats],[TotalAmount],[PaymentType],[CardType],[CardNo]," +
                        " [MobileNo],[EmailID],[Name],[PaymentGateway],[AgentCode],[BookingType],[Status],[SeatInfo])VALUES (@BookingID," +
                        " @ReferenceNo,@Source,@DateOfBooking,@TimeOfBooking,@Location,@Play,@ShowTime,@ShowDate,@Category,@TotalSeats," +
                        "@TotalAmount,@PaymentType,@CardType,@CardNo,@MobileNo,@EmailID,@Name, @PaymentGateway,@AgentCode,@BookingType,@Status,@seatinfo)" +
                        " Select @@IDENTITY end else begin 	Select id from ginc$bookingTransaction_temp where BookingID =" + tr.BookingID + " end ";
                    command.Parameters.AddWithValue("@BookingID", tr.BookingID);
                    command.Parameters.AddWithValue("@ReferenceNo", tr.BookingID);
                    command.Parameters.AddWithValue("@Source", tr.Source);
                    command.Parameters.AddWithValue("@DateOfBooking", tr.DateOfBooking);
                    command.Parameters.AddWithValue("@TimeOfBooking", tr.TimeOfBooking);
                    command.Parameters.AddWithValue("@Location", tr.Location);
                    command.Parameters.AddWithValue("@Play", tr.Play);
                    command.Parameters.AddWithValue("@ShowTime", tr.ShowTime);
                    command.Parameters.AddWithValue("@ShowDate", tr.ShowDate);
                    command.Parameters.AddWithValue("@Category", tr.Category);
                    command.Parameters.AddWithValue("@TotalSeats", tr.TotalSeats);
                    command.Parameters.AddWithValue("@TotalAmount", tr.TotalAmount);
                    command.Parameters.AddWithValue("@PaymentType", tr.PaymentType);
                    command.Parameters.AddWithValue("@CardType", "NIL");
                    command.Parameters.AddWithValue("@CardNo", "1111222233334444");
                    command.Parameters.AddWithValue("@MobileNo", tr.MobileNo);
                    command.Parameters.AddWithValue("@EmailID", tr.EmailID);
                    command.Parameters.AddWithValue("@Name", tr.Name);
                    command.Parameters.AddWithValue("@PaymentGateway", "API");
                    command.Parameters.AddWithValue("@AgentCode", tr.AgentCode);
                    command.Parameters.AddWithValue("@BookingType", "Web-API");
                    command.Parameters.AddWithValue("@Status", "0");
                    command.Parameters.AddWithValue("@seatinfo", tr.SeatInfo);
                    objDataSet = Connection.APIreadDataSet(command, connMSTicket);
                    if (objDataSet.Tables.Count > 0)
                    {
                        if (objDataSet.Tables[0].Columns.Contains("Exception"))
                            return objDataSet;
                    }
                }
                catch (SqlException ex)
                {
                    //Log Message
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error in funFinalBooking: " + ex.Message);
                    dsexcep = new DataSet();
                    dtexcep.Columns.Add("Exception", typeof(string));
                    dtexcep.Rows.Add(ex.Message.ToString());
                    dsexcep.Tables.Add(dtexcep);
                    return dsexcep;
                    //return null;
                }

                DataTable dt = Connection.APIreadTab(command, connMSTicket);
                if (dt != null && dt.Rows.Count > 0 && !dt.Columns.Contains("Exception"))
                {
                    intBookingID = int.Parse(dt.Rows[0][0].ToString());
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Web-API Generated transaction ID: " + intBookingID.ToString());
                }
                else
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Web-API Not able to generate transaction ID");
                    dsexcep = new DataSet();
                    dtexcep.Columns.Add("Exception", typeof(string));
                    dtexcep.Rows.Add("Web-API Not able to generate transaction ID");
                    dsexcep.Tables.Add(dtexcep);
                    return dsexcep;
                }

                if (intBookingID != 0)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("funFinalBooking: Updating Booking Master.");
                    //Updating in the Booking Master
                    bool passed = false;
                    command = new SqlCommand();
                    command.CommandText = "Update " + table_BookingMaster + " WITH(HOLDLOCK,UPDLOCK) Set [Lock For Booking] = 1 , [Booked] = 1 ," +
                                          " [Web Booking ID] = " + intBookingID + " , [Payment Ref_ No_]= " + tr.ReceiptNo.ToUpper() + " , [Booking End Date_Time]='"
                                            + DateTime.Now.ToString("MM/dd/yyyy") + "', [Agent Code] = '" + tr.AgentCode + "' where [Agent Code] = '" + tr.BookingID + "'";
                    DataTable tempData = TransactionBOL.Select_Temptransaction_REFIDWISE(long.Parse(tr.BookingID.ToString()));
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Row Count : " + dt.Rows.Count);
                    if (tempData != null && tempData.Rows.Count > 0)
                    {
                        try
                        {
                            string WebPromotionID = tempData.Rows[0]["WebPromotionId"] != null ? tempData.Rows[0]["WebPromotionId"].ToString() : "";
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("WebPromotionID : " + WebPromotionID);
                            decimal TotalAmount = string.IsNullOrEmpty(tempData.Rows[0]["TotalAmount"].ToString()) ? 0 : Convert.ToDecimal(tempData.Rows[0]["TotalAmount"]);
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amount : " + TotalAmount);
                            string Play = tempData.Rows[0]["Play"] != null ? tempData.Rows[0]["Play"].ToString() : "";
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Play : " + Play);
                            string MobileNo = tempData.Rows[0]["MobileNo"] != null ? tempData.Rows[0]["MobileNo"].ToString() : "";
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mobile No. : " + MobileNo);
                            string BookingID = tempData.Rows[0]["ID"] != null ? tempData.Rows[0]["ID"].ToString() : "";
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Web Booking ID : " + BookingID);
                            string ReferenceNo = tempData.Rows[0]["BookingID"] != null ? tempData.Rows[0]["BookingID"].ToString() : "";
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Reference No. : " + ReferenceNo);
                            int Totalseats = string.IsNullOrEmpty(tempData.Rows[0]["TotalSeats"].ToString()) ? 0 : Convert.ToInt32(tempData.Rows[0]["TotalSeats"]);
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Total Seats : " + Totalseats);
                            string PaymentGateway = tempData.Rows[0]["PaymentGateway"] != null ? tempData.Rows[0]["PaymentGateway"].ToString() : "";
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("PG : " + PaymentGateway);
                            string AgentCode = tr.AgentCode != null ? tr.AgentCode.ToString() : "";
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Agent Code : " + AgentCode);
                            string AgentCodeSubcode = "";
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Agent Code Sub-code  : " + AgentCodeSubcode);
                            decimal DiscountPercentage = string.IsNullOrEmpty(tempData.Rows[0]["DiscountPercentage"].ToString()) ? 0 : Convert.ToDecimal(tempData.Rows[0]["DiscountPercentage"]);
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Discount % : " + DiscountPercentage);
                            string ReceiptNo = string.IsNullOrEmpty(tr.ReceiptNo.ToString()) ? "" : tr.ReceiptNo.ToString();
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Receipt No.  : " + ReceiptNo);
                            decimal AvailedAmount = string.IsNullOrEmpty(tempData.Rows[0]["AvailedAmount"].ToString()) ? 0 : Convert.ToDecimal(tempData.Rows[0]["AvailedAmount"]);
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Availed Amount  : " + AvailedAmount);
                            decimal AvailedPoints = string.IsNullOrEmpty(tempData.Rows[0]["AvailedPoints"].ToString()) ? 0 : Convert.ToDecimal(tempData.Rows[0]["AvailedPoints"]);
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Availed Points  : " + AvailedPoints);
                            string rowsEffected = TransactionBOL.Successful_BookingByMsTicket(TotalAmount, Play, MobileNo, ReferenceNo,
                                Totalseats, PaymentGateway, AgentCode, DiscountPercentage, ReceiptNo, AvailedAmount, AvailedPoints, BookingID, AgentCodeSubcode, WebPromotionID);
                            if (Convert.ToInt32(rowsEffected.ToString()) > 0)
                            {
                                isexecute = Convert.ToInt32(rowsEffected.ToString());
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("NMLIVEDB Updated from PG : " + PaymentGateway + " For Booking ID : " + intBookingID);
                                SqlCommand cmdlog = new SqlCommand("select [Pre Booking Receipt No_],[Booking ID] from [NMLIVEDB].[dbo].[Great Indian Nautanki Company$Booking Master]  where [Web Booking ID]='" + BookingID + "'", connWebBooking);
                                cmdlog.Connection.Open();
                                SqlDataAdapter dadplog = new SqlDataAdapter(cmdlog);
                                DataTable dtbllog = new DataTable();
                                dadplog.Fill(dtbllog);
                                if (dtbllog.Rows.Count > 0)
                                {
                                    for (int i = 0; i < dtbllog.Rows.Count; i++)
                                    {
                                        DataRow drlog = dtbllog.Rows[i];
                                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Updated pre booking recipt no in booking master and prebooking recipt no is " + drlog["Pre Booking Receipt No_"] + "," + drlog["Booking ID"]);
                                    }
                                }
                                else
                                {
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Unable to fetch information for web integration");
                                }
                                cmdlog.Connection.Close();
                            }
                            else
                            {
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Unable to update NMLIVEDB." + rowsEffected + " For Booking ID : " + intBookingID);
                                dsexcep = new DataSet();
                                dtexcep.Columns.Add("Exception", typeof(string));
                                dtexcep.Rows.Add("Unable to Update Table : " + rowsEffected);
                                dsexcep.Tables.Add(dtexcep);
                                return dsexcep;
                            }

                        }
                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Unable to update NMLIVEDB. " + ex.Message + " For Booking ID : " + intBookingID);
                            dsexcep = new DataSet();
                            dtexcep.Columns.Add("Exception", typeof(string));
                            dtexcep.Rows.Add("Unable to Update Table : " + ex.Message.ToString());
                            dsexcep.Tables.Add(dtexcep);
                            return dsexcep;
                        }
                    }
                    else
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("There is no Data in a row. For Booking ID : " + intBookingID);
                        dsexcep = new DataSet();
                        dtexcep.Columns.Add("Exception", typeof(string));
                        dtexcep.Rows.Add("There is no Data in a row");
                        dsexcep.Tables.Add(dtexcep);
                        return dsexcep;
                    }
                    try
                    {
                        //int isexecute = Connection.EXECommand(command, connWebBooking);
                        if (isexecute > 0)
                        {
                            passed = true;

                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("funFinalBooking: Updating GCELL transaction table.");
                            command = new SqlCommand();
                            command.CommandText = " insert into GINC$BookingTransaction ([BookingID] ,[ReferenceNo],[Source],[DateOfBooking],[TimeOfBooking]," +
                                "[Location],[Play],[ShowTime],[ShowDate],[Category],[TotalSeats],[TotalAmount],[PaymentType],[CardType],[CardNo]," +
                                "[MobileNo],[EmailID],[Name],[PaymentGateway],[AgentCode],[BookingType]  ,[Status],[SeatInfo],ReceiptNo) " +
                                "(SELECT  [ID]," + tr.BookingID + ",[Source],[DateOfBooking],[TimeOfBooking] ,[Location],[Play],[ShowTime],[ShowDate],[Category]," +
                                "[TotalSeats],[TotalAmount]  ,[PaymentType],[CardType],[CardNo],[MobileNo],[EmailID],[Name],[PaymentGateway] " +
                                ",[AgentCode],[BookingType],'True',[SeatInfo],'" + tr.AgentCode + "'  from [GINC$BookingTransaction_temp] where " +
                                "[BookingID] = " + tr.BookingID + ") Select @@IDENTITY";

                            dt = Connection.readTab(command, connMSTicket);

                            if (dt != null && dt.Rows.Count > 0)
                            {
                                string id = dt.Rows[0][0].ToString();
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Web-API Generated a Booking ID: " + id);
                            }
                            else
                            {
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("funFinalBooking: Unable to update GCELL transaction table.");
                                dsexcep = new DataSet();
                                dtexcep.Columns.Add("Exception", typeof(string));
                                dtexcep.Rows.Add("Unable to Update Table");
                                dsexcep.Tables.Add(dtexcep);
                                return dsexcep;
                            }
                        }
                        else
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("funFinalBooking: Unable to Update Booking Master Table. IsExecute : "+ isexecute);
                            dsexcep = new DataSet();
                            dtexcep.Columns.Add("Exception", typeof(string));
                            dtexcep.Rows.Add("Unable to Update Table");
                            dsexcep.Tables.Add(dtexcep);
                            return dsexcep;
                        }
                    }
                    catch (SqlException sqlE)
                    {
                        //Log Message
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error in funFinalBooking: " + sqlE.Message);
                        passed = false;
                        dsexcep = new DataSet();
                        dtexcep.Columns.Add("Exception", typeof(string));
                        dtexcep.Rows.Add(sqlE.Message.ToString());
                        dsexcep.Tables.Add(dtexcep);
                        return dsexcep;
                    }

                    if (!passed)
                    {
                        try
                        {
                            command = new SqlCommand();
                            command.CommandText = "Update " + table_BookingMaster + " WITH(HOLDLOCK,UPDLOCK) Set [Lock For Booking] = 0 , [Booked] = 0 ," +
                                                    " [Web Booking ID] ='', [Payment Ref_ No_]= '',[Booking Start Date_Time]='1753-01-01 00:00:00.000', [Booking End Date_Time]='1753-01-01 00:00:00.000', [Agent Code]='' where [Agent Code] = '" + tr.BookingID + "'";
                            Connection.EXECommand(command, connWebBooking);
                        }
                        catch (SqlException sqlE)
                        {
                            //Log Message that alternate failed too
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error in funFinalBooking: " + sqlE.Message);
                            dsexcep = new DataSet();
                            dtexcep.Columns.Add("Exception", typeof(string));
                            dtexcep.Rows.Add(sqlE.Message.ToString());
                            dsexcep.Tables.Add(dtexcep);
                            return dsexcep;
                        }
                    }

                }
                else
                {
                    try
                    {
                        command = new SqlCommand();
                        command.Parameters.Clear();
                        command.CommandText = "Update " + table_BookingMaster + " WITH(HOLDLOCK,UPDLOCK) Set [Lock For Booking] = 0 , [Booked] = 0 ," +
                                               " [Web Booking ID] ='', [Payment Ref_ No_]= '',[Booking Start Date_Time]='1753-01-01 00:00:00.000', [Booking End Date_Time]='1753-01-01 00:00:00.000', [Agent Code]='' where [Agent Code] = '" + tr.BookingID + "'";
                        Connection.EXECommand(command, connWebBooking);
                    }
                    catch (SqlException sqlE)
                    {
                        //Log Message 
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error in funFinalBooking: " + sqlE.Message);
                        dsexcep = new DataSet();
                        dtexcep.Columns.Add("Exception", typeof(string));
                        dtexcep.Rows.Add(sqlE.Message.ToString());
                        dsexcep.Tables.Add(dtexcep);
                        return dsexcep;
                    }

                }

                connWebBooking.Close();

                try
                {
                    command = new SqlCommand();
                    command.CommandText = "Select [ID],[BookingID],[ReferenceNo],[Source],[DateOfBooking],[TimeOfBooking],[Location],[Play],[ShowTime],[ShowDate],[Category],[TotalSeats],[TotalAmount],[Status],[SeatInfo] from GINC$BookingTransaction Where BookingID ='" + intBookingID + "'";
                    objDataSet = new DataSet();
                    objDataSet = Connection.readDataSet(command, connMSTicket);
                    return objDataSet;

                }
                catch (SqlException sqlE)
                {
                    //Log Message 
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error in funFinalBooking: " + sqlE.Message);
                    dsexcep = new DataSet();
                    dtexcep.Columns.Add("Exception", typeof(string));
                    dtexcep.Rows.Add(sqlE.Message.ToString());
                    dsexcep.Tables.Add(dtexcep);
                    return dsexcep;
                }
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error in funFinalBooking: " + ex.Message);
                dsexcep = new DataSet();
                dtexcep.Columns.Add("Exception", typeof(string));
                dtexcep.Rows.Add(ex.Message.ToString());
                dsexcep.Tables.Add(dtexcep);
                return dsexcep;
            }
            finally
            {
                connWebBooking.Close();
            }
            //return null;
        }
Example #19
0
 public static DataTable Get_Transaction_Detail(TransactionRecord tr)
 {
     return(TransactionDAL._Get_Transaction_Detail(tr));
 }
Example #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder();
        int qsCount = Request.QueryString.Count;

#region processreceipt
        if (qsCount > 0 && Request.QueryString["sta"] != null && Request.QueryString["tid"] != null)
        {
            TransactionRecord tr = new TransactionRecord();
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("IDBI Web payment transaction response [{0}]", Request.QueryString["sta"]));
            tr.Status = Request.QueryString["sta"].ToString().Equals("50020");
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Web payment transaction complete. Status: " + (tr.Status ? "Success" : "Failure"));

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

            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("IDBI Payment Response: Tokenization of reference string did not result in enough tokens. --> " + refNo);
                return;
            }

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

            string[] refSubTokens = refTokens[1].Split('~');

            if (refSubTokens.Length < 2)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Payment Response: Tokenization of reference substring did not result in enough sub tokens. --> " + refTokens[1].ToString());
                return;
            }

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

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Agent Code: " + refSubTokens[1]);
            tr.AgentCode = refSubTokens[1];
            #endregion parsereference
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Amount: " + Request.QueryString["amt"].ToString());
            tr.TotalAmount = decimal.Parse(Request.QueryString["amt"].ToString());
            try
            {
                if (true == tr.Status)
                {
                    HandleSuccess(ref tr, ref qstring);
                }
                else //failure
                {
                    GTICKV.LogEntry(tr.ReferenceNo.ToString(), "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());
                    GTICKV.LogEntry(tr.ReferenceNo.ToString(), "User Press Cancel Button", "15", tr.BookingID.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");
                }
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                HandleFailure(tr);
                qstring.Append("?err=seat");
            }
        }

 #endregion processreceipt

        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Transaction Complete. " + Request.QueryString["rec"]);
        Response.Redirect("../Print-Receipt.aspx" + qstring.ToString(), false);
    }
Example #21
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tr"></param>
        /// <returns></returns>
        public static DataSet _Select_Report_FromTransactionTable(TransactionRecord tr)
        {
            DataSet ds = new DataSet();
            SqlCommand command = new SqlCommand();
            string sqlQuery = "Select [Category],SUM([TotalSeats]) as [No Of Seats],SUM([TotalAmount]) as 'Total Amount' from [GINC$BookingTransaction] " +
                " where  id > 0 ";
            if (tr.AgentCode == "1")
                sqlQuery += " and AgentCode = 'WEB' ";
            if (tr.AgentCode == "2")
                sqlQuery += " and AgentCode != 'WEB' ";
            if (tr.BookingID != 0)
                sqlQuery += " and BookingID like '%" + tr.BookingID + "%'";
            if (tr.ReceiptNo != "0")
                sqlQuery += " and ReceiptNo like '%" + tr.ReceiptNo + "%'";
            if (tr.Name != "0")
                sqlQuery += " and  [Name] like '%" + tr.Name + "%' ";
            if (tr.DateOfBooking != "0")
                sqlQuery += " and  Convert(Datetime,[DateOfBooking]) >= Convert(datetime, '" + tr.DateOfBooking + "') ";
            if (tr.Location != "0")
                sqlQuery += " and  Convert(Datetime,[DateOfBooking]) <= Convert(datetime, '" + tr.Location + "') ";
            if (tr.ShowDate != "0")
                sqlQuery += " and  Convert(Datetime,[ShowDate]) >= Convert(datetime, '" + tr.ShowDate + "') ";
            if (tr.MobileNo != "0")
                sqlQuery += " and  Convert(Datetime,[ShowDate]) <= Convert(datetime, '" + tr.MobileNo + "')";
            sqlQuery += " GROUP BY [Category]  order by [Category] Select SUM([TotalSeats]) as [TotalSeats], SUM([TotalAmount])as TotalAmount" +
                ",PaymentGateway  from [GINC$BookingTransaction] where id > 0 ";
            if (tr.AgentCode == "1")
                sqlQuery += " and AgentCode = 'WEB' ";
            if (tr.AgentCode == "2")
                sqlQuery += " and AgentCode != 'WEB' ";
            if (tr.BookingID != 0)
                sqlQuery += " and BookingID like '%" + tr.BookingID + "%'";
            if (tr.ReceiptNo != "0")
                sqlQuery += " and ReceiptNo like '%" + tr.ReceiptNo + "%'";
            if (tr.Name != "0")
                sqlQuery += " and  [Name] like '%" + tr.Name + "%' ";
            if (tr.DateOfBooking != "0")
                sqlQuery += " and  Convert(Datetime,[DateOfBooking]) >= Convert(datetime, '" + tr.DateOfBooking + "') ";
            if (tr.Location != "0")
                sqlQuery += " and  Convert(Datetime,[DateOfBooking]) <= Convert(datetime, '" + tr.Location + "') ";
            if (tr.ShowDate != "0")
                sqlQuery += " and  Convert(Datetime,[ShowDate]) >= Convert(datetime, '" + tr.ShowDate + "') ";
            if (tr.MobileNo != "0")
                sqlQuery += " and  Convert(Datetime,[ShowDate]) <= Convert(datetime, '" + tr.MobileNo + "')";

            sqlQuery += "Group by PaymentGateway";
            command.CommandText = sqlQuery;
            return Connection.readDataSet(sqlQuery, connMSTicket);
        }
Example #22
0
    protected void btn_Submit_Click(object sender, EventArgs e)
    {
        TransactionRecord tr = new TransactionRecord();
        tr.VLBookingID = GTICKBOL.DandiyaBooking_Max();
        string Package = ddl_Package1.SelectedItem.ToString();
        int Quantity = Convert.ToInt16(ddl_Quantity.SelectedValue);
        string[] amt = Package.Split('.');
        decimal TotalAmount = Convert.ToDecimal(amt[1]) * Quantity;
        Session["TotalAmount" + tr.VLBookingID] = TotalAmount;
        Session["Quantity" + tr.VLBookingID] = Quantity;
        Session["Package" + tr.VLBookingID] = Package;
        Session["Name" + tr.VLBookingID] = txtName.Text;
        Session["Email" + tr.VLBookingID] = txtEmail.Text;
        Session["Contact" + tr.VLBookingID] = txtContact.Text;
        DateTime DateofBooking = DateTime.Now.Date;
        string ISDCode = "91";
        // String BookingID = KODVL00000; //for the FirstTime//
        Session["BookingID" + tr.VLBookingID] = tr.VLBookingID;
        tr.Quantity = Convert.ToInt16(Session["Quantity" + tr.VLBookingID]);
        tr.VLTotalAmount = Convert.ToDecimal(Session["TotalAmount" + tr.VLBookingID].ToString());
        MaxBookingId(Session["BookingID" + tr.VLBookingID].ToString());

        GTICKBOL.DandiyaBooking_Details(amt[1], Quantity, Convert.ToDecimal(Session["TotalAmount" + tr.VLBookingID].ToString()), DateofBooking, Session["BookingID" + tr.VLBookingID].ToString(), Session["Name" + tr.VLBookingID].ToString(), Session["Email" + tr.VLBookingID].ToString(), Session["Contact" + tr.VLBookingID].ToString(), false, "",ddl_Package1.SelectedItem.Text,ddldate.SelectedItem.Text);

        //********Payment GateWay Flow******//

        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(Session["BookingID" + tr.VLBookingID].ToString() + "Sending to HDFC Payment Gateway");
        string trackid, amount;
        string URL = "";
        trackid = Session["BookingID" + tr.VLBookingID].ToString();
        Session["trackid" + tr.VLBookingID] = trackid;
        amount = Session["TotalAmount" + tr.VLBookingID].ToString();
        Session["amount" + tr.VLBookingID] = amount;

        String ErrorUrl = KoDTicketingIPAddress + "DandiyaRaas/HDFC/Error.aspx";
        String ResponseUrl = KoDTicketingIPAddress + "DandiyaRaas/HDFC/ReturnReceipt.aspx";

        string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA&currencycode=356&amt=" + amount
          + "&responseURL=" + Server.UrlEncode(ResponseUrl) + "&errorURL=" + Server.UrlEncode(ErrorUrl)
          + "&trackid=" + trackid
          + "&udf1=TicketBooking&udf2=" + txtEmail.Text.Trim()
          + "&udf3=" + Server.UrlEncode(ISDCode.ToString().TrimStart('+') + txtContact.Text) + "&udf4=" + Server.UrlEncode(txtName.Text.Trim()) + "&udf5=" + tr.BookingID.ToString();

        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Preparing for HDFC Payment..." + qrystr);

        System.IO.StreamWriter requestWriter = null;
        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Redirecting for HDFC Payment..." + HDFCTransUrl);
        System.Net.HttpWebRequest objRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(HDFCTransUrl);	//create a SSL connection object server-to-server
        objRequest.Method = "POST";
        objRequest.ContentLength = qrystr.Length;
        objRequest.ContentType = "application/x-www-form-urlencoded";
        objRequest.CookieContainer = new System.Net.CookieContainer();

        try
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Processing request for HDFC Payment...");
            requestWriter = new System.IO.StreamWriter(objRequest.GetRequestStream());	// here the request is sent to payment gateway
            requestWriter.Write(qrystr);
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Excetion while processing HDFC payment: " + trackid + ex.Message);
        }

        if (requestWriter != null)
            requestWriter.Close();

        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Review validation response from HDFC Payment Gateway...");
        System.Net.HttpWebResponse objResponse = (System.Net.HttpWebResponse)objRequest.GetResponse();

        using (System.IO.StreamReader sr =
               new System.IO.StreamReader(objResponse.GetResponseStream()))
        {
            String NSDLval = sr.ReadToEnd();
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response: " + NSDLval);
            if (NSDLval.Contains("Invalid User Defined Field"))
            {
                lblMess.Text = "The information submitted contains some invalid character, please avoid using [+,-,#] etc.";
                return;
            }

            //Writefile_new("\n***************Initial Response********************", Server.MapPath("~"));
            //Writefile_new("\n\nDateTime:" + DateTime.Now.ToString("dd/MM/yy HH:mm:ss") + " Reference No:" + trackId + "Request XML:" + NSDLval, Server.MapPath("~"));
            if (NSDLval.IndexOf("http") == -1)
            {
                lblMess.Text = "Payment cannot be processed with information provided.";
                return;
            }

            // gb.HDFCLog(transid.ToString(), "", trackId, "***Initial Response*** : " + NSDLval);                                
            string strPmtId = NSDLval.Substring(0, NSDLval.IndexOf(":http"));	// Merchant MUST map (update) the Payment ID received with the merchant Track Id in his database at this place.
            string strPmtUrl = NSDLval.Substring(NSDLval.IndexOf("http"));
            if (strPmtId != String.Empty && strPmtUrl != String.Empty)
            {
                URL = strPmtUrl.ToString() + "?PaymentID=" + strPmtId;
            }
            else
            {
                lblMess.Text = "Invalid Response!";
            }
            sr.Close();
        }
        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Payment Redirection: " + URL);
        Response.Redirect(URL, false);

    }
Example #23
0
    protected void HandleFailure(TransactionRecord tr)
    {
        #region handlefailure

        String _refNo = tr.ReferenceNo.ToString();

        KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "IDBI 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]);
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error occurred processing unsuccessful payment through IDBI..." + ex.Message);
        }
        #endregion handlefailure
    }
Example #24
0
 public static DataSet Settle_Transaction_Details(TransactionRecord tr)
 {
     return(TransactionDAL._Settle_Transaction_Details(tr));
 }
Example #25
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
    }
Example #26
0
 public static DataSet Select_Report_FromTransactionTable(TransactionRecord tr)
 {
     return(TransactionDAL._Select_Report_FromTransactionTable(tr));
 }
Example #27
0
 public static int Transaction_Temp_Insert(TransactionRecord tr)
 {
     return TransactionDAL._Transaction_Temp_Insert(tr );
 }
Example #28
0
 public static DataSet Select_Report_SearchFromTransactionsTemp_DS(TransactionRecord tr)
 {
     return(TransactionDAL._Select_Report_SearchFromTransactionsTemp_DS(tr));
 }
Example #29
0
 public static DataSet Settle_Transaction_Details(TransactionRecord tr)
 {
     return TransactionDAL._Settle_Transaction_Details(tr);
 }
Example #30
0
 public static int _Voucher_Varification_Update(TransactionRecord r)
 {
     return(_Voucher_Varification_Update(r));
 }
Example #31
0
 public static DataTable Get_Transaction_Detail(TransactionRecord tr)
 {
     return TransactionDAL._Get_Transaction_Detail(tr);
 }
Example #32
0
 public static long Insert_tempTransaction_Table(TransactionRecord _tr)
 {
     return GTICKDAL._Insert_tempTransaction_Table(_tr.KeyNo, _tr.BookingID, _tr.TotalSeats, _tr.Category, _tr.SeatInfo, _tr.ShowDate, _tr.ShowTime);
 }
Example #33
0
 public static DataSet Select_Report_FromTransactionTable(TransactionRecord tr)
 {
     return TransactionDAL._Select_Report_FromTransactionTable(tr);
 }
    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;

            if (refNo.Length < 1)
            {
                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.SummerBookingID = refNo;
            //tr.AgentCode = refTokens[2];

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

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

            if (Request["paymentid"] != null)
            {
                try
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: " + Request["paymentid"].ToString());
                    tr.SummerReceiptNo = 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
                {
                    string summerBookingID = tr.SummerBookingID.ToString();
                    TransactionBOL.Get_Summer_Detail(tr.SummerBookingID, tr.SummerReceiptNo);
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Going to Fetch Details of Booking Id from DB.Booking ID where" + summerBookingID);
                    DataTable dt = TransactionBOL.Select_SummerTransaction_REFIDWISE(tr.SummerBookingID.ToString());
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Fetched Details of Booking Id from DB.Booking ID where" + summerBookingID);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Fetched Details of Booking Id from DB.Booking ID where" + dt.Rows[0]);
                        try
                        {

                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Seats booked against HDFC payment.");
                            qstring.Append("?b=");
                            qstring.Append(tr.SummerBookingID.ToString());
                            ReceiptUtils.SummerPaymentResponse(dt.Rows[0], tr.SummerReceiptNo.ToString(), tr.SummerBookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId"), ConfigurationManager.AppSettings.Get("ConcertRefMailId1"));
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment successful..." + tr.SummerBookingID.ToString() + tr.SummerReceiptNo.ToString());
                            // GTICKV.LogEntry("HDFC Payment successful...", "10", tr.BookingID.ToString(), tr.ReceiptNo.ToString());

                        }
                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error processing receipt post booking. " + ex.Message);
                            ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                            //ReceiptUtils.SuccessPaymentResponse(tr.SummerBookingID.ToString(), tr.SummerReceiptNo);
                            qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                        }
                        return qstring.ToString();
                    }
                    else
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC successful booking but ask customer to call"); ;
                        long BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                        DataTable dt1 = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                        ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                        //ReceiptUtils.SuccessPaymentResponse(tr.SummerBookingID.ToString(), tr.SummerReceiptNo);
                        qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                    }
                }
                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.MMTBookingID.ToString();
                KoDTicketing.GTICKV.LogEntry(_refNo, "HDFC Payment Not Successful", "17", tr.SummerBookingID.ToString());
                //GTICKBOL.ON_Session_out(_refNo);
                KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "18", tr.SummerBookingID.ToString());
                qstring.Append("err=pay");

                KoDTicketing.GTICKV.LogEntry(tr.SummerReceiptNo.ToString(), "HDFC Error Occurred -- Payment Not Successful", "19", tr.SummerBookingID.ToString());
                string BookingID = tr.SummerBookingID.ToString();
                try
                {
                    DataTable dt = TransactionBOL.Select_SummerTransaction_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 + "SumerCamp/HDFC/FinalCall.aspx" + qstring.ToString(), false);
                #endregion
            }
            else
            {
                GTICKV.LogEntry(tr.SummerReceiptNo.ToString(), "HDFC Payment Not Successful", "17", tr.SummerBookingID.ToString());
                //GTICKBOL.ON_Session_out(tr.ReferenceNo.ToString());
                GTICKV.LogEntry(tr.SummerReceiptNo.ToString(), "Seats Unlocked", "18", tr.SummerBookingID.ToString());
                long BookingID = long.Parse(tr.ReferenceNo.ToString());
                DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                qstring.Append("?err=pay");
            }
        }
Example #35
0
 public static DataTable Select_Report_SearchFromTransactions(TransactionRecord tr)
 {
     return TransactionDAL._Select_Report_SearchFromTransactions(tr);
 }
Example #36
0
 public static long Insert_tempTransaction_Table(TransactionRecord _tr)
 {
     return(GTICKDAL._Insert_tempTransaction_Table(_tr.KeyNo, _tr.BookingID, _tr.TotalSeats, _tr.Category, _tr.SeatInfo, _tr.ShowDate, _tr.ShowTime));
 }
Example #37
0
 public static DataSet Select_Report_SearchFromTransactionsTemp_DS(TransactionRecord tr)
 {
     return TransactionDAL._Select_Report_SearchFromTransactionsTemp_DS(tr);
 }
Example #38
0
        public static long InsertAgentBooking_Details(TransactionRecord tr)
        {
            
            SqlCommand command = new SqlCommand();
            string sqlQuery = "if not EXISTS(select ReferenceNo from [dbo].[tbl_Booking_Detail_Agent] where [ReferenceNo]=" + tr.ReferenceNo + ")"
                + "begin INSERT INTO [MSTicketDB_Live_Latest].[dbo].[tbl_Booking_Detail_Agent] (Agent_UserName,ReferenceNo,BookingID,BookingDate,TimeOfBooking,Location,Play,ShowTime,ShowDate,Category,TotalSeats,TotalAmount,SeatNo,BookingPerson,Status,Payableamount) VALUES "
            + "('" + tr.AgentCode + "'," + tr.ReferenceNo + "," + tr.BookingID + ",'" + tr.DateOfBooking + "','" + tr.TimeOfBooking + "','" + tr.Location + "','" + tr.Play + "','" + tr.ShowTime + "','" + tr.ShowDate + "','" + tr.Category + "','" + tr.TotalSeats + "','" + tr.TotalAmount + "','" + tr.SeatInfo + "','" + tr.Name + "','" + 0 + "','" + tr.TotalAmount + "')" + "select ReferenceNo from [dbo].[tbl_Booking_Detail_Agent] where [ReferenceNo]=" + tr.ReferenceNo + " end else begin select ReferenceNo from [dbo].[tbl_Booking_Detail_Agent] where [ReferenceNo]=" + tr.ReferenceNo + " end";
            command.CommandText = sqlQuery;
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Insert MaX Of Booking ID and Its Details");
            //Connection.EXECommand(command, connMSTicket);
            DataTable dt = Connection.readTab(command, connMSTicket);
            if (dt.Rows.Count > 0)
            {
                return long.Parse(dt.Rows[0][0].ToString());
            }
            else
            {

                return -1;
            }
        }
Example #39
0
        public static int _Voucher_Varification_Update(TransactionRecord r)
        {
            return _Voucher_Varification_Update(r);

        }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Session["Name"] = txtName.Text;
        Session["Email"] = txtEmailAddress.Text;
        Session["ContactNo"] = txtContactNo.Text;
        //Session["Paymentgateway"] = rbl_CardType.SelectedValue;
        Session["Paymentgateway"] ="HDFC";
        Decimal TotalAmount = Convert.ToDecimal(Session["TotalAmount"].ToString());
        Decimal PayableAmount = Convert.ToDecimal(Session["PayableAmount"].ToString());
        DateTime DateofBooking = DateTime.Now.Date;
        string ISDCode = "91";
        TransactionRecord tr = new TransactionRecord();
        tr.SummerBookingID = GTICKBOL.SummerBooking_Max();
        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(tr.SummerBookingID.ToString() + "booking id");
        Session["BookingID"] = tr.SummerBookingID;
        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(tr.SummerBookingID.ToString() + "booking id");
        tr.SummerPayableAmount = Convert.ToDecimal(Session["PayableAmount"].ToString());
        //DateTime day = Convert.ToDateTime(Session["day"]);
        MaxBookingId();
        //GTICKBOL.MMTBooking_Details(Convert.ToInt16(Session["NoofPackages"]), Session["pnr"].ToString(), Session["promocode"].ToString(), Convert.ToDecimal(Session["TotalAmount"].ToString()), Convert.ToDecimal(Session["PayableAmount"].ToString()), DateofBooking, Session["BookingID"].ToString(), day, Session["Name"].ToString(), Session["Email"].ToString(), Session["ContactNo"].ToString(), Session["Paymentgateway"].ToString(), false, "");
        GTICKBOL.SummerBooking_Details(Convert.ToInt16(Session["NoofTickets"]), Convert.ToDecimal(Session["TotalAmount"].ToString()), Convert.ToDecimal(Session["PayableAmount"].ToString()), DateofBooking, Session["BookingID"].ToString(),Session["Name"].ToString(), Session["Email"].ToString(), Session["ContactNo"].ToString(), Session["Paymentgateway"].ToString(), false, "");
        ////Parameters for AMEX.........................
        //string Street = txt_street.Text;
        //string Pin = txt_pin.Text;
        //string Country = ddl_country.SelectedValue;
        //string tital = Ddl_title.SelectedValue;
        //string fname = Txtfname.Text;
        //string mname = Txtmname.Text;
        //string lname = Txtlname.Text;
        //string city = Txtcity.Text;
        //string state = Txtstate.Text;
        //string country = txt_country.SelectedValue;


        string trackId, amount;

        trackId = Session["BookingID"].ToString();
        Session["trackId"] = trackId;
        amount = Session["PayableAmount"].ToString();
        Session["amount"] = amount;
        //if (rbl_CardType.SelectedValue == "IDBI")
        //{
        //    string URL = "";
        //    GTICKV.LogEntry(tr.BookingID.ToString(), "Sending to IDBI Payment Gateway", "8", trackId.ToString());
        //    URL = "Idbi/Default.aspx?type=idbi&transid=" + trackId+"~SummerCamp" + "&amt=" + tr.SummerPayableAmount
        //        + "&show=" + "SummerCamp";
        //    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("url="+URL);
        //    Response.Redirect(URL, false);
        //}
        // Session["PayDetailsTemp"] = tr.BookingID.ToString() + "_" + trackId + "~" + "web" + "|" + tr.MMTPayableAmount + "|" + "Jhumroo";


       // if (rbl_CardType.SelectedValue == "HDFC")
        //{
            string URL = "";
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(Session["BookingID"].ToString() + "Sending to HDFC Payment Gateway");
            //GTICKV.LogEntry(tr.NYBookingID.ToString(), "Sending to HDFC Payment Gateway", "8", "");


            String ErrorUrl = KoDTicketingIPAddress + "SumerCamp/HDFC/Error.aspx";
            String ResponseUrl = KoDTicketingIPAddress + "SumerCamp/HDFC/ReturnReceipt.aspx";

            //string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA&currencycode=356&amt=" + Server.UrlEncode(amount)
            //    + "&responseURL=" + Server.UrlEncode(ResponseUrl) + "&errorURL=" + Server.UrlEncode(ErrorUrl)
            //    + "&trackid=" + trackId
            //    + "&udf1=TicketBooking&udf2=" + Server.UrlEncode(txtEmailAddress.Text.Trim())
            //    + "&udf3=" + Server.UrlEncode(txtISDCode.Text + txtContactNo.Text) + "&udf4=" + Server.UrlEncode(txtAddress.Text.Trim()) + "&udf5=" + tr.BookingID;

            string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA&currencycode=356&amt=" + amount
               + "&responseURL=" + Server.UrlEncode(ResponseUrl) + "&errorURL=" + Server.UrlEncode(ErrorUrl)
               + "&trackid=" + trackId
               + "&udf1=TicketBooking&udf2=" + txtEmailAddress.Text.Trim()
               + "&udf3=" + Server.UrlEncode(ISDCode.ToString().TrimStart('+') + txtContactNo.Text) + "&udf4=" + Server.UrlEncode(txtName.Text.Trim()) + "&udf5=" + tr.SummerBookingID.ToString();

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Preparing for HDFC Payment..." + qrystr);

            //Writefile_new("\n***************Initial Request********************", Server.MapPath("~"));
            //Writefile_new("\n\nDateTime:" + DateTime.Now.ToString("dd/MM/yy HH:mm:ss") + " Reference No:" + trackId + "Request XML:" + qrystr, Server.MapPath("~"));

            System.IO.StreamWriter requestWriter = null;
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Redirecting for HDFC Payment..." + HDFCTransUrl);
            System.Net.HttpWebRequest objRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(HDFCTransUrl);	//create a SSL connection object server-to-server
            objRequest.Method = "POST";
            objRequest.ContentLength = qrystr.Length;
            objRequest.ContentType = "application/x-www-form-urlencoded";
            objRequest.CookieContainer = new System.Net.CookieContainer();
            try
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Processing request for HDFC Payment...");
                requestWriter = new System.IO.StreamWriter(objRequest.GetRequestStream());	// here the request is sent to payment gateway
                requestWriter.Write(qrystr);
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Excetion while processing HDFC payment: " + trackId + ex.Message);
            }

            if (requestWriter != null)
                requestWriter.Close();

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Review validation response from HDFC Payment Gateway...");
            System.Net.HttpWebResponse objResponse = (System.Net.HttpWebResponse)objRequest.GetResponse();

            //System.Net.CookieContainer responseCookiesContainer = new System.Net.CookieContainer();
            //foreach (System.Net.Cookie cook in objResponse.Cookies)
            //{
            //    responseCookiesContainer.Add(cook);
            //}

            using (System.IO.StreamReader sr =
                   new System.IO.StreamReader(objResponse.GetResponseStream()))
            {
                String NSDLval = sr.ReadToEnd();
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response: " + NSDLval);
                if (NSDLval.Contains("Invalid User Defined Field"))
                {
                    lblMess.Text = "The information submitted contains some invalid character, please avoid using [+,-,#] etc.";
                    return;
                }

                //Writefile_new("\n***************Initial Response********************", Server.MapPath("~"));
                //Writefile_new("\n\nDateTime:" + DateTime.Now.ToString("dd/MM/yy HH:mm:ss") + " Reference No:" + trackId + "Request XML:" + NSDLval, Server.MapPath("~"));
                if (NSDLval.IndexOf("http") == -1)
                {
                    lblMess.Text = "Payment cannot be processed with information provided.";
                    return;
                }

                // gb.HDFCLog(transid.ToString(), "", trackId, "***Initial Response*** : " + NSDLval);                                
                string strPmtId = NSDLval.Substring(0, NSDLval.IndexOf(":http"));	// Merchant MUST map (update) the Payment ID received with the merchant Track Id in his database at this place.
                string strPmtUrl = NSDLval.Substring(NSDLval.IndexOf("http"));
                if (strPmtId != String.Empty && strPmtUrl != String.Empty)
                {
                    URL = strPmtUrl.ToString() + "?PaymentID=" + strPmtId;
                }
                else
                {
                    lblMess.Text = "Invalid Response!";
                }
                sr.Close();
            }
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Payment Redirection: " + URL);
            Response.Redirect(URL, false);


       // }
        //else if (rbl_CardType.SelectedValue == "AMEX")
        //{
        //    string URL = "";

        //    GTICKV.LogEntry(tr.BookingID.ToString(), "Sending to AMEX Payment Gateway", "8", trackId.ToString());
        //    if (ddl_country.SelectedValue == "india")
        //        URL = "AMEX/Default.aspx?type=amex&transid=" + trackId + "&amt=" + tr.MMTPayableAmount
        //            + "&show=" + "" + "&title=" + "" + "&fname=" + "" + "&mname=" + "" + "&lname=" + "" + "&street=" + "NA" + "&city=" + "NA" + "&state=" + "NA" + "&pin=" + "NA" + "&country=" + "";
        //    else
        //        URL = "AMEX/Default.aspx?type=amex&transid=" + trackId + "&amt=" + tr.MMTPayableAmount
        //                + "&show=" + "" + "&title=" + tital + "&fname=" + fname + "&mname=" + mname + "&lname=" + lname + "&street=" + Street + "&city=" + city + "&state=" + state + "&pin=" + Pin + "&country=" + country;
        //    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Payment Redirection: " + URL);
        //    Response.Redirect(URL, false);
        //    Response.Redirect(URL, false);
        //}
    }
Example #41
0
 public static long InsertAgentBooking_Details(TransactionRecord tr)
 {
     return(GTICKDAL.InsertAgentBooking_Details(tr));
 }