public PNRData(string searchid, CustomerInfo ci, string rph, string ContextResult, string BookinID) { //string filePathContext = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_ContextChange-RS.xml"); //if (File.Exists(filePathContext)) //{ // ContextResult = File.ReadAllText(filePathContext); //} //else //{ // ContextResult = XMLRead.ContextChange(searchid); //} string result = ""; int rphl = rph.ToString().Length; if (rphl == 1) { rph = "0" + rph.ToString(); } string RateBodyRQ = GetRateDescBodyRQ(rph); string PassengerBodyRQ = GetPassengerBodyRQ(ci); string HoteResBodyRQ = GetHotelResBodyRQ(ci, rph); string RateRQ = GetRateDescRQ(ContextResult, RateBodyRQ); result = XMLRead.SendQuery(RateRQ); XMLRead.SaveXMLFile(RateRQ, result, BookinID + "_RateDesec"); string PassengerRQ = GetPassengerXMLRQ(result, PassengerBodyRQ); result = XMLRead.SendQuery(PassengerRQ); XMLRead.SaveXMLFile(RateRQ, result, BookinID + "_PassengerDet"); string HotelResRq = GetHotelResXMLRQ(result, HoteResBodyRQ); result = XMLRead.SendQuery(HotelResRq); XMLRead.SaveXMLFile(RateRQ, result, BookinID + "_HotelResDet"); string EndTransRQ = GetEndTransRQ(result); result = XMLRead.SendQuery(EndTransRQ); XMLRead.SaveXMLFile(RateRQ, result, BookinID + "_EndTrans"); string EndTransXML = result; Hes = new HotelEndTrans(EndTransXML); if (result.ToString() != "") { DataSet ds = new DataSet(); DataSet dsSession = new DataSet(); StringReader se_stream = new StringReader(result); dsSession.ReadXml(se_stream); string Rq = ""; if (dsSession.Tables["BinarySecurityToken"] != null) { DataTable dtBinarySecurityToken = dsSession.Tables["BinarySecurityToken"]; DataTable dtMessageData = dsSession.Tables["MessageData"]; DataTable dtMessageHeader = dsSession.Tables["MessageHeader"]; string timestamp = DateTime.UtcNow.ToString(); string cresult = XMLRead.closession(dtMessageData.Rows[0]["MessageId"].ToString(), timestamp, dtBinarySecurityToken.Rows[0]["BinarySecurityToken_Text"].ToString(), searchid + "_PNREndTrans", XMLRead.pcc, XMLRead.ipcc); } } }
public HotelMedia(string Hotelcode, string contextresult, string searchid, string viewid, string b2c_idn) { DataTable dtpcc = manage_data.getpccdetails(b2c_idn); if (dtpcc.Rows.Count > 0) { pcc = dtpcc.Rows[0]["prv_pcc"].ToString(); ipcc = dtpcc.Rows[0]["prv_ipcc"].ToString(); username = dtpcc.Rows[0]["prv_username"].ToString(); password = dtpcc.Rows[0]["prv_pwd"].ToString(); } try { string ContextResult = ""; // ContextResult = contextresult; //string filePathContext = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_ContextChange-RS.xml"); //if (File.Exists(filePathContext)) //{ // ContextResult = File.ReadAllText(filePathContext); //} //else //{ // ContextResult = XMLRead.ContextChange(searchid); //} ContextResult = XMLRead.ContextChange(searchid + "_Media"); string resultxml = GetMediaXMLContext(Hotelcode, searchid, ContextResult, b2c_idn); if (resultxml.ToString() != "") { DataSet ds = new DataSet(); DataSet dsSession = new DataSet(); StringReader se_stream = new StringReader(resultxml); dsSession.ReadXml(se_stream); string Rq = ""; if (dsSession.Tables["BinarySecurityToken"] != null) { DataTable dtBinarySecurityToken = dsSession.Tables["BinarySecurityToken"]; DataTable dtMessageData = dsSession.Tables["MessageData"]; DataTable dtMessageHeader = dsSession.Tables["MessageHeader"]; string timestamp = DateTime.UtcNow.ToString(); string cresult = XMLRead.closession(dtMessageData.Rows[0]["MessageId"].ToString(), timestamp, dtBinarySecurityToken.Rows[0]["BinarySecurityToken_Text"].ToString(), searchid + "_Media", XMLRead.pcc, XMLRead.ipcc); } } xmldoc.LoadXml(resultxml); XmlNode xnod = xmldoc.DocumentElement; XmlNode xheader = xnod.ChildNodes[0]; XmlNode xbody = xnod.ChildNodes[1]; XmlNode xGetImageRS = xbody.ChildNodes[0]; XmlNode xMediaInfos = xGetImageRS.ChildNodes[1]; CreateTables(); foreach (XmlNode xn in xMediaInfos) { int rno = dtHotelMediaInfo.Rows.Count + 1; FillHotelMediaInfo(rno, xn); foreach (XmlNode xn1 in xn) { if (xn1.Name.ToLower() == "ns23:hotelinfo") { AddXMLHotelInfo(xn1, rno); } if (xn1.Name.ToLower() == "ns23:imageitems") { AddXMLImageItems(xn1, rno); } } } } catch { } }
public List <HotelImageJsonCode> Get(string searchid, string HotelCode, string curcode, string b2c_idn) { List <HotelImageJsonCode> HotelImages = new List <HotelImageJsonCode>(); try { if (searchid != "" && searchid != null && HotelCode != "" && HotelCode != null) { string[] HotelCodes = HotelCode.Trim('*').Split('*'); foreach (string hcode in HotelCodes) { HotelImageJsonCode hijc = new HotelImageJsonCode(); DataTable dtHotelUrl = HotelDBLayer.GetHotelImageUrl(hcode); if (dtHotelUrl.Rows.Count > 0) { hijc.Image = dtHotelUrl.Rows[0]["ImageUrl"].ToString(); hijc.Logo = dtHotelUrl.Rows[0]["Logourl"].ToString(); hijc.Hotelcode = hcode; HotelImages.Add(hijc); } else { string filePathContext = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_" + curcode + "_ImageContextChange-RS.xml"); if (File.Exists(filePathContext)) { ContextResult = File.ReadAllText(filePathContext); } else { ContextResult = XMLRead.ContextChange(searchid + "Image"); try { File.WriteAllText(filePathContext, ContextResult); } catch { } } HotelImageAj hotelimage = new HotelImageAj(HotelCode, "", searchid, ContextResult); string image = hotelimage.Image; string logo = hotelimage.logo; if (image != "N") { HotelDBLayer.SaveHotelImageUrl(hcode, image, logo); } hijc.Hotelcode = hcode; if (image != "N") { hijc.Image = image; } else { hijc.Image = "../images/No Image found.png"; } if (logo != "N") { hijc.Logo = logo; } else { hijc.Logo = "../images/No Image found.png"; } HotelImages.Add(hijc); } } //closing the session if (ContextResult.ToString() != "") { DataSet ds = new DataSet(); DataSet dsSession = new DataSet(); StringReader se_stream = new StringReader(ContextResult); dsSession.ReadXml(se_stream); string Rq = ""; if (dsSession.Tables["BinarySecurityToken"] != null) { DataTable dtBinarySecurityToken = dsSession.Tables["BinarySecurityToken"]; DataTable dtMessageData = dsSession.Tables["MessageData"]; DataTable dtMessageHeader = dsSession.Tables["MessageHeader"]; string timestamp = DateTime.UtcNow.ToString(); string cresult = XMLRead.closession(dtMessageData.Rows[0]["MessageId"].ToString(), timestamp, dtBinarySecurityToken.Rows[0]["BinarySecurityToken_Text"].ToString(), searchid + "Image", XMLRead.pcc, XMLRead.ipcc); } } } } catch { } return(HotelImages); }