protected void btnProceedToPayment_Click(object sender, EventArgs e) { try { int? createdBy = null; if (Session["UserID"] != null) { createdBy = Convert.ToInt32(Session["UserID"].ToString()); } if (Session["RedBusBookingDetails"] != null) { BookingDetails = (String[])Session["RedBusBookingDetails"]; string gridviewdata = client.getBoardingPoint(BookingDetails[4].Split('~')[1]); DataTable dtOnwardBoardingInfo = convertJsonStringToDataSet(gridviewdata).Tables[0]; string strOnwardBoardingInfo = dtOnwardBoardingInfo.Rows[0]["address"].ToString() + "," + dtOnwardBoardingInfo.Rows[0]["landmark"].ToString(); String referenceNumber = ""; String referenceNumberReturn = ""; referenceNumber = GenerateManabusRefNo(); string provider = BookingDetails[19].ToString(); if (BookingDetails[5].ToLower().Contains("single")) { Session["Ticketrefno"] = referenceNumber; } #region OneWayOrRoundTrip //SingleTrip if (BookingDetails[5].ToLower().Contains("single")) { #region onwardTrip String nameList = ""; String genderList = ""; String titleList = ""; String ageList = ""; int countlist = 0; foreach (RepeaterItem item in rptPassengersonward.Items) { DropDownList ddlrptr = (DropDownList)item.FindControl("ddlGender"); TextBox txtPassengerNamerptr = (TextBox)item.FindControl("txtPassengerName"); TextBox txtAgerptr = (TextBox)item.FindControl("txtAge"); string phoneno = txtPhoneNo.Text; if (countlist == 0) { ++countlist; nameList += txtPassengerNamerptr.Text; titleList += ddlrptr.SelectedItem.Value.ToString(); ageList += txtAgerptr.Text; genderList += ddlrptr.SelectedItem.Text.ToString(); } else { ++countlist; nameList += "," + txtPassengerNamerptr.Text; titleList += "," + ddlrptr.SelectedItem.Value.ToString(); ageList += "," + txtAgerptr.Text; genderList += "," + ddlrptr.SelectedItem.Text.ToString(); } } String passengerDetailsonward = ""; BlockSeats blockseats = new BlockSeats(); blockseats.SourceId = int.Parse(BookingDetails[10]); blockseats.DestinationId = int.Parse(BookingDetails[11]); blockseats.TripId = BookingDetails[12]; blockseats.JourneyDate = BookingDetails[1]; blockseats.BoardingId = BookingDetails[4].Split('~')[1]; blockseats.NoOfSeats = countlist; blockseats.SeatNo = BookingDetails[2]; blockseats.Title = titleList; blockseats.Name = nameList; blockseats.Age = ageList; blockseats.Sex = genderList; blockseats.Address = txtAddress.Text; blockseats.BookingRefNo = referenceNumber; blockseats.IdCardType = ddlIDType.SelectedItem.Text; blockseats.IdCardNo = txtIDNumber.Text; blockseats.IdCardIssuedBy = txtIdIssuedBY.Text; blockseats.MobileNo = txtPhoneNo.Text; blockseats.EmergencyMobileNo = txtPhoneNo.Text; blockseats.EmailId = txtEmailId.Text; blockseats.EmergencyMobileNo = txtEmailId.Text; blockseats.ProviderName = BookingDetails[19].ToString(); string var = BuildRequest(int.Parse(BookingDetails[3]), BookingDetails[2], BookingDetails[12], BookingDetails[4].Split('~')[1], BookingDetails[11].ToString(), BookingDetails[10].ToString() , nameList, genderList, titleList, ageList, BookingDetails[19].ToString()); lblMsg.Text = client.blockTicket(blockseats); if (lblMsg.Text.ToString().Split(' ').Length == 1 && lblMsg.Text.ToString().ToLower() != "tentative booking failed") { string[] strDate = BookingDetails[1].Trim().ToString().Split('-'); dt = Convert.ToDateTime(strDate[2] + "-" + strDate[1] + "-" + strDate[0]); int countpassengers = 0; foreach (RepeaterItem item in rptPassengersonward.Items) { DropDownList ddlrptr = (DropDownList)item.FindControl("ddlGender"); Label lblSeatNorptr = (Label)item.FindControl("lblSeatNo"); TextBox txtPassengerNamerptr = (TextBox)item.FindControl("txtPassengerName"); TextBox txtAgerptr = (TextBox)item.FindControl("txtAge"); if (countpassengers == 0) { ++countpassengers; passengerDetailsonward += lblSeatNorptr.Text + "-" + ddlrptr.SelectedItem.Value + "-" + txtPassengerNamerptr.Text + "-" + txtAgerptr.Text; } else { ++countpassengers; passengerDetailsonward += "," + lblSeatNorptr.Text + "-" + ddlrptr.SelectedItem.Value + "-" + txtPassengerNamerptr.Text + "-" + txtAgerptr.Text; } } } string[] str = new string[1]; str[0] = " to"; String[] cities = BookingDetails[0].ToString().Split(str, StringSplitOptions.None); res= InsertTentativeBooking(referenceNumber, Session["Ticketrefno"].ToString(), lblMsg.Text.ToString(), lblMsg.Text.ToString(), "", "", null, "SeatSeller" , BookingDetails[15].ToString(), BookingDetails[14].ToString(), dt , Convert.ToInt32(BookingDetails[10].ToString()), cities[0].ToString() , Convert.ToInt32(BookingDetails[11].ToString()), cities[1].ToString() , lblSeatNos.Text.ToString(), rptPassengersonward.Items.Count, Convert.ToDecimal(lblFare.Text.Trim().ToString()), null , strOnwardBoardingInfo, BookingDetails[4].Split('~')[0].ToString(), nameList, 20, "M", txtPhoneNo.Text.ToString() , txtEmailId.Text.ToString(), txtAddress.Text.ToString() , "", null, 0, 0, rbtnlstpaytype.Text.ToString(), "Cash", "Oneway", createdBy, "Online", "", passengerDetailsonward , ddlIDType.SelectedItem.Text.ToString(), txtIDNumber.Text.ToString(), "", provider); if (res == true) { lblMsg.Text=client.bookTicket(blockseats); if (lblMsg.Text.ToString().Split(' ').Length == 1) { InsertBookedTicketDetails(referenceNumber, lblMsg.Text.ToString()); //string CashcouponID = item["CashCouponId"].ToString(); pnlmail.Visible = true; GetTicketDetails(); lblMsg.Text = ""; } else { return; //Booking Failed. } } //BlockSeats blockSeats = new BlockSeats(); //blockSeats.Address = txtAddress.Text.ToString(); //blockSeats.Age = "25"; //blockSeats.BoardingId = lblBoardingPoint.ToolTip.ToString(); //blockSeats.BookingRefNo = referenceNumber.ToString(); //blockSeats.EmailId = txtEmailId.Text; //blockSeats.EmergencyMobileNo = txtPhoneNo.Text; //blockSeats.IdCardIssuedBy = txtIdIssuedBY.Text; //blockSeats.IdCardNo = txtIDNumber.Text; //blockSeats.IdCardType = ddlIDType.SelectedItem.Text; //blockSeats.JourneyDate = lblJourneyDate.Text; //blockSeats.MobileNo = txtPhoneNo.Text; //blockSeats.Name = "Name"; //blockSeats.NoOfSeats = rptPassengersonward.Items.Count; //blockSeats.ProviderName = BookingDetails[19].ToString(); //blockSeats.SeatNo = lblSeatNos.Text; //blockSeats.Sex = "Male"; //blockSeats.SourceId = Convert.ToInt32(BookingDetails[10].ToString());// //blockSeats.Title = "M"; //blockSeats.TripId = Convert.ToString(BookingDetails[12].ToString());// //blockSeats.DestinationId = Convert.ToInt32(BookingDetails[11].ToString());// //BusService bus = new BusService(); //string blockResponse = bus.BlockTicket(blockSeats); //lblMsg.Text = blockResponse; lblMsg.Visible = true; //if (blockSeats.ProviderName == "TICKETGOOSE") //{ // DataSet ds = convertJsonStringToDataSet(lblMsg.Text); // if (ds != null) // { // if (ds.Tables[0].Rows.Count > 0) // { // if (ds.Tables["status"].Rows[0]["code"].ToString().Trim().ToLower() == "200") // { // if (ds.Tables[0].Columns.Contains("bookingId")) // { // blockSeats.BookingId = ds.Tables[0].Rows[0]["bookingId"].ToString(); // lblMsg.Text = lblMsg.Text + "<br/><br/><br/><br/>" + bus.BookTicket(blockSeats); // } // } // else { lblMsg.Text = ds.Tables["status"].Rows[0]["message"].ToString(); } // } // } //} //else if (blockSeats.ProviderName == "BITLA") //{ // XmlDocument doc = new XmlDocument(); // doc.LoadXml(lblMsg.Text); // XmlNodeReader xmlReader = new XmlNodeReader(doc); // DataSet ds = new DataSet(); // ds.ReadXml(xmlReader); // if (ds != null) // { // if (ds.Tables[0].Rows[0][0].ToString().ToLower() == "200") // { // lblMsg.Text = lblMsg.Text + "<br/><br/><br/><br/>" + bus.BookTicket(blockSeats); // } // else { lblMsg.Text = ds.Tables[0].Rows[0][1].ToString().ToLower(); } // } //} // Server.Transfer("~/Users/Bus/redirect.aspx"); #endregion } #endregion } else { Response.Redirect("~/Default.aspx", false); } } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }
public string BookTicket(BlockSeats blockSeats, String ConsumerKey, String ConsumerSecret) { if (ValidateRequest(ConsumerKey, ConsumerSecret)) { ClientAPIList objClientAPIList = new ClientAPIList(); //if (HttpContext.Current.Cache["ClientAPI-" + ConsumerKey] == null) GetAPIProvidersList(ConsumerKey, ConsumerSecret); objClientAPIList = (ClientAPIList)HttpContext.Current.Cache["ClientAPI-" + ConsumerKey]; ClientAPIDetails objClientAPIDetails = objClientAPIList.SingleOrDefault(element => element.ProviderName == blockSeats.ProviderName); BookSeatsResponse objBookResponse = new BookSeatsResponse(); if (objClientAPIDetails != null) { try { switch (blockSeats.ProviderName) { case "BITLA": case "MORNINGSTAR": BitlaAPI clsBitlaAPI = new BitlaAPI(); objBookResponse = clsBitlaAPI.bookTicket(blockSeats.SourceId, blockSeats.DestinationId, blockSeats.TripId, objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, blockSeats.NoOfSeats, blockSeats.BoardingId.ToString(), blockSeats.SeatNo, blockSeats.Title, blockSeats.Name, blockSeats.Age, blockSeats.Sex, blockSeats.Address, blockSeats.BookingRefNo, blockSeats.IdCardType, blockSeats.IdCardNo, blockSeats.IdCardIssuedBy, blockSeats.MobileNo, blockSeats.EmergencyMobileNo, blockSeats.EmailId); break; case "TICKETGOOSE": TicketGooseAPI clsTicketGooseAPI = new TicketGooseAPI(); objBookResponse = clsTicketGooseAPI.BookTicket(blockSeats.BookingId, objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, objClientAPIDetails.ConsumerSecret); break; case "ABHIBUS": case "SVR": case "KALLADA": case "KAVERI": case "RAJESH": case "SAIANJANA": AbhibusAPI clsAbhiBusAPI = new AbhibusAPI(); objBookResponse = clsAbhiBusAPI.bookSeats(blockSeats.SourceId, blockSeats.DestinationId, blockSeats.JourneyDate , blockSeats.TripId, blockSeats.SeatNo, blockSeats.Title, blockSeats.Name, blockSeats.BoardingId, blockSeats.Address , blockSeats.Name, blockSeats.MobileNo, blockSeats.EmailId, blockSeats.BookingRefNo, objClientAPIDetails.APIURL , objClientAPIDetails.ConsumerKey); objBookResponse.extraseatinfo = blockSeats.SourceId + "," + blockSeats.DestinationId + "," + blockSeats.JourneyDate + "," + blockSeats.TripId + "," + blockSeats.SeatNo + "," + blockSeats.Title + "," + blockSeats.Name + "," + blockSeats.BoardingId + "," + blockSeats.Address + "," + blockSeats.Name + "," + blockSeats.MobileNo + "," + blockSeats.EmailId + "," + blockSeats.BookingRefNo; break; case "EASYBUS": EasybusAPI clsEasyBusAPI = new EasybusAPI(); objBookResponse = clsEasyBusAPI.bookSeats(blockSeats.SourceId, blockSeats.DestinationId, blockSeats.JourneyDate , blockSeats.TripId, blockSeats.SeatNo, blockSeats.Sex, blockSeats.Name, blockSeats.BoardingId, blockSeats.Address , blockSeats.Name, blockSeats.MobileNo, blockSeats.EmailId, blockSeats.BookingRefNo, objClientAPIDetails.APIURL , objClientAPIDetails.ConsumerKey); objBookResponse.extraseatinfo = blockSeats.SourceId + "," + blockSeats.DestinationId + "," + blockSeats.JourneyDate + "," + blockSeats.TripId + "," + blockSeats.SeatNo + "," + blockSeats.Title + "," + blockSeats.Name + "," + blockSeats.BoardingId + "," + blockSeats.Address + "," + blockSeats.Name + "," + blockSeats.MobileNo + "," + blockSeats.EmailId + "," + blockSeats.BookingRefNo; break; default: break; } } catch (Exception ex) { objBookResponse.Message = ex.ToString(); } } else { objBookResponse.Message = "no api found"; } return JsonConvert.SerializeObject(objBookResponse); } else { return null; //throw new http exception //throw new System.Web.Http.HttpResponseException(HttpStatusCode.Forbidden); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["Refno"] != null) { if (Convert.ToString(Request.QueryString["Refno"]) == Convert.ToString(Session["Order_Id"])) { //LJB3240,LJB66851787 Session["Ticketrefno"] = Convert.ToString(Request.QueryString["Refno"]); clsMasters objTicket = new clsMasters(); objTicket.ScreenInd = Masters.getticket; objTicket.BankReferenceNo = Convert.ToString(Session["Ticketrefno"]); DataSet dsTicket = objTicket.fnGetData(); if (dsTicket != null) { if (dsTicket.Tables[0].Rows.Count > 0) { BlockSeats blockseats = new BlockSeats(); blockseats.SourceId = Convert.ToInt32(dsTicket.Tables[0].Rows[0]["SourceId"]); blockseats.DestinationId = Convert.ToInt32(dsTicket.Tables[0].Rows[0]["DestinationId"]); blockseats.TripId = Convert.ToString(dsTicket.Tables[0].Rows[0]["TripID"]); blockseats.JourneyDate = Convert.ToDateTime(dsTicket.Tables[0].Rows[0]["DateOfJourney"]).ToShortDateString(); blockseats.BoardingId = Convert.ToString(dsTicket.Tables[0].Rows[0]["Boarding_Id"]); blockseats.NoOfSeats = Convert.ToInt32(dsTicket.Tables[0].Rows[0]["NoOfSeats"]); blockseats.SeatNo = Convert.ToString(dsTicket.Tables[0].Rows[0]["SeatNos"]); blockseats.Title = Convert.ToString(dsTicket.Tables[0].Rows[0]["Title"]); blockseats.Name = Convert.ToString(dsTicket.Tables[0].Rows[0]["FullName"]); blockseats.Age = Convert.ToString(dsTicket.Tables[0].Rows[0]["Age"]); blockseats.Sex = Convert.ToString(dsTicket.Tables[0].Rows[0]["Gender"]); blockseats.Address = Convert.ToString(dsTicket.Tables[0].Rows[0]["Address"]); blockseats.BookingRefNo = Convert.ToString(dsTicket.Tables[0].Rows[0]["PGMBRefNo"]); blockseats.IdCardType = Convert.ToString(dsTicket.Tables[0].Rows[0]["IDType"]); blockseats.IdCardNo = Convert.ToString(dsTicket.Tables[0].Rows[0]["IDNumber"]); blockseats.IdCardIssuedBy = Convert.ToString(dsTicket.Tables[0].Rows[0]["IDIssuedBy"]); blockseats.MobileNo = Convert.ToString(dsTicket.Tables[0].Rows[0]["ContactNo"]); blockseats.EmergencyMobileNo = Convert.ToString(dsTicket.Tables[0].Rows[0]["ContactNo"]); blockseats.EmailId = Convert.ToString(dsTicket.Tables[0].Rows[0]["EmailId"]); blockseats.ProviderName = Convert.ToString(dsTicket.Tables[0].Rows[0]["APIName"]); blockseats.BookingId = Convert.ToString(dsTicket.Tables[0].Rows[0]["BlockedId"]); lblMsg.Text = client.bookTicket(blockseats); DataSet dsbook = convertJsonStringToDataSet(lblMsg.Text); if (dsbook != null) { if (dsbook.Tables[0].Rows.Count > 0) { if (dsbook.Tables[0].Columns.Contains("APIPNR")) { if (Convert.ToString(dsbook.Tables[0].Rows[0]["Status"]).ToUpper() == "SUCCESS") { if (blockseats.ProviderName.Trim().ToUpper() == "TICKETGOOSE") { lblMsg.Text = blockseats.BookingId.ToString(); } else { lblMsg.Text = dsbook.Tables[0].Rows[0]["APIPNR"].ToString(); } InsertBookedTicketDetails(Convert.ToString(Session["Order_Id"]), lblMsg.Text.ToString()); pnlmail.Visible = true; GetTicketDetails(); Session["Order_Id"] = null; Session["blockseats"] = null; Session["Ticketrefno"] = null; lblMsg.Text = ""; } else { lblMsg.Text = "null response" + lblMsg.Text + Convert.ToString(dsbook.Tables[0].Rows[0]["APIPNR"]) + Convert.ToString(dsbook.Tables[0].Rows[0]["Status"]) + Convert.ToString(dsbook.Tables[0].Rows[0]["Message"]); lblMsg.ForeColor = System.Drawing.Color.Red; } } else { lblMsg.Text = Convert.ToString(dsbook.Tables[0].Rows[0]["Status"]); lblMsg.ForeColor = System.Drawing.Color.Red; } } } } else { lblMsg.Text = "no records found"; lblMsg.ForeColor = System.Drawing.Color.Red; } } else { lblMsg.Text = "Booking failed"; lblMsg.ForeColor = System.Drawing.Color.Red; } } } else { GetTicketDetails(); Session["Order_Id"] = null; Session["blockseats"] = null; Session["Ticketrefno"] = null; } } }
protected void btnProceedToPayment_Click(object sender, EventArgs e) { try { if (cbxAgree.Checked == false) { lblMsg.Text = "please check the Terms & conditions."; return; } int? createdBy = null; if (Session["UserID"] != null) { createdBy = Convert.ToInt32(Session["UserID"].ToString()); } else { createdBy = 0; } if (Session["RedBusBookingDetails"] != null) { BookingDetails = (String[])Session["RedBusBookingDetails"]; // string gridviewdata = client.getBoardingPoint(BookingDetails[4].Split('~')[1]); // DataTable dtOnwardBoardingInfo = convertJsonStringToDataSet(gridviewdata).Tables[0]; string boardinginf = BookingDetails[4].ToString(); string strOnwardBoardingInfo = string.Empty; if (BookingDetails[19].ToString().Trim() == "TICKETGOOSE") { strOnwardBoardingInfo = Convert.ToString(BookingDetails[4].Split('~')[0]); } else { strOnwardBoardingInfo = Convert.ToString(BookingDetails[4]); } // string strOnwardBoardingInfo = dtOnwardBoardingInfo.Rows[0]["address"].ToString() + "," + // dtOnwardBoardingInfo.Rows[0]["landmark"].ToString(); String referenceNumber = ""; String referenceNumberReturn = ""; referenceNumber = GenerateManabusRefNo(); string provider = BookingDetails[19].ToString(); if (BookingDetails[5].ToLower().Contains("single")) { Session["Ticketrefno"] = referenceNumber; } Session["Order_Id"] = referenceNumber; Session["Amount"] = lblTotalAmountPayable.Text; string phoneno; //SingleTrip if (BookingDetails[5].ToLower().Contains("single")) { #region onwardTrip String nameList = ""; String genderList = ""; String titleList = ""; String ageList = ""; int countlist = 0; foreach (RepeaterItem item in rptPassengersonward.Items) { DropDownList ddlrptr = (DropDownList)item.FindControl("ddlGender"); TextBox txtPassengerNamerptr = (TextBox)item.FindControl("txtPassengerName"); TextBox txtAgerptr = (TextBox)item.FindControl("txtAge"); phoneno = txtPhoneNo.Text; if (countlist == 0) { ++countlist; nameList += txtPassengerNamerptr.Text; titleList += ddlrptr.SelectedItem.Value.ToString(); ageList += txtAgerptr.Text; genderList += ddlrptr.SelectedItem.Text.ToString(); } else { ++countlist; nameList += "," + txtPassengerNamerptr.Text; titleList += "," + ddlrptr.SelectedItem.Value.ToString(); ageList += "," + txtAgerptr.Text; genderList += "," + ddlrptr.SelectedItem.Text.ToString(); } } String passengerDetailsonward = ""; string bookingid = ""; string boarding = lblBoardingPoint.ToolTip.ToString(); BlockSeats blockseats = new BlockSeats(); blockseats.SourceId = int.Parse(BookingDetails[10]); blockseats.DestinationId = int.Parse(BookingDetails[11]); blockseats.TripId = BookingDetails[12]; blockseats.JourneyDate = BookingDetails[1]; blockseats.BoardingId = BookingDetails[4].Split('~')[1]; blockseats.NoOfSeats = countlist; blockseats.SeatNo = BookingDetails[2]; blockseats.Title = titleList; blockseats.Name = nameList; blockseats.Age = ageList; blockseats.Sex = genderList; blockseats.Address = txtAddress.Text; blockseats.BookingRefNo = referenceNumber; blockseats.IdCardType = ddlIDType.SelectedItem.Text; blockseats.IdCardNo = txtIDNumber.Text; blockseats.IdCardIssuedBy = txtIdIssuedBY.Text; blockseats.MobileNo = txtPhoneNo.Text; blockseats.EmergencyMobileNo = txtPhoneNo.Text; blockseats.EmailId = txtEmailId.Text; blockseats.ProviderName = BookingDetails[19].ToString(); blockseats.BookingId = bookingid; string blockresult = client.blockTicket(blockseats); DataSet ds = convertJsonStringToDataSet(blockresult); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Columns.Contains("Status")) { if (ds.Tables[0].Rows[0]["Status"].ToString().ToUpper() == "SUCCESS") { if (ds.Tables[0].Columns.Contains("BookingID")) { blockseats.BookingId = ds.Tables[0].Rows[0]["BookingID"].ToString(); lblMsg.Text = Convert.ToString(ds.Tables[0].Rows[0]["Status"]); } } else { lblMsg.Text = ds.Tables[0].Rows[0]["message"].ToString(); return; } } } } if (Session["UserID"] != null) { if (Session["Role"].ToString() == "Agent") { ClsBAL objBAL = new ClsBAL(); DataSet dsBalance = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"])); DataSet dsCommSlab = objBAL.GetCommissionSlab(Session["Role"].ToString(), "Bus", provider); // Change it if (dsCommSlab != null) { if (dsCommSlab.Tables[0].Rows.Count > 0) { string commisionPercentage = dsCommSlab.Tables[0].Rows[0]["Commission"].ToString();// Change it string balance = dsBalance.Tables[0].Rows[0]["Balance"].ToString(); //string commisionPercentage = dsBalance.Tables[0].Rows[0]["CommisionPercentage"].ToString(); string agentId = dsBalance.Tables[0].Rows[0]["AgentId"].ToString(); string actualFare; string deductAmount; string commisionFare; if (ViewState["MarkUp"] != null) { double Am = Convert.ToDouble(lblTotalAmountPayable.Text.ToString()) - Convert.ToDouble(ViewState["MarkUp"].ToString()); actualFare = Am.ToString(); deductAmount = Convert.ToString(Convert.ToDouble(actualFare.ToString()) - ((Convert.ToDouble(actualFare.ToString()) * Convert.ToDouble(commisionPercentage)) / 100)); commisionFare = Convert.ToString(Convert.ToDouble(actualFare.ToString()) - Convert.ToDouble(deductAmount)); } else { actualFare = lblTotalAmountPayable.Text.ToString(); deductAmount = Convert.ToString(Convert.ToDouble(lblTotalAmountPayable.Text.ToString()) - ((Convert.ToDouble(lblTotalAmountPayable.Text.ToString()) * Convert.ToDouble(commisionPercentage)) / 100)); commisionFare = Convert.ToString(Convert.ToDouble(lblTotalAmountPayable.Text.ToString()) - Convert.ToDouble(deductAmount)); } Session["AgentId_Agent"] = agentId; Session["ActualFare_Agent"] = actualFare; Session["CommisionFare_Agent"] = commisionFare; Session["CommisionPercentage_Agent"] = commisionPercentage; Session["DeductAmount_Agent"] = deductAmount; Session["Markup"] = ViewState["MarkUp"]; if (Convert.ToDouble(balance) >= Convert.ToDouble(deductAmount)) { bool b = objBAL.UpdateAgentBalance(Convert.ToInt32(agentId), Convert.ToDouble(deductAmount), Convert.ToDouble(commisionFare)); //UpdateagentBalance,@RefundAmount } else { lblMsg.Text = "You dont have enough balance to book a ticket."; return; } } else { lblMsg.Text = "Please Contact administrater "; return; } } } } Session["blockseats"] = blockseats; if (lblMsg.Text.ToString().ToUpper() == "SUCCESS" && lblMsg.Text.ToString().ToLower() != "tentative booking failed") { string[] strDate = BookingDetails[1].Trim().ToString().Split('-'); dt = Convert.ToDateTime(strDate[2] + "-" + strDate[1] + "-" + strDate[0]); int countpassengers = 0; foreach (RepeaterItem item in rptPassengersonward.Items) { DropDownList ddlrptr = (DropDownList)item.FindControl("ddlGender"); Label lblSeatNorptr = (Label)item.FindControl("lblSeatNo"); TextBox txtPassengerNamerptr = (TextBox)item.FindControl("txtPassengerName"); TextBox txtAgerptr = (TextBox)item.FindControl("txtAge"); if (countpassengers == 0) { ++countpassengers; passengerDetailsonward += lblSeatNorptr.Text + "-" + ddlrptr.SelectedItem.Value + "-" + txtPassengerNamerptr.Text + "-" + txtAgerptr.Text; } else { ++countpassengers; passengerDetailsonward += "," + lblSeatNorptr.Text + "-" + ddlrptr.SelectedItem.Value + "-" + txtPassengerNamerptr.Text + "-" + txtAgerptr.Text; } } } string[] str = new string[1]; str[0] = " to"; //BookingDetails[4].Split('-')[7].Split('~')[1] String[] cities = BookingDetails[0].ToString().Split(str, StringSplitOptions.None); res = InsertTentativeBooking(referenceNumber, Convert.ToString(Session["Ticketrefno"]), blockseats.BookingId, lblMsg.Text.ToString(), "", "", null, provider , BookingDetails[15].ToString(), BookingDetails[14].ToString(), dt , Convert.ToInt32(BookingDetails[10].ToString()), cities[0].ToString() , Convert.ToInt32(BookingDetails[11].ToString()), cities[1].ToString() , lblSeatNos.Text.ToString(), rptPassengersonward.Items.Count,Convert.ToDecimal(ViewState["MarkUp"].ToString()), Convert.ToDecimal(lblFare.Text.Trim().ToString()), null , strOnwardBoardingInfo, BookingDetails[4].Split('-')[0].ToString() + "-" + BookingDetails[4].Split('-')[BookingDetails[4].Split('-').Length - 1].ToString().Split('~')[0].ToString(), nameList, 20, "M", txtPhoneNo.Text.ToString() , txtEmailId.Text.ToString(), txtAddress.Text.ToString() , "", null, 0, 0, "Online", "Cash", "Oneway", createdBy, "Online", "", passengerDetailsonward , ddlIDType.SelectedItem.Text.ToString(), txtIDNumber.Text.ToString(), "", provider, Convert.ToDouble(Session["CommisionFare_Agent"]), blockseats.TripId, blockseats.Title, Convert.ToString(blockseats.BoardingId)); if (res == true) { if (Session["UserID"] != null) { if (Session["Role"].ToString() == "Admin" || Session["Role"].ToString() == "CSE") { lblMsg.Text = client.bookTicket(blockseats); DataSet dsbook = convertJsonStringToDataSet(lblMsg.Text); if (dsbook != null) { if (dsbook.Tables[0].Rows.Count > 0) { if (dsbook.Tables[0].Columns.Contains("APIPNR")) { lblMsg.Text = dsbook.Tables[0].Rows[0]["APIPNR"].ToString(); } } } if (Convert.ToString(dsbook.Tables[0].Rows[0]["APIPNR"]) == "SUCCESS" || Convert.ToString(dsbook.Tables[0].Rows[0]["Status"]).ToUpper() == "SUCCESS") { if (lblMsg.Text.ToString().Split(' ').Length == 1) { InsertBookedTicketDetails(referenceNumber, lblMsg.Text.ToString()); Response.Redirect("redirectbus.aspx", false); } } else { return; //Booking Failed. } } else if (Session["Role"].ToString() == "Agent") { lblMsg.Text = client.bookTicket(blockseats); DataSet dsbook = convertJsonStringToDataSet(lblMsg.Text); if (dsbook != null) { if (dsbook.Tables[0].Rows.Count > 0) { if (dsbook.Tables[0].Columns.Contains("APIPNR")) { lblMsg.Text = dsbook.Tables[0].Rows[0]["APIPNR"].ToString(); } } } if (Convert.ToString(dsbook.Tables[0].Rows[0]["APIPNR"]) == "SUCCESS" || Convert.ToString(dsbook.Tables[0].Rows[0]["Status"]).ToUpper() == "SUCCESS") { if (lblMsg.Text.ToString().Split(' ').Length == 1) { InsertBookedTicketDetails(referenceNumber, lblMsg.Text.ToString()); Response.Redirect("redirectbus.aspx", false); } } else { return; //Booking Failed. } } else if (Convert.ToDouble(lblTotalAmountPayable.Text) == Convert.ToDouble(0)) { lblMsg.Text = client.bookTicket(blockseats); DataSet dsbook = convertJsonStringToDataSet(lblMsg.Text); if (dsbook != null) { if (dsbook.Tables[0].Rows.Count > 0) { if (dsbook.Tables[0].Columns.Contains("APIPNR")) { lblMsg.Text = dsbook.Tables[0].Rows[0]["APIPNR"].ToString(); } } } if (Convert.ToString(dsbook.Tables[0].Rows[0]["APIPNR"]) == "SUCCESS" || Convert.ToString(dsbook.Tables[0].Rows[0]["Status"]).ToUpper() == "SUCCESS") { if (lblMsg.Text.ToString().Split(' ').Length == 1) { InsertBookedTicketDetails(referenceNumber, lblMsg.Text.ToString()); Response.Redirect("redirectbus.aspx", false); } } else { return; //Booking Failed. } } else if (Session["Role"].ToString() == "User") { Server.Transfer("Pay.aspx?val=bus"); } } else { // Response.Redirect("redirectbus.aspx?Refno=" + Session["Ticketrefno"].ToString(), false); Response.Redirect("Pay.aspx?val=bus", false); } } #endregion } } else { Response.Redirect("~/Default.aspx", false); } } catch (Exception ex) { lblMsg.Text = ex.ToString(); } }
public string bookTicket(BlockSeats tentativeresponsekey) { // return invokePostRequest("api/BookTicket" , tentativeresponsekey); var obj = new BusesViewModel(); return obj.BookTicket(tentativeresponsekey, ConsumerKey, ConsumerSecret); }
public string blockTicket(BlockSeats requestString) { // return invokePostRequest("api/BlockTicket", requestString); var obj = new BusesViewModel(); return obj.BlockTicket(requestString, ConsumerKey, ConsumerSecret); }