protected void btnBackHome_Click(object sender, EventArgs e) { GTICKBOL gb = new GTICKBOL(); if (Session["Seat_TransactionID"] != null) { String KeyNo = Session["Seat_TransactionID"].ToString(); GTICKBOL.ON_Session_out(KeyNo); } Server.Transfer("../../Default.aspx"); }
public static string Set_Status(string AuditNo, string ShowName, string ShowLocation, string ShowDate, string ShowTime, string Iscompleted) { int i = GTICKBOL.Set_finalstatus(Convert.ToInt32(AuditNo), ShowName, ShowLocation, DateTime.Now.ToString("dd/MM/yyyy"), ShowTime, 1); if (i != 0) { return("true"); } else { return("false"); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// protected void btn_Submit_Click(object sender, EventArgs e) { long TransectionCounter = GTICKBOL.TransactionCounter_Max(); Session[TransectionCounter.ToString()] = TransectionCounter; Session["play_Val"] = ddl_Play.SelectedValue; Session["play_Val_Location"] = ddl_Location.SelectedItem; Session_value = ddl_Location.SelectedValue + "," + ddl_Play.SelectedValue + "," + Convert.ToDateTime(dateofshow.Text.ToString()).ToString("dd/MM/yyyy") + "," + ddl_ShowTimes.SelectedValue + "," + ddl_Category.SelectedValue + "," + drp_TotalSeats.SelectedValue + "," + ddl_Location.SelectedItem.Text + "," + ddl_ShowTimes.SelectedItem.Text + "," + ddl_Category.SelectedItem.Text + "," + "JHUMROOOFFER" + "," + "" + "," + TransectionCounter;; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Render Seat Layout for " + Session_value); GTICKBOL.Insert_ShowDetail(Session_value, TransectionCounter); Session["a" + "JHUMROOOFFER"] = ""; Response.Redirect("Seat-Layout.aspx?SessionId=" + Encrypt(TransectionCounter.ToString()), false); }
protected void btnBackHome_Click(object sender, EventArgs e) { if (Session["Seat_TransactionID"] != null) { String KeyNo = Session["Seat_TransactionID"].ToString(); GTICKBOL.ON_Session_out(KeyNo); } string password = "******"; String RoyalBal = Session["RBal"].ToString(); String RoyalPoints = Session["RPoints"].ToString(); String FN = Session["FirstName"].ToString(); String LN = Session["LastName"].ToString(); String Email = Session["EmailID"].ToString(); String MobNo = Session["MobileNo"].ToString(); String Address = Session["Address"].ToString(); String RegID = Session["Regid"].ToString(); Response.Redirect("TicketBooking.aspx?RemainingAmount=" + Server.UrlEncode(Common.Encrypt(RoyalBal, password)) + "&RemainingPoints=" + Server.UrlEncode(Common.Encrypt(RoyalPoints, password)) + "&FirstName=" + Server.UrlEncode(Common.Encrypt(FN, password)) + "&LastName=" + Server.UrlEncode(Common.Encrypt(LN, password)) + "&Email=" + Server.UrlEncode(Common.Encrypt(Email, password)) + "&Mobile=" + Server.UrlEncode(Common.Encrypt(MobNo, password)) + "&Address=" + Server.UrlEncode(Common.Encrypt(Address, password)) + "&MemberShipId=" + Server.UrlEncode(Common.Encrypt(RegID, password)), false); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// protected void btn_Submit_Click(object sender, EventArgs e) { long TransectionCounter = GTICKBOL.TransactionCounter_Max(); Session[TransectionCounter.ToString()] = TransectionCounter; if (Request.QueryString["Router"] == "" || Request.QueryString["Router"] == null) { Session["Router"] = ""; } else if (Request.QueryString["Router"] != "buzzintown") { Session["Router"] = ""; } else { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Booking Through" + Request.QueryString["Router"].ToString()); Session["Router"] = Request.QueryString["Router"].ToString(); } //***************if routed from other website***************** //**************************************************************** Session["play_Val"] = ddl_Play.SelectedValue; Session["play_Val_Location"] = ddl_Location.SelectedItem; Session_value = ddl_Location.SelectedValue + "," + ddl_Play.SelectedValue + "," + Convert.ToDateTime(dateofshow.Text.ToString()).ToString("dd/MM/yyyy") + "," + ddl_ShowTimes.SelectedValue + "," + ddl_Category.SelectedValue + "," + drp_TotalSeats.SelectedValue + "," + ddl_Location.SelectedItem.Text + "," + ddl_ShowTimes.SelectedItem.Text + "," + ddl_Category.SelectedItem.Text + "," + "OCTOBERFEST" + "," + "" + "," + TransectionCounter;; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Render Seat Layout for " + Session_value); GTICKBOL.Insert_ShowDetail(Session_value, TransectionCounter); if (Request.QueryString["Router"] == "buzzintown") { Session["a" + "OCTOBERFEST"] = ""; Response.Redirect("Seat-Layout.aspx?SessionId=" + Encrypt(TransectionCounter.ToString()) + "&Router=" + Request.QueryString["Router"], false); } else { Session["a" + "OCTOBERFEST"] = ""; Response.Redirect("Seat-Layout.aspx?SessionId=" + Encrypt(TransectionCounter.ToString()), false); } }
protected void Login_Authenticate(object sender, AuthenticateEventArgs e) { string username = Login.UserName; string pwd = Login.Password; string sqlUserName = "******" + username + "' and password = '******' and " + "Status = 1"; System.Data.DataTable dt = Connection.readTab(sqlUserName, DBAccess.connMSTicket); if (dt != null && dt.Rows.Count > 0) { string ip = GetIP(); GTICKBOL.Update_AgentLogin(username, pwd, ip); Session["Agent"] = username; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Agent login: "******"AgentProfile.aspx", false); } else { Session["UserAuthentication"] = ""; Message.Text = "Sorry! Your login or password is incorrect. <br>Please log in again."; } }
public static string InsertMethod_Vacant(object myData_vaccant) { string check = ""; JavaScriptSerializer js = new JavaScriptSerializer(); List <jdata> myformElement = js.Deserialize <List <jdata> >(myData_vaccant.ToString()); DataTable dt_insertvaccant = new DataTable(); dt_insertvaccant.Columns.Add("timestamp", typeof(string)); dt_insertvaccant.Columns.Add("SeatID", typeof(string)); dt_insertvaccant.Columns.Add("AuditNo", typeof(int)); dt_insertvaccant.Columns.Add("ShowName", typeof(string)); dt_insertvaccant.Columns.Add("ShowLocation", typeof(string)); dt_insertvaccant.Columns.Add("ShowDate", typeof(string)); dt_insertvaccant.Columns.Add("ShowTime", typeof(string)); dt_insertvaccant.Columns.Add("Status", typeof(string)); dt_insertvaccant.Columns.Add("Remark", typeof(string)); dt_insertvaccant.Columns.Add("EditTime", typeof(DateTime)); dt_insertvaccant.Columns.Add("SeatDescription", typeof(string)); dt_insertvaccant.Columns.Add("IsCompleted", typeof(int)); dt_insertvaccant.Columns.Add("Category", typeof(string)); dt_insertvaccant.Columns.Add("ERPStatus", typeof(string)); foreach (var vac in myformElement) { dt_insertvaccant.Rows.Add("", vac.SeatID, Convert.ToInt32(vac.AuditNo), vac.ShowName, vac.ShowLocation, DateTime.Now.ToString("dd/MM/yyyy"), vac.ShowTime, vac.Status, vac.Remark, DateTime.Now.ToString(), vac.SeatDescription, Convert.ToInt32(vac.Iscompleted), vac.Category, vac.ERPStatus); check = vac.SeatID.Substring(0, 1); } int i = GTICKBOL.Delete_audit(check); int j = GTICKBOL.Update_audit(dt_insertvaccant); if (j == 0) { return("false"); } else { return("true"); } }
protected void btn_Submit_Click(object sender, EventArgs e) { DataTable dt = TransactionBOL.Check_BotyTransaction(entryid.Text); if (dt.Rows.Count == 0) { decimal TotalAmount = Convert.ToDecimal("1000"); DateTime DateofBooking = DateTime.Now.Date; string ISDCode = "91"; // String BookingID = KODVL00000; //for the FirstTime// TransactionRecord tr = new TransactionRecord(); tr.VLBookingID = GTICKBOL.BotyBooking_Max(); tr.VLTotalAmount = Convert.ToDecimal(TotalAmount); string vlbookingid = MaxBookingId(tr.VLBookingID.ToString()); tr.VLBookingID = vlbookingid; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(tr.VLBookingID.ToString() + " booking id for boty which have entry id " + Request.QueryString["entry_id"]); int enrty = GTICKBOL.BotyBooking_Details(frmid.Text, entryid.Text, TotalAmount, DateofBooking, tr.VLBookingID.ToString(), false, ""); //********Payment GateWay Flow******// Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(tr.VLBookingID.ToString() + "Sending to HDFC Payment Gateway"); string trackid, amount; string URL = ""; trackid = tr.VLBookingID.ToString(); Session["trackid"] = trackid; amount = TotalAmount.ToString(); String ErrorUrl = KoDTicketingIPAddress + "Boty/HDFC/Error.aspx"; String ResponseUrl = KoDTicketingIPAddress + "Boty/HDFC/ReturnReceipt.aspx"; string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA¤cycode=356&amt=" + amount + "&responseURL=" + Server.UrlEncode(ResponseUrl) + "&errorURL=" + Server.UrlEncode(ErrorUrl) + "&trackid=" + trackid + "&udf1=TicketBooking&udf2=" + "".Trim() + "&udf3=" + Server.UrlEncode(ISDCode.ToString().TrimStart('+') + "") + "&udf4=" + Server.UrlEncode("".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); if (enrty > 0) { Response.Redirect(URL, false); } } else { ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Entry Id Already Exist. Please start" + " the transaction again');window.location.href='http://boty.in/register-here/';</script>"); } }
protected void Page_Load(object sender, EventArgs e) { try { string transactionTypeCode, installments, transactionId, amount, exponent, currencyCode, merchantReferenceNo, status, eci, pgErrorCode, pgErrorDetail, pgErrorMsg, messageHash, messageHashBuf, messageHashClient; bool hashMatch = false; string URL = ""; //fill response from idbi transactionTypeCode = Request.Form["transaction_type_code"]; installments = Request.Form["installments"]; transactionId = Request.Form["transaction_id"]; amount = Request.Form["amount"]; exponent = Request.Form["exponent"]; currencyCode = Request.Form["currency_code"]; merchantReferenceNo = Request.Form["merchant_reference_no"]; status = Request.Form["status"]; eci = Request.Form["3ds_eci"]; pgErrorCode = Request.Form["pg_error_code"]; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI: " + pgErrorCode); pgErrorDetail = Request.Form["pg_error_detail"]; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI: " + pgErrorDetail); pgErrorMsg = Request.Form["pg_error_msg"]; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI: " + pgErrorMsg); messageHash = Request.Form["message_hash"]; messageHashBuf = System.Configuration.ConfigurationManager.AppSettings["pgInstanceId"] + "|" + System.Configuration.ConfigurationManager.AppSettings["merchantId"] + "|" + transactionTypeCode + "|" + installments + "|" + transactionId + "|" + amount + "|" + exponent + "|" + currencyCode + "|" + merchantReferenceNo + "|" + status + "|" + eci + "|" + pgErrorCode + "|" + System.Configuration.ConfigurationManager.AppSettings["hashKey"] + "|"; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI: " + messageHashBuf); /*******************Payement Gateway Error Value Code**********************/ #region PG_DB for ReturnReceipt Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("PG_DB"); string bookingid = merchantReferenceNo.Split('_')[1].ToString().Split('~')[0].ToString(); int i = GTICKBOL.Insert_Payment_DB(pgErrorDetail.ToString(), bookingid, "IDBI"); #endregion PG_DB for ReturnReceipt /*********************End******************************/ messageHashClient = "13:" + enUtility.DoHash(messageHashBuf); hashMatch = (messageHash == messageHashClient); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI hash " + (hashMatch ? "matched" : "mismatched")); //Url needed for the agent module to replace here if (merchantReferenceNo.Contains("RCM-topup") || merchantReferenceNo.Contains("RCM-signup")) { URL = "http://royalty.kingdomofdreams.in/Payment/Idbi/cr.aspx?tid=" + merchantReferenceNo + "&sta=" + status + "&amt=" + amount + "&rec=" + transactionId; } else { if (merchantReferenceNo.Split('_').Length > 2) { URL = "http://www.kodagent.com/ReturnReceipt.aspx?tid=" + merchantReferenceNo + "&sta=" + status + "&amt=" + amount + "&rec=" + transactionId; } else { KoDTicketing.GTICKV.LogEntry(merchantReferenceNo.Split('_')[0].ToString(), "Return From IDBI Payment Gateway, amt : " + amount + ",recieptNO : " + transactionId, "13", merchantReferenceNo.Split('_')[1].Split('~')[0]); if (merchantReferenceNo.Contains("royal_card_payment_idbi")) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Royal Card Payment reference no " + merchantReferenceNo); URL = "../../RoyalCard/Account/Payment/Idbi/CR.aspx?tid=" + merchantReferenceNo + "&sta=" + status + "&amt=" + amount + "&rec=" + transactionId; } else { URL = "CR.aspx?tid=" + merchantReferenceNo + "&sta=" + status + "&amt=" + amount + "&rec=" + transactionId; } } } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Payment Redirecting..." + URL); Response.Redirect(URL, false); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Return Receipt Exception " + ex.Message); if (ex.Message != null) { ReceiptUtils.IDBIReturnReceipt(ex.Message, ""); } } }
public static DataTable SelectRow_AudiWise(String _filmCode) { return(GTICKBOL.SelectRow_AudiWise(_filmCode)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string paymentId, ErrorText, result, postdate, tranid, auth, amt, reference; string ErrorNo, udf1, udf2, udf3, udf4, udf5, trackid; paymentId = Request["paymentid"] ?? String.Empty; ErrorText = Request["ErrorText"] ?? String.Empty; ErrorNo = Request["Error"] ?? String.Empty; udf1 = Request["udf1"] ?? String.Empty; udf2 = Request["udf2"] ?? String.Empty; udf3 = Request["udf3"] ?? String.Empty; udf4 = Request["udf4"] ?? String.Empty; udf5 = Request["udf5"] ?? String.Empty; if (ErrorNo == String.Empty) { result = Request["result"] ?? String.Empty; postdate = Request["postdate"] ?? String.Empty; tranid = Request["tranid"] ?? String.Empty; auth = Request["auth"] ?? String.Empty; trackid = Request["trackid"] ?? String.Empty; reference = Request["ref"] ?? String.Empty; amt = Request["amt"] ?? String.Empty; String responseDetails = string.Format("HDFC Response: paymentId[{0}], ErrorText[{1}], result[{2}], postdate[{3}], tranid[{4}], auth[{5}], amt[{6}], reference[{7}], ErrorNo[{8}], udf1[{9}], udf2[{10}], udf3[{11}], udf4[{12}], udf5[{13}], trackid[{14}]", paymentId, ErrorText, result, postdate, tranid, auth, amt, reference, ErrorNo, udf1, udf2, udf3, udf4, udf5, trackid); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(responseDetails); if (trackid != String.Empty) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Track ID: " + trackid); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Result: " + Request["result"].ToString()); KoDTicketing.GTICKV.LogEntry(trackid.Split('_')[0], "Payment Getaway Response: " + Request["result"].ToString(), "14", trackid.Split('_')[1].Split('-')[0]); /*******************Payement Gateway Error Value Code**********************/ #region PG_DB for ReturnReceipt Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("PG_DB"); string bookingid = Request["trackid"].Split('_')[1].ToString().Split('-')[0].ToString(); int i = GTICKBOL.Insert_Payment_DB(Request["result"].ToString(), bookingid, "HDFC"); #endregion PG_DB for ReturnReceipt /*********************End******************************/ string qstring = UpdateResponse(trackid, reference, result, postdate, auth); if (!string.IsNullOrEmpty(qstring)) { string redirectURL = "REDIRECT=" + KoDTicketingIPAddress + "Payment/Print-Receipt.aspx" + qstring; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC response redirection: " + redirectURL); Response.Write(redirectURL); return; } else { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC response processing failed and resulting in empty receipt."); } } else { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Response contains NO track ID"); } Response.Write("REDIRECT=" + KoDTicketingIPAddress + "Payment/Print-Receipt.aspx?err=pay"); } else { String errorDetails = string.Format("paymentId[{0}], ErrorText[{1}], ErrorNo[{2}], udf1[{3}], udf2[{4}], udf3[{5}], udf4[{6}], udf5[{7}]", paymentId, ErrorText, ErrorNo, udf1, udf2, udf3, udf4, udf5); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Response: " + errorDetails); /*******************Payement Gateway Error Value Code**********************/ #region PG_DB for ReturnReceipt Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("PG_DB"); string bookingid = Request["trackid"].Split('_')[1].ToString().Split('-')[0].ToString(); int i = GTICKBOL.Insert_Payment_DB(ErrorText.ToString(), bookingid, "HDFC"); #endregion PG_DB for ReturnReceipt /*********************End******************************/ string err; if (Request["ErrorText"] != null) { err = Request["ErrorText"].ToString(); } else { err = "Error occcured in processing payment through HDFC payment gateway."; } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error Response: " + err); Response.Write("REDIRECT=" + KoDTicketingIPAddress + "Payment/Print-Receipt.aspx?err=pay"); } }//!postback }
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); }
protected String UpdateResponse(String trackid, String reference, String result, String postdate, String auth) { System.Text.StringBuilder qstring = new System.Text.StringBuilder(); try { TransactionRecord tr = new TransactionRecord(); string IpAddress = System.Configuration.ConfigurationManager.AppSettings["KoDTicketingIPAddress"]; #region parsereference //HDFC Track ID: 1000109173_1100065925-WEB Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Transaction reference: " + trackid); string refNo = trackid; string[] refTokens = refNo.Split(new char[] { '_', '-' }); if (refTokens.Length < 3) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment Response: Tokenization of reference string did not result in enough sub tokens. --> " + refNo); return("?err=pay"); } tr.ReferenceNo = long.Parse(refTokens[0]); tr.BookingID = long.Parse(refTokens[1]); tr.AgentCode = refTokens[2]; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("HDFC Payment Response: Reference[{0}], Booking ID [{1}], Agent Code [{2}] ", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.AgentCode)); #endregion parsereference if (Request["amt"] != null) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amount: " + Request["amt"].ToString()); tr.TotalAmount = decimal.Parse(Request["amt"].ToString()); } if (Request["paymentid"] != null) { try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: " + Request["paymentid"].ToString()); tr.ReceiptNo = Request["paymentid"].ToString(); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Response: Error parsing receipt."); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message); } } if (result == "CAPTURED") { # region CAPTURED //string retURL = UpdateResponseByTranId(status, amount, transactionId); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC payment captured."); try { //****** Promo code usecase start here ************ KODHelper objKODHelper = new KODHelper(); tr = objKODHelper.GetPromotionDetails(tr); tr.PaymentGateway = "HDFC"; //****** Promo code usecase END here ************ TransactionBOL.Update_PaymentStatus(tr); //Update payment status in temp transection table DataTable dt = TransactionBOL.Get_Transaction_Detail(tr); if (dt != null && dt.Rows.Count > 0) { try { //String dbamount = dt.Rows[0]["TotalAmount"].ToString(); //String dbTrackID = dt.Rows[0]["BookingID"].ToString() + "_" + dt.Rows[0]["ReferenceNo"].ToString() + "-" + dt.Rows[0]["AgentCode"].ToString(); ////Validating the Booking Amount and Track ID //if (Request.QueryString["amt"].ToString() == dbamount && Request.QueryString["trackid"].ToString() == dbTrackID) //{ bool seatsBooked = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0); bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1"); if (seatsBooked) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Seats booked against HDFC payment."); } if (!alreadyProcessed) { if (dt.Rows[0]["PromotionCode"].ToString() == "MMT") { DataTable dt1 = TransactionBOL.Select_MMTTransaction_REFIDWISE(tr.BookingID.ToString()); ReceiptUtils.MMTPaymentResponse(dt.Rows[0], dt1.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString()); } else if (dt.Rows[0]["PromotionCode"].ToString() == "MANA") { DataTable dt2 = TransactionBOL.Select_MANATransaction_REFIDWISE(tr.BookingID.ToString()); ReceiptUtils.MANAPaymentResponse(dt.Rows[0], dt2.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString()); } else if (dt.Rows[0]["PromotionCode"].ToString() == "MCOTHERS" || dt.Rows[0]["PromotionCode"].ToString() == "MCWORLD") { DataTable dt3 = TransactionBOL.Select_MCTransaction_REFIDWISE(tr.ReferenceNo.ToString()); ReceiptUtils.MCPaymentResponse(dt.Rows[0], dt3.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString()); } else if (dt.Rows[0]["PromotionCode"].ToString() == "JHUMROOOFFER") { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Enter into jhumroo offer mail content"); ReceiptUtils.JHUMROOOFFERPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, ""); } else { ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, ""); } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.ReferenceNo.ToString() + "," + tr.BookingID.ToString() + "," + tr.PromotionCode.ToString()); SendNotificationMailForHotels(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, tr.PromotionCode.ToString()); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow"); } qstring.Append("?b="); qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString()); GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Payment successful...", "16", tr.BookingID.ToString(), tr.ReceiptNo.ToString()); //} //else //{ // Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amounts mismatch customer asked to call to confirm transaction."); // ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo); //} } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error processing receipt post booking. " + ex.Message); if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString()))) { ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt.Rows[0], ""); } //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat"); } } else { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC successful booking but ask customer to call");; long BookingID1 = long.Parse(tr.ReferenceNo.ToString()); DataTable dt2 = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1); if (dt2 != null && dt2.Rows.Count > 0 && (Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString()))) { ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt2.Rows[0], ""); } //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat"); } return(qstring.ToString()); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: error getting transaction details - " + ex.Message); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat"); } //if you reach here problem occurred String _refNo = tr.ReferenceNo.ToString(); KoDTicketing.GTICKV.LogEntry(_refNo, "HDFC Payment Not Successful", "25", tr.BookingID.ToString()); GTICKBOL.ON_Session_out(_refNo); KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "26", tr.BookingID.ToString()); qstring.Append("err=pay"); KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Error Occurred -- Payment Not Successful", "27", tr.BookingID.ToString()); long BookingID = long.Parse(tr.ReferenceNo.ToString()); try { DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID); if (dt.Rows.Count == 0) { ReceiptUtils.FailurePaymentResponse(); } else { ReceiptUtils.FailurePaymentResponse(dt.Rows[0]); } qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat"); return(qstring.ToString()); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error occurred processing unsuccessful payment..." + ex.Message); } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Final Call"); Response.Redirect(IpAddress + "Payment/FinalCall.aspx" + qstring.ToString(), false); #endregion } else { GTICKV.LogEntry(tr.ReferenceNo.ToString(), "User Press Cancel Button", "15", tr.BookingID.ToString()); GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Payment Not Successful", "25", tr.BookingID.ToString()); GTICKBOL.ON_Session_out(tr.ReferenceNo.ToString()); GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Seats Unlocked", "26", tr.BookingID.ToString()); long BookingID = long.Parse(tr.ReferenceNo.ToString()); DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID); if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString()))) { ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], ""); } qstring.Append("?err=pay"); } }
/// Maximum Columns in a Show public static int maxColumns(String _filmCode) { return(int.Parse(GTICKBOL.MaxColumn(_filmCode).Rows[0]["MaxColumn"].ToString())); }
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>"); } }
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; 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.MMTBookingID = GTICKBOL.MMTBooking_Max(); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(tr.MMTBookingID.ToString() + "booking id"); Session["BookingID"] = tr.MMTBookingID; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(tr.MMTBookingID.ToString() + "booking id"); tr.MMTPayableAmount = 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, "", ""); //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; // 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 + "MMT/HDFC/Error.aspx"; String ResponseUrl = KoDTicketingIPAddress + "MMT/HDFC/ReturnReceipt.aspx"; //string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA¤cycode=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¤cycode=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.MMTBookingID.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); } }
protected void btnSubmit_Click(object sender, EventArgs e) { long transid = 0; TransactionRecord tr = new TransactionRecord(); try { #region Session based if (Session["seat_Val"] != null && Session["Seat_TransactionID"] != null) { try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Transaction [{0}] Seats [{1}]", Session["Seat_TransactionID"].ToString(), Session["seat_Val"].ToString())); tr.BookingID = long.Parse(Session["Seat_TransactionID"].ToString()); string[] strarr = Session["seat_Val"].ToString().Split(','); 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 = Session["FirstName"].ToString() + Session["LastName"].ToString(); tr.PaymentType = ddlPaymentMode.SelectedItem.Text; tr.DateOfBooking = DateTime.Now.Date.ToShortDateString(); bool istrue = emailsnd.Checked; Session["Istrue"] = istrue; tr.IsChecked = istrue; tr.EmailID = txtEmailAddress.Text; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IsChecked" + istrue); tr.PlaceOfPick = ""; tr.TimeOfPick = ""; Session["Complimentary"] = "false"; tr.WantComplimentary = false; 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]; //replace "-"with "/" //string[] datarr = strarr[2].ToString().Split('/'); // for live server string[] datarr = strarr[2].ToString().Split('-'); // for dev/local //replace datarr[0] to datarr[1] //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(); // for dev/local, swap month & date above after day has been calculated above //comment below two lines //tr.ShowDate = tr.ShowDate.Replace(datarr[1], datarr[0]); //tr.ShowDate = tr.ShowDate.Replace("30", datarr[1]); tr.Remark = ""; tr.TotalAmount = GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID); Session["TotalAmount"] = tr.TotalAmount; tr.SeatInfo = Session["Seat_info"].ToString(); tr.Address = Session["Address"].ToString().Trim(); //+ Session["Address2"].ToString() tr.IP = GetIP(); //******Promotion code related changes START***** if (Session["PromotionCode"] != null) { KoDTicketingLibrary.DTO.Promotion PromoSession = (KoDTicketingLibrary.DTO.Promotion)Session["PromotionCode"]; tr.PromotionCode = PromoSession.PromotionCode; tr.DiscountPercentage = PromoSession.DiscountPercentage; tr.WebPromotionId = PromoSession.WebPromotionId; tr.DiscountedAmount = (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) - (GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID) * PromoSession.DiscountPercentage / 100)); } //******Promotion code related changes END***** //******RoyalCard related changes START***** tr.RegId = Session["Regid"].ToString(); tr.AvailedAmount = Convert.ToDecimal(Session["RedeemBalance"]); tr.AvailedPoints = Convert.ToDecimal(Session["RedeemPoints"]); tr.TopUpAmount = tr.TotalAmount - (Convert.ToDecimal(Session["RedeemPoints"]) + Convert.ToDecimal(Session["RedeemBalance"])); if (tr.TopUpAmount != 0) { tr.TopUpTransactionId = TransactionBOL.Card_Transaction(tr.RegId, tr.TopUpAmount, DateTime.Now, tr.RegId, 0); } tr.OptionalEmail = txtEmail.Text; tr.OptionalContact = txtmobileno.Text; //******RoyalCard related changes END***** transid = TransactionBOL.Transaction_Temp_Insert(tr); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Transaction Preparation Error: " + ex.Message); } GTICKV.LogEntry(tr.BookingID.ToString(), "Category : " + tr.Category + " ,Seat Info : " + tr.SeatInfo + ", Total Amt : " + tr.TotalAmount, "6", ""); //******Promotion code send discounted AMOUNT to payment gateway changes START***** if (Session["PromotionCode"] != null) { KoDTicketingLibrary.DTO.Promotion ObjPromoSession = (KoDTicketingLibrary.DTO.Promotion)Session["PromotionCode"]; tr.TotalAmount = 0; DataTable prices = GTICKBOL.Get_AllSeatPrice_SeatKeyNoWise(tr.BookingID); 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()); } } } //*******Promotion code send discounted AMOUNT to payment gateway changes END here ********** tr.TotalAmount = (tr.TotalAmount) - (tr.AvailedPoints + tr.AvailedAmount); if (transid > 0) { Session["AgentCode"] = null; GTICKV.LogEntry(tr.BookingID.ToString(), "Data Successfully Written to Temp Transaction Table", "7", transid.ToString()); if (Session["PayableAmount"].ToString() == "0") { Session["BookingID"] = tr.BookingID; Session["ID"] = transid.ToString(); Response.Redirect("Payment/Print-Receipt.aspx"); } else { 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", "8", transid.ToString()); URL = "../../Payment/Idbi/Default.aspx?type=idbi&transid=" + tr.BookingID.ToString() + "_" + transid + "~" + tr.AgentCode + "~royal_card_payment_idbi" + "&amt=" + tr.TotalAmount + "&show=" + tr.Play; } else if (rbl_CardType.SelectedValue == "AMEX") { GTICKV.LogEntry(tr.BookingID.ToString(), "Sending to AMEX Payment Gateway", "8", transid.ToString()); URL = "Payment/Web/Default.aspx?type=amex&transid=" + tr.BookingID.ToString() + "_" + transid + "~" + tr.AgentCode + "&amt=" + tr.TotalAmount + "&show=" + tr.Play; } 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", "8", transid.ToString()); 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 + "RoyalCard/Account/Payment/HDFC/Error.aspx"; String ResponseUrl = KoDTicketingIPAddress + "RoyalCard/Account/Payment/HDFC/ReturnReceipt.aspx"; //string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA¤cycode=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¤cycode=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(tr.Address.ToString()) + "&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); } 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(); } }//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); } } 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"); } } else //no Session[seat_val] { ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='TicketBooking.aspx';</script>"); } #endregion } catch (Exception ex) { GTICKV.LogEntry(tr.BookingID.ToString(), "Error Occurred - " + ex.Message.Replace("'", ""), "8", transid.ToString()); } }
protected void GetResponse() { String URL = ""; String vpc_TxnResponseCode = ""; String txtRefCode = ""; String ShoWName = ""; String stramt = ""; String ReceiptNo = ""; String vpc_avsResultCode = ""; String TranSactNo = ""; String ResponseCode = ""; String Amount = ""; String vpc_3DSstatus = ""; String vpc_3DSenrolled = ""; String vpc_AcqAVSRespCode = ""; try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Prepare to transact wth AmEx..."); // Create the VPCRequest object VPCRequest conn = new VPCRequest("https://vpos.amxvpos.com/vpcpay"); //conn.setSecureSecret("C12DC6FE16681E9DD3211D2BB0C0BBA2"); //Live conn.setSecureSecret("44DD98D32ECD3C1AA7F12A1D0F8B41EA"); // Process the response conn.process3PartyResponse(Page.Request.QueryString); // Check if the transaction was successful or if there was an error vpc_TxnResponseCode = conn.getResultField("vpc_TxnResponseCode", "Unknown"); // Set the display fields for the receipt with the result fields // Core Fields // Label_vpc_TxnResponseCode.Text = vpc_TxnResponseCode; txtRefCode = conn.getResultField("vpc_MerchTxnRef", "Unknown"); ShoWName = conn.getResultField("vpc_OrderInfo", "Unknown"); Amount = conn.getResultField("vpc_Amount", "Unknown"); ReceiptNo = conn.getResultField("vpc_ReceiptNo", "Unknown"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Receiot No. : " + ReceiptNo); //**************Safe Key and AAV Verification************// vpc_3DSenrolled = conn.getResultField("vpc_3DSenrolled", "Unknown"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("vpc_3DSenrolled : " + vpc_3DSenrolled); vpc_AcqAVSRespCode = conn.getResultField("vpc_AcqAVSRespCode", "Unknown"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("vpc_AcqAVSRespCode : " + vpc_AcqAVSRespCode); //***********************************************// // Address Verification / Advanced Address Verification vpc_avsResultCode = conn.getResultField("vpc_AVSResultCode", "Unknown"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx transaction Auth result code: " + vpc_avsResultCode); // Perform the Capture if the Authorization was successful TranSactNo = conn.getResultField("vpc_TransactionNo", "Unknown"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx transaction Auth response code: " + vpc_TxnResponseCode); string errtxnresponce = PaymentCodesHelper.getTxnResponseCodeDescription(vpc_TxnResponseCode); string errAVSResultCode = PaymentCodesHelper.getAVSDescription(vpc_avsResultCode); if (vpc_3DSenrolled == "Y") { vpc_3DSstatus = conn.getResultField("vpc_3DSstatus", "Unknown"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx transaction Auth safe key code vpc_3DSstatus: " + vpc_3DSstatus); if (vpc_TxnResponseCode == "0" && (vpc_3DSstatus == "Y" || vpc_3DSstatus == "A")) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx authorization successful, starting capture..."); // Create a new VPCRequest Object and set the proxy details if required conn = new VPCRequest("https://vpos.amxvpos.com/vpcdps"); conn.setProxyHost(""); conn.setProxyUser(""); conn.setProxyPassword(""); conn.setProxyDomain(""); //test server // Add the Required Fields //conn.addDigitialOrderField("vpc_Version", "1"); //conn.addDigitialOrderField("vpc_AccessCode", "D30639FF"); //conn.addDigitialOrderField("vpc_Merchant", "TEST9824533848"); //conn.addDigitialOrderField("vpc_User", "kingdomama"); //conn.addDigitialOrderField("vpc_Password", "0password"); //conn.addDigitialOrderField("vpc_Command", "capture"); //live server conn.addDigitialOrderField("vpc_Version", "1"); conn.addDigitialOrderField("vpc_AccessCode", "0FE6FE77"); conn.addDigitialOrderField("vpc_Merchant", "9824533848"); conn.addDigitialOrderField("vpc_User", "kingdomama"); conn.addDigitialOrderField("vpc_Password", "0password"); conn.addDigitialOrderField("vpc_Command", "capture"); conn.addDigitialOrderField("vpc_MerchTxnRef", txtRefCode.Substring(0, txtRefCode.Length - 2) + "-C"); conn.addDigitialOrderField("vpc_TransNo", TranSactNo); conn.addDigitialOrderField("vpc_Amount", Amount); // Perform the transaction conn.sendRequest(); // Check if the transaction was successful or if there was an error ResponseCode = conn.getResultField("vpc_TxnResponseCode", "Unknown"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx transaction Capture response code: " + ResponseCode); } } else { if (vpc_TxnResponseCode == "0" && vpc_AcqAVSRespCode == "M") { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx authorization successful, starting capture..."); // Create a new VPCRequest Object and set the proxy details if required conn = new VPCRequest("https://vpos.amxvpos.com/vpcdps"); conn.setProxyHost(""); conn.setProxyUser(""); conn.setProxyPassword(""); conn.setProxyDomain(""); //test server // Add the Required Fields //conn.addDigitialOrderField("vpc_Version", "1"); //conn.addDigitialOrderField("vpc_AccessCode", "D30639FF"); //conn.addDigitialOrderField("vpc_Merchant", "TEST9824533848"); //conn.addDigitialOrderField("vpc_User", "kingdomama"); //conn.addDigitialOrderField("vpc_Password", "0password"); //conn.addDigitialOrderField("vpc_Command", "capture"); //live server conn.addDigitialOrderField("vpc_Version", "1"); conn.addDigitialOrderField("vpc_AccessCode", "0FE6FE77"); conn.addDigitialOrderField("vpc_Merchant", "9824533848"); conn.addDigitialOrderField("vpc_User", "kingdomama"); conn.addDigitialOrderField("vpc_Password", "0password"); conn.addDigitialOrderField("vpc_Command", "capture"); conn.addDigitialOrderField("vpc_MerchTxnRef", txtRefCode.Substring(0, txtRefCode.Length - 2) + "-C"); conn.addDigitialOrderField("vpc_TransNo", TranSactNo); conn.addDigitialOrderField("vpc_Amount", Amount); // Perform the transaction conn.sendRequest(); // Check if the transaction was successful or if there was an error ResponseCode = conn.getResultField("vpc_TxnResponseCode", "Unknown"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx transaction Capture response code: " + ResponseCode); } } /*******************Payement Gateway Error Value Code**********************/ #region PG_DB if (vpc_TxnResponseCode != "0") { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("PG_DB"); string bookingid = txtRefCode.Split('_')[1].ToString().Split('~')[0].ToString(); int i = GTICKBOL.Insert_Payment_DB(errtxnresponce, bookingid, "AMEX"); } else if (vpc_avsResultCode != "X" && vpc_avsResultCode != "Y") { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("PG_DB"); string bookingid = txtRefCode.Split('_')[1].ToString().Split('~')[0].ToString(); int i = GTICKBOL.Insert_Payment_DB(errAVSResultCode, bookingid, "AMEX"); } #endregion PG_DB /*********************End******************************/ //convert amt int amt = (Convert.ToInt32(Amount)) / 100; stramt = amt.ToString(); GTICKBOL gb = new GTICKBOL(); GTICKV.LogEntry(txtRefCode.Split('_')[0], "Return From AMEX Payment Gateway, amt : " + stramt + ",recieptNO : " + ReceiptNo, "13", txtRefCode.Split('_')[1].Split('~')[0]); //***********Url for address Verification*********// //URL = "ReturnReceipt.aspx?tid=" + txtRefCode + "&sta=" + vpc_TxnResponseCode + "&amt=" + stramt + "&rec=" + ReceiptNo + "&ResultCode=" + vpc_avsResultCode; //************************************************// URL = "ReturnReceipt.aspx?tid=" + txtRefCode + "&sta=" + vpc_TxnResponseCode + "&amt=" + stramt + "&rec=" + ReceiptNo + "&Safecode=" + vpc_3DSstatus + "&response=" + vpc_AcqAVSRespCode + "&enroll=" + vpc_3DSenrolled; Response.Redirect(URL, false); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error in AmEx Payment Response: " + ex.Message); } }
public static DataTable Audit_AllSeats(String _AudiNo) { return(GTICKBOL.Audit_AllSeats(_AudiNo)); }
public static DataTable select_Seat_Layout(String _SeatNo) { return(GTICKBOL.select_Seat_Layout(_SeatNo)); }
protected void btnMMTPromotionCode_Click(object sender, EventArgs e) { List <KoDTicketingLibrary.DTO.Promotion> listPromo = VistaBOL.GetPromostionCode(); string sum = GTICKBOL.YATRAPromotion_check(txtYatraPNR.Text); String PNRnumber = txtYatraPNR.Text; String PromotionCode = txtYatraPromotionCode.Text; int list = listPromo.Count; int no = int.Parse(sum); int select = int.Parse(ddl_nooftickets.SelectedValue.ToString()); if (no >= 4) { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Sorry, maximum 4 tickets are allowed on each Booking Id."; txtYatraPromotionCode.Text = ""; txtYatraPNR.Text = ""; txtYatraPromotionCode.Focus(); return; } else if ((no + select) > 4) { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Sorry, you can select only " + (4 - no) + " tickets";; txtYatraPromotionCode.Text = ""; txtYatraPNR.Text = ""; txtYatraPromotionCode.Focus(); return; } else if (txtYatraPromotionCode.Text.ToString().Length == 0) { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Please Enter Your Promotion Code"; txtYatraPromotionCode.Focus(); return; } else if (txtYatraPNR.Text == "") { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Please Enter Your PNR Number"; txtYatraPNR.Focus(); return; } else if (chkterms.Checked == false) { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Accept terms and conditions"; txtYatraPNR.Focus(); return; } else { for (int i = 0; i < list; i++) { bool isMatchPromo = Regex.IsMatch(PromotionCode, listPromo[i].RegexValidator); bool isMatch = Regex.IsMatch(PNRnumber, "(?![Y|y][T|t][0]{11})^([Y|y][T|t])[0-9]{11}$"); bool isMatch1 = Regex.IsMatch(PNRnumber, "(?![Y|y][T|t][0]{10})^([Y|y][T|t])[0-9]{10}$"); bool isMatch2 = Regex.IsMatch(PNRnumber, "(?![Y|y][T|t][0]{9})^([Y|y][T|t])[0-9]{9}$"); bool isMatch3 = Regex.IsMatch(PNRnumber, "(?![Y|y][T|t][0]{8})^([Y|y][T|t])[0-9]{8}$"); if ((isMatch || isMatch1 || isMatch2 || isMatch3) && isMatchPromo) { if (listPromo[i].PromotionCode.ToString().ToUpper() == "YATRA") { Session["PromotionCode"] = listPromo[i]; Session[listPromo[i].PromotionCode] = listPromo[i]; Session["a" + listPromo[i].PromotionCode] = listPromo[i]; Session["Hotel"] = listPromo[i].PromotionCode.ToString(); Session["yatrapnr"] = txtYatraPNR.Text.ToUpper(); Session["NoofTickets"] = ddl_nooftickets.SelectedItem.ToString(); Session["promocode"] = txtYatraPromotionCode.Text.ToUpper(); Response.Redirect("Default.aspx?Yatra=S&promo=" + Encrypt(listPromo[i].PromotionCode), false); } } } } PromotionNotValid(); }
protected void Page_Load(object sender, EventArgs e) { System.Text.StringBuilder qstring = new System.Text.StringBuilder("?"); try { int qsCount = Request.QueryString.Count; if (qsCount > 0 && Request.QueryString["sta"] != null && Request.QueryString["tid"] != null) { TransactionRecord tr = new TransactionRecord(); #region parsereference //tr.Status = Request.QueryString["sta"].ToString().Equals("0"); tr.Status = false; if (Request.QueryString["sta"].ToString().Equals("0") && (Request.QueryString["ResultCode"].ToString().Equals("Y") || Request.QueryString["ResultCode"].ToString().Equals("M"))) { tr.Status = true; } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Web payment transaction complete. Status: " + (tr.Status ? "Success" : "Failure")); String refNo = Request.QueryString["tid"].ToString(); string[] refTokens = refNo.Split('_'); if (refTokens.Length < 2) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Response from gateway received but query string does not have information about the transaction refernece: " + refNo); return; } tr.ReferenceNo = long.Parse(refTokens[0].ToString()); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Transaction reference: " + tr.ReferenceNo.ToString()); string[] refSubTokens = refTokens[1].Split('~'); if (refTokens.Length < 2) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Tokenization of query string did not result in enough sub tokens. --> " + refNo); return; } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmExBooking ID: " + refSubTokens[0]); tr.BookingID = long.Parse(refSubTokens[0]); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Agent Code: " + refSubTokens[1]); tr.AgentCode = refSubTokens[1]; #endregion parsereference Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Amount: " + Request.QueryString["amt"].ToString()); tr.TotalAmount = decimal.Parse(Request.QueryString["amt"].ToString()); if (true == tr.Status) //successful { #region handlesuccess #region parsereceipt if (Request.QueryString["rec"] != null) { try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Receipt: " + Request.QueryString["rec"]); tr.ReceiptNo = Request.QueryString["rec"]; } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Resposne: Error parsing receipt."); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message); } } #endregion parsereceipt try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEX Payment Successful. Ensuring the seats are reserved..."); //****** Promo code usecase start here ************ KODHelper objKODHelper = new KODHelper(); tr = objKODHelper.GetRoyalCardDetails(tr); tr = objKODHelper.GetPromotionDetails(tr); //****** Promo code/RoyalCard usecase END here ************ if (tr.TopUpAmount != 0) { TransactionBOL.Top_UP(tr.TopUpTransactionId); } tr.AvailedAmount += tr.TopUpAmount; if (tr.AvailedAmount != 0 || tr.AvailedPoints != 0) { TransactionBOL.Redeem_Points(tr.RegId, tr.AvailedAmount, tr.AvailedPoints, tr.TotalAmount, tr.Play, tr.MobileNo, tr.ReferenceNo.ToString(), tr.TotalSeats); } //****** Promo code usecase END here ************ DataTable dt = TransactionBOL.Get_Transaction_Detail(tr); if (dt.Rows.Count == 0) { long BookingID1 = long.Parse(tr.ReferenceNo.ToString()); DataTable dt1 = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1); ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], ""); //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo); } else { bool seatsBooked = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0); bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Amex [{0},{1},{2}] Seats Booked.", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo)); if (!alreadyProcessed) { ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, System.Configuration.ConfigurationManager.AppSettings["RoyalCardAdminID"]); } qstring.Clear(); qstring.Append("?b="); qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString()); } } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Receipt: error getting transaction details - " + ex.Message); } #endregion handlesuccess } else //failure { #region handlefailure String _refNo = tr.ReferenceNo.ToString(); KoDTicketing.GTICKV.LogEntry(_refNo, "Payment Not Successful", "17", tr.BookingID.ToString()); GTICKBOL.ON_Session_out(_refNo); KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "18", tr.BookingID.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"); KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Error Occured -- Payment Not Successful", "19", tr.BookingID.ToString()); //long BookingID = long.Parse(tr.ReferenceNo.ToString()); try { //DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID); if (dt.Rows.Count == 0) { ReceiptUtils.FailurePaymentResponse(); } else { ReceiptUtils.FailurePaymentResponse(dt.Rows[0]); } qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat"); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error occurred processing unsuccessful payment..." + ex.Message); } #endregion handlefailure } } else { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response from gateway received but query string does not have information about the transaction."); qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat"); } } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Exception thrown processing receipt. " + ex.Message); qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat"); } Response.Redirect("~/RoyalCard/Account/Payment/Print-Receipt.aspx" + qstring.ToString(), false); }
protected void btn_Submit_Click(object sender, EventArgs e) { string mailer = ""; if (Request.QueryString["source"] != null) { mailer = Request.QueryString["source"].ToString(); } string Package = ddl_Package1.SelectedItem.ToString(); int Quantity = Convert.ToInt16(ddl_Quantity.SelectedValue); string[] amt = Package.Split('.'); decimal TotalAmount = Convert.ToDecimal(amt[1]) * Quantity; DateTime DateofBooking = DateTime.Now.Date; string ISDCode = "91"; // String BookingID = KODVL00000; //for the FirstTime// TransactionRecord tr = new TransactionRecord(); tr.VLBookingID = GTICKBOL.ValentineBooking_Max(); tr.Quantity = Convert.ToInt16(Quantity); tr.VLTotalAmount = Convert.ToDecimal(TotalAmount); string vlbookingid = MaxBookingId(tr.VLBookingID.ToString()); tr.VLBookingID = vlbookingid; GTICKBOL.ValentineBooking_Details(amt[1], Quantity, Convert.ToDecimal(TotalAmount.ToString()), DateofBooking, tr.VLBookingID.ToString(), txtName.Text.ToString(), txtEmail.Text.ToString(), txtContact.Text.ToString(), false, "", GetIP(), "Valentine_2014", mailer); //********Payment GateWay Flow******// Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(tr.VLBookingID.ToString() + "Sending to HDFC Payment Gateway"); string trackid, amount; string URL = ""; trackid = tr.VLBookingID.ToString(); Session["trackid"] = trackid; amount = TotalAmount.ToString(); String ErrorUrl = KoDTicketingIPAddress + "ValentineAffair/HDFC/Error.aspx"; String ResponseUrl = KoDTicketingIPAddress + "ValentineAffair/HDFC/ReturnReceipt.aspx"; string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA¤cycode=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); }
public static string InsertMethod_Vacant(object myData_vaccant) { string check = ""; JavaScriptSerializer js = new JavaScriptSerializer(); List <jdata> myformElement = js.Deserialize <List <jdata> >(myData_vaccant.ToString()); DataTable dt_insertvaccant = new DataTable(); dt_insertvaccant.Columns.Add("timestamp", typeof(string)); dt_insertvaccant.Columns.Add("SeatID", typeof(string)); dt_insertvaccant.Columns.Add("AuditNo", typeof(int)); dt_insertvaccant.Columns.Add("ShowName", typeof(string)); dt_insertvaccant.Columns.Add("ShowLocation", typeof(string)); dt_insertvaccant.Columns.Add("ShowDate", typeof(string)); dt_insertvaccant.Columns.Add("ShowTime", typeof(string)); dt_insertvaccant.Columns.Add("Status", typeof(string)); dt_insertvaccant.Columns.Add("Remark", typeof(string)); dt_insertvaccant.Columns.Add("EditTime", typeof(DateTime)); dt_insertvaccant.Columns.Add("SeatDescription", typeof(string)); dt_insertvaccant.Columns.Add("IsCompleted", typeof(int)); dt_insertvaccant.Columns.Add("Category", typeof(string)); dt_insertvaccant.Columns.Add("ERPStatus", typeof(string)); foreach (var vac in myformElement) { dt_insertvaccant.Rows.Add("", vac.SeatID, Convert.ToInt32(vac.AuditNo), vac.ShowName, vac.ShowLocation, DateTime.Now.ToString("dd/MM/yyyy"), vac.ShowTime, vac.Status, vac.Remark, DateTime.Now.ToString(), vac.SeatDescription, Convert.ToInt32(vac.Iscompleted), vac.Category, vac.ERPStatus); check = vac.SeatID.Substring(0, 1); } int i = GTICKBOL.Delete_audit(check); int j = GTICKBOL.Update_audit(dt_insertvaccant); if (j == 0) { return("false"); } else { return("true"); } // SqlConnection connection = new SqlConnection("server=biztrack.co.in;database=MSTicketDB_Live_Latest;uid=sa;pwd=kranti123@123;"); //SqlCommand cmd = new SqlCommand("delete from [dbo].[ShowAudit_Table] where SUBSTRING([SeatID], 1, 1)='"+check+"' and Iscompleted='" + 0 + "'", connection); ////try ////{ //// connection.Open(); //// cmd.ExecuteNonQuery(); ////} ////catch (Exception ex) ////{ //// return "false"; ////} ////finally ////{ //// connection.Close(); ////} ////connection.Open(); //using (SqlBulkCopy bulkCopy = new SqlBulkCopy(connection)) //{ // bulkCopy.DestinationTableName = // "[dbo].[ShowAudit_Table]"; // try // { // bulkCopy.WriteToServer(dt_insertvaccant); // } // catch (Exception ex) // { // return "false"; // } // finally // { // connection.Close(); // } //} //return "true"; }
protected void Page_Load(object sender, EventArgs e) { System.Text.StringBuilder qstring = new System.Text.StringBuilder("?"); try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Return Receipt Page"); int qsCount = Request.QueryString.Count; if (qsCount > 0 && Request.QueryString["sta"] != null && Request.QueryString["tid"] != null) { TransactionRecord tr = new TransactionRecord(); #region parsereference //tr.Status = Request.QueryString["sta"].ToString().Equals("0"); tr.Status = false; if (Request.QueryString["enroll"].ToString().Equals("Y")) { if (Request.QueryString["sta"].ToString().Equals("0") && (Request.QueryString["Safecode"].ToString().Equals("Y") || Request.QueryString["Safecode"].ToString().Equals("A"))) { tr.Status = true; } } else { if (Request.QueryString["sta"].ToString().Equals("0") && Request.QueryString["response"].ToString().Equals("M")) { tr.Status = true; } } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Web payment transaction complete. Status: " + (tr.Status ? "Success" : "Failure")); String refNo = Request.QueryString["tid"].ToString(); string[] refTokens = refNo.Split('_'); KoDTicketing.GTICKV.LogEntry(refTokens[0], "Payment Getaway Response: " + (tr.Status ? "Success" : "Failure"), "14", ""); if (refTokens.Length < 2) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Response from gateway received but query string does not have information about the transaction refernece: " + refNo); return; } tr.ReferenceNo = long.Parse(refTokens[0].ToString()); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Transaction reference: " + tr.ReferenceNo.ToString()); string[] refSubTokens = refTokens[1].Split('~'); if (refTokens.Length < 2) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Tokenization of query string did not result in enough sub tokens. --> " + refNo); return; } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmExBooking ID: " + refSubTokens[0]); tr.BookingID = long.Parse(refSubTokens[0]); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Agent Code: " + refSubTokens[1]); tr.AgentCode = refSubTokens[1]; #endregion parsereference Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Amount: " + Request.QueryString["amt"].ToString()); tr.TotalAmount = decimal.Parse(Request.QueryString["amt"].ToString()); if (true == tr.Status) //successful { #region handlesuccess #region parsereceipt if (Request.QueryString["rec"] != null) { try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Receipt: " + Request.QueryString["rec"]); tr.ReceiptNo = Request.QueryString["rec"]; } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Resposne: Error parsing receipt."); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message); } } #endregion parsereceipt try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEX Payment Successful. Ensuring the seats are reserved..."); //****** Promo code usecase start here ************ KODHelper objKODHelper = new KODHelper(); tr = objKODHelper.GetPromotionDetails(tr); tr.PaymentGateway = "AMEX"; //****** Promo code usecase END here ************ TransactionBOL.Update_PaymentStatus(tr); //Update payment status in temp transection table DataTable dt = TransactionBOL.Get_Transaction_Detail(tr); if (dt.Rows.Count == 0) { long BookingID1 = long.Parse(tr.ReferenceNo.ToString()); DataTable dt1 = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1); if (dt1 != null && dt1.Rows.Count > 0 && (Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString()))) { ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], ""); } //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo); qstring.Append("?err=seat"); } else { bool seatsBooked = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0); bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Amex [{0},{1},{2}] Seats Booked.", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo)); if (!alreadyProcessed) { if (dt.Rows[0]["PromotionCode"].ToString() == "MMT") { DataTable dt1 = TransactionBOL.Select_MMTTransaction_REFIDWISE(tr.BookingID.ToString()); ReceiptUtils.MMTPaymentResponse(dt.Rows[0], dt1.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString()); } else if (dt.Rows[0]["PromotionCode"].ToString() == "MANA") { DataTable dt2 = TransactionBOL.Select_MANATransaction_REFIDWISE(tr.BookingID.ToString()); ReceiptUtils.MANAPaymentResponse(dt.Rows[0], dt2.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString()); } else if (dt.Rows[0]["PromotionCode"].ToString() == "MCOTHERS" || dt.Rows[0]["PromotionCode"].ToString() == "MCWORLD") { DataTable dt3 = TransactionBOL.Select_MCTransaction_REFIDWISE(tr.ReferenceNo.ToString()); ReceiptUtils.MCPaymentResponse(dt.Rows[0], dt3.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString()); } else if (dt.Rows[0]["PromotionCode"].ToString() == "JHUMROOOFFER") { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Enter into jhumroo offer mail content"); ReceiptUtils.JHUMROOOFFERPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, ""); } else { ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, ""); } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow"); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.ReferenceNo.ToString() + "," + tr.BookingID.ToString() + "," + tr.PromotionCode.ToString()); SendNotificationMailForHotels(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, tr.PromotionCode.ToString()); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow"); } qstring.Clear(); qstring.Append("?b="); qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString()); KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "AMEX Payment successful...", "16", tr.BookingID.ToString(), tr.ReceiptNo.ToString()); } } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Receipt: error getting transaction details - " + ex.Message); String _refNo = tr.ReferenceNo.ToString(); KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Amex Error Occured -- Payment Not Successful", "27", tr.ReferenceNo.ToString()); long BookingID = long.Parse(tr.ReferenceNo.ToString()); try { DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID); if (dt.Rows.Count == 0) { ReceiptUtils.FailurePaymentResponse(); } else { ReceiptUtils.FailurePaymentResponse(dt.Rows[0]); } qstring.Append("?err=seat"); } catch (Exception ex1) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error occurred processing unsuccessful payment through Amex..." + ex1.Message); } } #endregion handlesuccess } else //failure { #region handlefailure String _refNo = tr.ReferenceNo.ToString(); KoDTicketing.GTICKV.LogEntry(_refNo, "Payment Not Successful", "25", tr.BookingID.ToString()); GTICKBOL.ON_Session_out(_refNo); KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "26", tr.BookingID.ToString()); long BookingID = long.Parse(tr.ReferenceNo.ToString()); DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID); if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString()))) { ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], ""); } qstring.Append("err=pay"); #endregion handlefailure } } else { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response from gateway received but query string does not have information about the transaction."); qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat"); } } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Exception thrown processing receipt. " + ex.Message); qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat"); } Response.Redirect("~/Payment/Print-Receipt.aspx" + qstring.ToString(), false); }
protected void btn_Submit_Click(object sender, EventArgs e) { int GoldPackage = Convert.ToInt16(ddl_GoldPackage.SelectedValue); int SilverPackage = Convert.ToInt16(ddl_SilverPackage.SelectedValue); decimal GoldAmount = Convert.ToDecimal(GoldPackage * Convert.ToInt32(pricegold.Text)); decimal SilverAmount = Convert.ToDecimal(SilverPackage * Convert.ToInt32(pricesilver.Text)); decimal TotalAmount = GoldAmount + SilverAmount; DateTime DateofBooking = DateTime.Now.Date; string ISDCode = "91"; TransactionRecord tr = new TransactionRecord(); tr.NYBookingID = GTICKBOL.BollyLand_Max(); //tr.QntyCouple = Convert.ToInt16(CouplePackage); //tr.QntySingle = Convert.ToInt16(SinglePackage); //tr.QntyTeens = Convert.ToInt16(TeensPackage); //tr.QntyKids = Convert.ToInt16(KidsPackage); //tr.NYTotalAmount = Convert.ToDecimal(TotalAmount.ToString()); string nybookingid = MaxBookingId(tr.NYBookingID.ToString()); tr.NYBookingID = nybookingid; //GTICKBOL.NewYearBooking_Details(Convert.ToInt16(GoldPackage), Convert.ToInt16(SilverPackage), Convert.ToInt16(TeensPackage), Convert.ToInt16(KidsPackage), Convert.ToDecimal(TotalAmount.ToString()), DateofBooking, tr.NYBookingID.ToString(), txtName.Text, txtEmail.Text, txtContact.Text, false, "", textroyalinfo.Text); GTICKBOL.BollylandBooking_Details(Convert.ToInt16(GoldPackage), Convert.ToInt16(SilverPackage), Convert.ToDecimal(TotalAmount.ToString()), DateofBooking, tr.NYBookingID.ToString(), txtName.Text, txtEmail.Text, txtContact.Text, false, ""); //Payment Gateway Flow Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(tr.NYBookingID.ToString() + "Sending to HDFC Payment Gateway"); string trackId, amount; string URL = ""; trackId = tr.NYBookingID; amount = TotalAmount.ToString(); String ErrorUrl = KoDTicketingIPAddress + "BollyLand/HDFC/Error.aspx"; String ResponseUrl = KoDTicketingIPAddress + "BollyLand/HDFC/ReturnReceipt.aspx"; string qrystr = "id=" + HDFCTransPortalID + "&password="******"&action=1&langid=USA¤cycode=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; } if (NSDLval.IndexOf("http") == -1) { lblMess.Text = "Payment cannot be processed with information provided."; return; } 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); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// protected void btn_Submit_Click(object sender, EventArgs e) { long TransectionCounter = GTICKBOL.TransactionCounter_Max(); Session[TransectionCounter.ToString()] = TransectionCounter; //***************if routed from other website***************** if (Request.QueryString["Router"] == "" || Request.QueryString["Router"] == null) { Session["Router"] = ""; } else if (Request.QueryString["Router"] != "buzzintown" && Request.QueryString["Router"] != "airfaresau") { Session["Router"] = ""; } else { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Booking Through" + Request.QueryString["Router"].ToString()); Session["Router"] = Request.QueryString["Router"].ToString(); } //**************************************************************** Session["play_Val"] = ddl_Play.SelectedValue; Session["play_Val_Location"] = ddl_Location.SelectedItem; if (promotions == false) { Session_value = ddl_Location.SelectedValue + "," + ddl_Play.SelectedValue + "," + Convert.ToDateTime(dateofshow.Text.ToString()).ToString("dd/MM/yyyy") + "," + ddl_ShowTimes.SelectedValue + "," + ddl_Category.SelectedValue + "," + drp_TotalSeats.SelectedValue + "," + ddl_Location.SelectedItem.Text + "," + ddl_ShowTimes.SelectedItem.Text + "," + ddl_Category.SelectedItem.Text + "," + "" + "," + "" + "," + TransectionCounter;; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Render Seat Layout for " + Session_value); } else { KoDTicketingLibrary.DTO.Promotion PromoSession = (KoDTicketingLibrary.DTO.Promotion)Session["a" + Decrypt(Request.QueryString["promo"])]; if (package == false) { Session_value = ddl_Location.SelectedValue + "," + ddl_Play.SelectedValue + "," + Convert.ToDateTime(dateofshow.Text.ToString()).ToString("dd/MM/yyyy") + "," + ddl_ShowTimes.SelectedValue + "," + ddl_Category.SelectedValue + "," + drp_TotalSeats.SelectedValue + "," + ddl_Location.SelectedItem.Text + "," + ddl_ShowTimes.SelectedItem.Text + "," + ddl_Category.SelectedItem.Text + "," + PromoSession.PromotionCode.ToString().ToUpper() + "," + "" + "," + TransectionCounter; } else { //Session_value = ddl_Location.SelectedValue + "," + ddl_Play.SelectedValue + "," + Convert.ToDateTime(dateofshow.Text.ToString()).ToString("dd/MM/yyyy") + // "," + ddl_ShowTimes.SelectedValue + "," + ddl_Category.SelectedValue + "," + drp_TotalSeats.SelectedValue + // "," + ddl_Location.SelectedItem.Text + "," + ddl_ShowTimes.SelectedItem.Text + "," + ddl_Category.SelectedItem.Text + "," + PromoSession.PromotionCode.ToString().ToUpper() + "," + Session["Package"].ToString() + "," + TransectionCounter; Session_value = ddl_Location.SelectedValue + "," + ddl_Play.SelectedValue + "," + Convert.ToDateTime(dateofshow.Text.ToString()).ToString("dd/MM/yyyy") + "," + ddl_ShowTimes.SelectedValue + "," + ddl_Category.SelectedValue + "," + drp_TotalSeats.SelectedValue + "," + ddl_Location.SelectedItem.Text + "," + ddl_ShowTimes.SelectedItem.Text + "," + ddl_Category.SelectedItem.Text + "," + PromoSession.PromotionCode.ToString().ToUpper() + "," + Session["Package"].ToString() + "," + TransectionCounter; } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Render Seat Layout for " + Session_value); } if (Session["Hotel"] == null) { Session["Hotel"] = ""; } GTICKBOL.Insert_ShowDetail(Session_value, TransectionCounter); KoDTicketing.GTICKV.LogEntry(TransectionCounter.ToString(), "User Try to move from Default to Seat layout Page.", "1", ""); if (Request.QueryString["Router"] == "buzzintown" || Request.QueryString["Router"] == "airfaresau") { Response.Redirect("Seat-Layout.aspx?SessionId=" + Encrypt(TransectionCounter.ToString()) + "&Router=" + Request.QueryString["Router"], false); } else { if (Request.QueryString["promo"] != null) { Session["a" + Decrypt(Request.QueryString["promo"])] = ""; } Response.Redirect("Seat-Layout.aspx?SessionId=" + Encrypt(TransectionCounter.ToString()), false); } }
public static bool Validate(Security objSecurity) { return(GTICKBOL.ValidateAgent(objSecurity.username, objSecurity.password)); }
protected void btnMMTPromotionCode_Click(object sender, EventArgs e) { List <KoDTicketingLibrary.DTO.Promotion> listPromo = VistaBOL.GetPromostionCode(); string sum = GTICKBOL.MMTpackage_check(txtMMTPNR.Text); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("MMT ticket sum: " + sum); String PNRnumber = txtMMTPNR.Text; String PromotionCode = txtMMTPromotionCode.Text; int list = listPromo.Count; int no = int.Parse(sum); int select = int.Parse(ddl_noofpackage.SelectedValue.ToString()); if (no >= 4) { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Sorry, maximum 4 bookings are allowed on each Booking Id."; txtMMTPromotionCode.Text = ""; txtMMTPNR.Text = ""; txtMMTPromotionCode.Focus(); return; } else if ((no + select) > 4) { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Sorry, you can select only " + (4 - no) + " package";; txtMMTPromotionCode.Text = ""; txtMMTPNR.Text = ""; txtMMTPromotionCode.Focus(); return; } else if (txtMMTPromotionCode.Text.ToString().Length == 0) { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Please Enter Your Promotion Code"; txtMMTPromotionCode.Focus(); return; } else if (txtMMTPNR.Text == "") { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Please Enter Your PNR Number"; txtMMTPNR.Focus(); return; } else if (chkterms.Checked == false) { lblMsgPromotionCode.Visible = true; lblMsgPromotionCode.Text = "Accept terms and conditions"; txtMMTPNR.Focus(); return; } else { for (int i = 0; i < list; i++) { bool isMatchPromo = Regex.IsMatch(PromotionCode, listPromo[i].RegexValidator); bool isMatch = Regex.IsMatch(PNRnumber, "(?![U|u][S|s][0]{4}[B|b][0]{5})^([U|u][S|s][0-9]{4}[B|b]{1}[0-9]{5})$"); bool isMatch1 = Regex.IsMatch(PNRnumber, "(?![A|a][N|n][0]{12})^([A|a][N|n])[0-9]{12}$"); bool isMatch2 = Regex.IsMatch(PNRnumber, "(?![U|u][S|s][0]{4}[B|b]{1}[A-Z a-z 0-9]{7})^([U|u][S|s][0-9]{4}[B|b]{1}[A-Z a-z 0-9]{7})$"); bool isMatch3 = Regex.IsMatch(PNRnumber, "(?![U|u][N|n][0]{4}[B|b]{1}[A-Z a-z 0-9]{7})^([U|u][N|n][0-9]{4}[B|b]{1}[A-Z a-z 0-9]{7})$"); if ((isMatch || isMatch1 || isMatch2 || isMatch3) && isMatchPromo) { if (listPromo[i].PromotionCode.ToString().ToUpper() == "MMT") { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("MMT end date: " + listPromo[i].EndDate.ToString()); decimal TotalAmount = Convert.ToDecimal(ddl_noofpackage.SelectedValue) * Convert.ToDecimal("6000"); decimal PayableAmount = Convert.ToDecimal("4500") * Convert.ToDecimal(ddl_noofpackage.SelectedValue); Session["PromotionCode"] = listPromo[i]; Session[listPromo[i].PromotionCode] = listPromo[i]; Session["a" + listPromo[i].PromotionCode] = listPromo[i]; Session["Hotel"] = listPromo[i].PromotionCode.ToString(); Session["PayableAmount"] = PayableAmount; Session["TotalAmount"] = TotalAmount; Session["NoofPackages"] = ddl_noofpackage.SelectedValue.ToString(); Session["pnr"] = txtMMTPNR.Text.ToUpper(); Session["Package"] = "4500"; Session["promocode"] = txtMMTPromotionCode.Text.ToUpper(); //Session["day"] = ddl_date.SelectedItem.Text.ToString(); Response.Redirect("Default.aspx?MMT=MMTUS&promo=" + Encrypt(listPromo[i].PromotionCode)); } } } } PromotionNotValid(); }
public static DataTable AuditSeatsReport(String _AudiNo, String _ShowDate) { return(GTICKBOL.AuditSeatsReport(_AudiNo, _ShowDate)); }