| Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64 Path : /home/devsafetybis/.trash/yuvatrip.com/App_Code/ |
| Current File : /home/devsafetybis/.trash/yuvatrip.com/App_Code/flightapi.cs |
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using System.Dynamic;
using Yuvatrip.B2CFlightAPI;
using Newtonsoft.Json;
/// <summary>
/// Summary description for flightapi
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class flightapi : System.Web.Services.WebService
{
public flightapi(){}
flightsevices flight = new flightsevices();
clientservices client = new clientservices();
[WebMethod(EnableSession = true)]
[ScriptMethod(UseHttpGet = true)]
public string Search(string FlightSearchCriteria)
{
dynamic SearchResult = new ExpandoObject();
try
{
flight.ClientID = "1";
flight.ContactID = "1";
flight.FlightSearchCriteria = FlightSearchCriteria;
SearchResult = flight.Search();
}
catch (Exception ex)
{
SearchResult.Message = ex.Message + ex.Source.ToString();
}
return flightsevices.stringifyJSOND(SearchResult);
}
[WebMethod(EnableSession = true)]
[ScriptMethod(UseHttpGet = true)]
public dynamic GetFlightDetail(string FlightSearchCriteria, string TraceId, string OBResultIndex, string IBResultIndex)
{
dynamic UpdatedFare = new ExpandoObject();
try
{
flight.ClientID = "1";
flight.ContactID = "1";
flight.FlightSearchCriteria = FlightSearchCriteria;
flight.TraceId = TraceId;
flight.OBResultIndex = OBResultIndex;
flight.IBResultIndex = string.IsNullOrEmpty(IBResultIndex) ? "NA" : IBResultIndex;
UpdatedFare = flight.GetFlightDetails();
}
catch (Exception ex)
{
UpdatedFare.Message = ex.Message + ex.Source.ToString();
}
return UpdatedFare;
}
[WebMethod(EnableSession = true)]
[ScriptMethod(UseHttpGet = true)]
public dynamic GetFareQuote(string FlightSearchCriteria, string TraceId, string OBResultIndex, string IBResultIndex)
{
dynamic UpdatedFare = new ExpandoObject();
try
{
flight.ClientID = "1";
flight.ContactID = "1";
flight.FlightSearchCriteria = FlightSearchCriteria;
flight.TraceId = TraceId;
flight.OBResultIndex = OBResultIndex;
flight.IBResultIndex = string.IsNullOrEmpty(IBResultIndex) ? "NA" : IBResultIndex;
UpdatedFare = flight.GetFareQuote();
}
catch (Exception ex)
{
}
return UpdatedFare;
}
[WebMethod(EnableSession = true)]
[ScriptMethod(UseHttpGet = true)]
public string GetPaymentOption(string FlightSearchCriteria, string TraceId, string OBResultIndex, string IBResultIndex)
{
string Payment = "";
try
{
flight.ClientID = "1";
flight.ContactID = "1";
if (Session["BTCIsLoggedIn"] != null )
{
flight.ClientID = Session["BTCClientID"].ToString();
flight.ContactID = Session["BTCContactID"].ToString();
}
flight.FlightSearchCriteria = FlightSearchCriteria;
flight.TraceId = TraceId;
flight.OBResultIndex = OBResultIndex;
flight.IBResultIndex = string.IsNullOrEmpty(IBResultIndex) ? "NA" : IBResultIndex;
Payment = flight.GetPaymentOptionB2C();
}
catch (Exception exeption) { Payment = exeption.Message; }
return Payment;
}
[WebMethod(EnableSession = true)]
[ScriptMethod(UseHttpGet = true)]
public dynamic PayAndProceed(string paxDetail, string FlightSearchCriteria, string TraceId, string OBResultIndex, string IBResultIndex, string email, string mobileNo, string PayOption, string Page, string promocodetext = "")
{
Session["PassengerDetail"] = paxDetail;
Session["FlightSearchCriteria"] = FlightSearchCriteria;
Session["promocodetext"] = promocodetext;
dynamic status = new ExpandoObject();
try
{
dynamic PaxDetail = new ExpandoObject();
PaxDetail = JsonConvert.DeserializeObject<ExpandoObject>(paxDetail);
if (Session["BTCIsLoggedIn"] == null)
{
dynamic clientdetail = new ExpandoObject();
clientdetail.emailid = email;
clientdetail.clienttype = "Customer";
clientdetail = client.CheckExistence(clientdetail);
if (clientdetail.status.errorcode != 0)
{
dynamic criteria = new ExpandoObject();
criteria.name = PaxDetail.List[0].FName + " " + PaxDetail.List[0].LName;
criteria.emailid = email.Trim().ToLower().ToString();
criteria.mobileno = mobileNo.ToString();
client.RegisterCustomer(criteria);
}
else { client.SetDetail(clientdetail.response); }
}
if (Session["BTCClientID"] != null)
{
flight.ClientID = Session["BTCClientID"].ToString();
flight.ContactID = Session["BTCContactID"].ToString();
flight.CouponCode = promocodetext;
flight.Paxs = paxDetail;
flight.Email = email;
flight.MobileNo = mobileNo;
flight.FlightSearchCriteria = FlightSearchCriteria;
flight.TraceId = TraceId;
flight.OBResultIndex = OBResultIndex;
flight.IBResultIndex = string.IsNullOrEmpty(IBResultIndex) ? "NA" : IBResultIndex;
if(Page =="SearchResult") { flight.BookingGenerated = false; }
if (Page == "OnlinePayment") { flight.BookingGenerated = false; }
status = flight.PayAndProceed(PayOption.Split('-')[0], PayOption.Split('-')[1]);
}
else
{
status.errorcode = 101;
status.description = "Session Expired";
}
}
catch (Exception exeption)
{
status.errorcode = 102;
status.description = exeption.StackTrace.ToString();
}
finally
{
}
return ((ExpandoObject)status).ToDictionary(item => item.Key, item => item.Value);
}
}