public DataTable CancelTicket(string bookingId, String[] SeatNo) { try { TGTravelServiceClient o = new TGTravelServiceClient(); o.Open(); DataTable data = new DataTable(); data.Columns.Add("cancellationCharge"); data.Columns.Add("seatFare"); data.Columns.Add("seatNbr"); data.Columns.Add("Status"); CancellationChargeDetails CTicket = o.cancelTicket(UserId, Password, bookingId, SeatNo); foreach (CancellationChargeDetailsDTO CT in CTicket.cancellationChargeDetailsList) { if (CTicket.status.message.ToString() == "Success") { DataRow row = data.NewRow(); row["cancellationCharge"] = CT.cancellationCharge; row["seatFare"] = CT.seatFare; row["seatNbr"] = CT.seatNbr; row["Status"] = CTicket.status.message.ToString(); data.Rows.Add(row); } } o.Close(); return data; } catch (Exception ex) { throw ex; } }
/// <summary> /// Method for cancelling ticket /// </summary> /// <returns></returns> public String cancelTicket(String bookingId, String seatNumbers, String URL, String ConsumerKey, String ConsumerSecret) { client = new TGTravelServiceClient("TGSWS", URL); CancellationChargeDetails response = client.cancelTicket(ConsumerKey, ConsumerSecret, bookingId, seatNumbers.Split(',')); return JsonConvert.SerializeObject(response); }