コード例 #1
0
        /// <summary>
        /// GetCalendarList
        /// </summary>
        /// <returns></returns>
        public DataTable GetCalendarList()
        {
            DataTable dtCalendarDetail = CreateCalendarDetailDataTable();

            string utid_id = "";
            string strXmlString = "";
            ItineraryDataBAL objItineraryDataBAL = new ItineraryDataBAL();
            logger.Debug("Fetch data from databse");
            List<XmlBookingModel> lstQiLiveItineraryData = objItineraryDataBAL.SearchItineraryDataBySurnameAndRLOC(m_Surname, m_RLOC);
            if (lstQiLiveItineraryData != null && lstQiLiveItineraryData.Count > 0)
            {
                logger.Debug("fetched rows from database");
                foreach (XmlBookingModel xmlBooking in lstQiLiveItineraryData)
                {
                    //id,utid_id,phase,entry_date,stamp,xml
                    utid_id = Convert.ToString(xmlBooking.utid_id);
                    strXmlString = Convert.ToString(xmlBooking.xml);
                    dtCalendarDetail = GetCalendarData(strXmlString, m_RLOC);
                }
            }
            else
            {
                return dtCalendarDetail;
                //return RedirectToAction("Error", "ErrorDisplay", new { E = 52 });
            }
            if (dtCalendarDetail != null)
            {
                dtCalendarDetail.Columns.Add(new DataColumn("url", typeof(string)));
                foreach (DataRow _Row in dtCalendarDetail.Rows)
                {
                    _Row["url"] = GetDownloadLink(_Row);
                }
            }
            else
            {
                return dtCalendarDetail;//return to error page
            }
            return dtCalendarDetail;
        }
コード例 #2
0
        /// <summary>
        /// ItineraryView
        /// </summary>
        /// <returns></returns>
        public ActionResult ItineraryView()
        {
            ViewBag.TabDisplay = 1;
            ViewBag.theGoClick = 1;
            Session["theGoClick"] = 1;
            string TemplatesPath = Server.MapPath(@"\Content\Templates\").Replace("\\", "/");
            string CSSPath = Server.MapPath(@"\Content\static\css\").Replace("\\", "/");
            string TempPath = Server.MapPath(@"\Temp\").Replace("\\", "/");

            string strCompany = "";
            if (Request.QueryString["R"] != null)
            {
                Session["RLOC"] = Request.QueryString["R"];
            }
            if (Request.QueryString["S"] != null)
            {
                Session["Surname"] = Request.QueryString["S"];
            }
            if (Request.QueryString["G"] != null)
            {
                Session["GDS"] = Request.QueryString["G"];
            }

            //Decoder-----------------------

            int Retry = 0;
            if (Session["RetryCount"] != null)
            {
                Retry = ((int)Session["RetryCount"]);

                if (Retry >= GetRetryCount())
                {
                    Session["RetryCount"] = GetRetryCount();
                    return RedirectToAction("Message", "MessageDisplay", new { E = 5 });
                    //Response.Redirect("error.aspx?E=5");
                    //Response.End();
                }
            }
            //Decoder--------------------------

            bPrint = false;
            if (Request.QueryString["L"] != null)
            {
                bPrint = true;
            }
            ViewBag.bPrint = bPrint;

            //Decoder-----------------------------------------------------------------------------------------------------
            string str = "";
            Travelbytes.WebService.Itinerary.Decoder Decoder = null;

            if (Request.QueryString["L"] != null)
            {
                if (Request.QueryString["L"] == "R" && Session["Decoder"] != null)
                {
                    Decoder = (Travelbytes.WebService.Itinerary.Decoder)Session["Decoder"];
                    Decoder.Reload = true;
                    Decoder.TempLocation = TempPath;//Server.MapPath("Temp");
                    Decoder.Config = Server.MapPath("");
                    Decoder.PassedCountry = m_GDS;
                    Decoder.Offset = GetOffSet();
                    Decoder.Style = CSSPath; //Server.MapPath("styles/");

                    str = Decoder.GetItinerary(m_RLOC);
                    ViewBag.pax = Decoder.Pax;
                    //Pax.InnerHtml = Decoder.Pax;
                    //RLOC.InnerText = Decoder.RLOC;
                    //Agent.InnerText = Decoder.Agent.Replace("(", "");
                    //ClientAddress.InnerHtml = Decoder.ClientAddress;
                    //AgencyAddress.InnerHtml = Decoder.AgencyAddress;
                    ViewBag.RLOC = Decoder.RLOC;
                    ViewBag.Agent = Decoder.Agent.Replace("(", "");
                    ViewBag.Agent = ViewBag.Agent.Replace(")", "");
                    ViewBag.ClientAddress = Decoder.ClientAddress;
                    ViewBag.AgencyAddress = Decoder.AgencyAddress;

                    //---------------------------------------------------------------------------------------------------------------------------------------//

                    if (Decoder.m_bkg != null)
                    {
                        foreach (Travelbytes.Common.REMARKITEM itm in Decoder.m_bkg.Remarks)
                        {
                            if (itm.m_REMARKITEM.Trim().ToLower().IndexOf("company") > 0)
                            {
                                string Remarks2 = itm.m_REMARKITEM.Trim();
                                string[] GetCompany = Remarks2.Split(':');
                                if (GetCompany.Length > 0)
                                {
                                    if (GetCompany[0].Trim().ToLower().IndexOf("company") > 0)
                                    {
                                        if (GetCompany[0].Trim().ToLower() == "qi 8 company" || GetCompany[0].Trim().ToLower() == "qi 9 company")
                                        {
                                            strCompany = GetCompany[1].Trim();
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    string strUpdatedHTMLString = "";
                    if (strCompany == CreditSuissesgCompany)
                    {
                        strUpdatedHTMLString = GetUpdatedHTMLString(Decoder.m_Response, str);
                        strUpdatedHTMLString = GetComplianceDataAttached(strUpdatedHTMLString);
                        strUpdatedHTMLString = ReplaceLinks(strUpdatedHTMLString);
                    }
                    else
                    {
                        strUpdatedHTMLString = str;
                        strUpdatedHTMLString = ReplaceLinks(strUpdatedHTMLString);
                    }

                    if (!string.IsNullOrEmpty(strUpdatedHTMLString))
                    {
                        //results.InnerHtml = strUpdatedHTMLString;
                        ViewBag.results = strUpdatedHTMLString;
                    }
                    else
                    {
                        //results.InnerHtml = str;
                        ViewBag.results = strUpdatedHTMLString;
                    }
                    //---------------------------------------------------------------------------------------------------------------------------------------//

                    return View();
                }
                if (Request.QueryString["L"] == "P" && Session["Decoder"] != null)
                {
                    try
                    {
                        bPrint = true;
                        ViewBag.bPrint = bPrint;
                        // requested print Itin
                        if (Session["Decoder"] == null)
                        {
                            //results.InnerHtml = "Failed to retrieve booking. No previous Itinerary retrieved";
                            ViewBag.results = "Failed to retrieve booking. No previous Itinerary retrieved";
                            return View();
                        }

                        Decoder = (Travelbytes.WebService.Itinerary.Decoder)Session["Decoder"];
                        Decoder.Reload = true;
                        Decoder.Print = bPrint;
                        Decoder.Config = Server.MapPath("");
                        Decoder.PassedCountry = m_GDS;
                        Decoder.TempLocation = TempPath; //Server.MapPath("Temp");
                        Decoder.Offset = GetOffSet();
                        Decoder.Style = CSSPath;//Server.MapPath("styles/");

                        str = Decoder.GetItinerary(m_RLOC);
                        ViewBag.pax = Decoder.Pax;
                        //Pax.InnerHtml = Decoder.Pax;
                        //RLOC.InnerText = Decoder.RLOC;
                        //Agent.InnerText = Decoder.Agent.Replace("(", "");
                        //ClientAddress.InnerHtml = Decoder.ClientAddress;
                        //AgencyAddress.InnerHtml = Decoder.AgencyAddress;
                        ViewBag.RLOC = Decoder.RLOC;
                        ViewBag.Agent = Decoder.Agent.Replace("(", "");
                        ViewBag.Agent = ViewBag.Agent.Replace(")", "");
                        ViewBag.ClientAddress = Decoder.ClientAddress;
                        ViewBag.AgencyAddress = Decoder.AgencyAddress;
                        //Pax.InnerHtml = Decoder.Pax;
                        //RLOC.InnerText = Decoder.RLOC;
                        //Agent.InnerText = Decoder.Agent;
                        //ClientAddress.InnerHtml = Decoder.ClientAddress;
                        //AgencyAddress.InnerHtml = Decoder.AgencyAddress;
                        //results.InnerHtml = Decoder.Itinerary;
                        //results.InnerHtml = str;
                        //---------------------------------------------------------------------------------------------------------------------------------------//
                        if (Decoder.m_bkg != null)
                        {
                            foreach (Travelbytes.Common.REMARKITEM itm in Decoder.m_bkg.Remarks)
                            {
                                if (itm.m_REMARKITEM.Trim().ToLower().IndexOf("company") > 0)
                                {
                                    string Remarks2 = itm.m_REMARKITEM.Trim();
                                    string[] GetCompany = Remarks2.Split(':');
                                    if (GetCompany.Length > 0)
                                    {
                                        if (GetCompany[0].Trim().ToLower().IndexOf("company") > 0)
                                        {
                                            if (GetCompany[0].Trim().ToLower() == "qi 8 company" || GetCompany[0].Trim().ToLower() == "qi 9 company")
                                            {
                                                strCompany = GetCompany[1].Trim();
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        string strUpdatedHTMLSession = "";
                        if (strCompany == CreditSuissesgCompany)
                        {
                            strUpdatedHTMLSession = GetUpdatedHTMLString(Decoder.m_Response, str);
                            strUpdatedHTMLSession = GetComplianceDataAttached(strUpdatedHTMLSession);
                            strUpdatedHTMLSession = ReplaceLinks(strUpdatedHTMLSession);
                        }
                        else
                        {
                            strUpdatedHTMLSession = str;
                            strUpdatedHTMLSession = ReplaceLinks(strUpdatedHTMLSession);
                        }

                        if (!string.IsNullOrEmpty(strUpdatedHTMLSession))
                        {
                            // results.InnerHtml = strUpdatedHTMLSession;
                            ViewBag.results = strUpdatedHTMLSession;
                        }
                        else
                        {
                            //results.InnerHtml = str;
                            ViewBag.results = str;
                        }
                        //---------------------------------------------------------------------------------------------------------------------------------------//

                        //PrintLayer.Visible = true;
                    }
                    catch (Exception p)
                    {
                        //results.InnerHtml = "Failed to retrieve booking. Error is<br>" + p.ToString() +
                        //    "<br>" + p.StackTrace;
                        ViewBag.results = "Failed to retrieve booking. Error is<br>" + p.ToString() +
                           "<br>" + p.StackTrace;
                    }
                    return View();
                }

            }
            //Decoder-----------------------------------------------------------------------------------------------------

            LoadSessionVars();
            GetQueryVars();

            //--First Find from new Itinerary-------------------------

            ItineraryDataBAL objItineraryDataBAL = new ItineraryDataBAL();
            List<XmlBookingModel> lstQiLiveItineraryData = objItineraryDataBAL.SearchItineraryDataBySurnameAndRLOC(m_Surname, m_RLOC);
            if (lstQiLiveItineraryData != null && lstQiLiveItineraryData.Count > 0)
            {
                Session["QiLiveItineraryData"] = lstQiLiveItineraryData;
                return RedirectToAction("QiLiveItineraryView", "QiLiveItinerary", new { R = m_RLOC, S = m_Surname });
            }
            //else
            //{
            //    Session["QiLiveItineraryData"] = null;
            //    return RedirectToAction("QiLiveItineraryView", "QiLiveItinerary", new { R = m_RLOC, S = m_Surname });
            //}

            //--If Not Found in new Itinerary then search in old system-------------------------

            Session["QiLiveItineraryData"] = null;
            if (CheckForStorage())
            {
                if (!AllowLiveRetrieve)
                {
                    // decrypt and load redirect out
                    if (m_FileName.Length == 0)
                        return RedirectToAction("Message", "MessageDisplay", new { E = 14 }); //Response.Redirect("Error.aspx?E=14");

                    int rValue = GetTransaction(m_FileName);
                    if (rValue == 0)
                    {
                        // only get here if there was an error
                        return RedirectToAction("Message", "MessageDisplay", new { E = 14 });
                    }
                    else if (rValue == 1)
                    {
                        if (bPrint == true)
                        {
                            return RedirectToAction("Itin", "Itinerary", new { R = "ITIN", FN = m_FormName, L = "P" }); //Response.Redirect("Itin.aspx?R=ITIN&FN=" + m_FormName, true);
                        }
                        else
                        {
                            return RedirectToAction("Itin", "Itinerary", new { R = "ITIN", FN = m_FormName }); //Response.Redirect("Itin.aspx?R=ITIN&FN=" + m_FormName, true);
                        }

                    }
                    else if (rValue == 2)
                    {
                        if (bPrint == true)
                        {
                            return RedirectToAction("Itin", "Itinerary", new { R = "ITIN", L = "P" }); //Response.Redirect("Itin.aspx?R=ITIN", true);
                        }
                        else
                        {
                            return RedirectToAction("Itin", "Itinerary", new { R = "ITIN" }); //Response.Redirect("Itin.aspx?R=ITIN", true);

                        }
                    }
                    else if (rValue == 3)
                    {

                    }
                }
            }
            else
            {
                string Country = "";
                if (Session["Country"] != null)
                    Country = Session["Country"].ToString();

                string CountryList = GetLiveCountryList();

                if ((Session["Country"] == null || GetLiveCountryList().IndexOf(Country) == -1))
                {
                    // Goto error
                    return RedirectToAction("Message", "MessageDisplay", new { E = 14 });
                }
            }
            //Decoder-----------------------------------------------------------------------------------------------------------------------------

            if (m_RLOC == null || m_RLOC.Length == 0)
            {
                return RedirectToAction("Message", "MessageDisplay", new { E = 1 });
                //Response.Redirect("Error.aspx?E=1");
                //return view;
            }

            if (Session["Decoder"] != null)
            {
                Decoder = (Travelbytes.WebService.Itinerary.Decoder)Session["Decoder"];
                Decoder.Reload = true;
                Decoder.TempLocation = TempPath; //Server.MapPath("Temp");
                Decoder.Config = Server.MapPath("");
                Decoder.PassedCountry = m_GDS;
                Decoder.Offset = GetOffSet();
                Decoder.Style = CSSPath; //Server.MapPath("styles/");

                str = Decoder.GetItinerary(m_RLOC);
                str = str.Replace("Download to calendar", "");
                ViewBag.RLOC = Decoder.RLOC;
                ViewBag.Agent = Decoder.Agent.Replace("(", "");
                ViewBag.Agent = ViewBag.Agent.Replace(")", "");
                ViewBag.ClientAddress = Decoder.ClientAddress;
                ViewBag.AgencyAddress = Decoder.AgencyAddress;
                //Pax.InnerHtml = Decoder.Pax;
                //RLOC.InnerText = Decoder.RLOC;
                //Agent.InnerText = Decoder.Agent.Replace("(", "");
                //Agent.InnerText = Agent.InnerText.Replace(")", "");
                //ClientAddress.InnerHtml = Decoder.ClientAddress;
                //AgencyAddress.InnerHtml = Decoder.AgencyAddress;

                //---------------------------------------------------------------------------------------------------------------------------------------//
                if (Decoder.m_bkg != null)
                {
                    foreach (Travelbytes.Common.REMARKITEM itm in Decoder.m_bkg.Remarks)
                    {
                        if (itm.m_REMARKITEM.Trim().ToLower().IndexOf("company") > 0)
                        {
                            string Remarks2 = itm.m_REMARKITEM.Trim();
                            string[] GetCompany = Remarks2.Split(':');
                            if (GetCompany.Length > 0)
                            {
                                if (GetCompany[0].Trim().ToLower().IndexOf("company") > 0)
                                {
                                    if (GetCompany[0].Trim().ToLower() == "qi 8 company" || GetCompany[0].Trim().ToLower() == "qi 9 company")
                                    {
                                        strCompany = GetCompany[1].Trim();
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                string strUpdatedHTMLFromSession = "";
                if (strCompany == CreditSuissesgCompany)
                {
                    strUpdatedHTMLFromSession = GetUpdatedHTMLString(Decoder.m_Response, str);
                    strUpdatedHTMLFromSession = GetComplianceDataAttached(strUpdatedHTMLFromSession);
                    strUpdatedHTMLFromSession = ReplaceLinks(strUpdatedHTMLFromSession);
                }
                else
                {
                    strUpdatedHTMLFromSession = str;
                    strUpdatedHTMLFromSession = ReplaceLinks(strUpdatedHTMLFromSession);
                }

                if (!string.IsNullOrEmpty(strUpdatedHTMLFromSession))
                {
                    //results.InnerHtml = strUpdatedHTMLFromSession;
                    ViewBag.results = strUpdatedHTMLFromSession;
                }
                else
                {
                    //results.InnerHtml = str;
                    ViewBag.results = str;
                }
                //---------------------------------------------------------------------------------------------------------------------------------------//

                //results.InnerHtml = Decoder.Itinerary;
                //results.InnerHtml = str;
                return View();
            }

            logger.Debug("Live Retrievel Start - Debug Point 1");
            Decoder = new Travelbytes.WebService.Itinerary.Decoder();

            Decoder.Reload = false;
            Decoder.Print = bPrint;
            Decoder.TempLocation = TempPath; //Server.MapPath("Temp");
            Decoder.Config = Server.MapPath("");
            Decoder.Templates = TemplatesPath;
            Decoder.AddressDSN = GetAddressDataSourceMySQL();
            Decoder.PassedCountry = m_GDS;
            Decoder.Style = CSSPath; //Server.MapPath("styles/");

            Credentials Cred = GetUser("Galileo");
            Decoder.User = Cred.User;
            Decoder.PSW = Cred.PSW;
            Decoder.HAP = Cred.HAP;
            Decoder.URL = Cred.URL;
            Decoder.ItineraryURL = Cred.ItineraryURL;
            Decoder.Offset = GetOffSet();

            Tranx Tran = new Tranx();
            Tran.ItineraryRetrieve(m_RLOC, m_Surname, "");

            logger.Debug("Debug Point 2");

            //Decoder.RLOC = m_RLOC;
            str = "";
            str = Decoder.GetItinerary(m_RLOC);

            logger.Debug("Debug Point 3");

            if (str.Length == 0)
            {
                logger.Debug("Debug Point 4 : " + Decoder.LastError);
                if (Decoder.LastErrorNumber != 0)
                {
                    return RedirectToAction("Message", "MessageDisplay", new { E = 34 });
                    //Response.Redirect("Error.aspx?E=" + Decoder.LastErrorNumber);
                }
                else if (str.IndexOf("Invalid reference") != -1)
                    return RedirectToAction("Message", "MessageDisplay", new { E = 7 });
                //Response.Redirect("Error.aspx?E=7");
                else
                {
                    if (Decoder.LastError.Length == 0)
                        return RedirectToAction("Message", "MessageDisplay", new { E = 14 });
                    //Response.Redirect("Error.aspx?E=14");
                    else
                        return RedirectToAction("Message", "MessageDisplay", new { E = 35 });
                    //return RedirectToAction("Message", "MessageDisplay", new { E = 22 });
                    //Response.Redirect("Error.aspx?E=0&M=" + Server.UrlEncode(Decoder.LastError));
                }
            }

            logger.Debug("Debug Point 5");

            str = str.Replace("Download to calendar", "");
            Session["SMSSummary"] = Decoder.SMSSummary;
            if ((base.HasEticket = Decoder.HasTickets) == true)
            {
                Session["Etickets"] = Decoder.TicketNumbers;
            }

            // check the surname matches the one provided
            if (m_Surname.Length == 0 || Decoder.Surname.ToUpper().IndexOf(m_Surname.ToUpper()) == -1)
            {

                if (Session["RetryCount"] == null)
                    Retry = 0;
                else
                    Retry = ((int)Session["RetryCount"]) + 1;

                if (Retry >= GetRetryCount())
                {
                    Session["RetryCount"] = GetRetryCount();
                    m_RLOC = "";
                    return RedirectToAction("Message", "MessageDisplay", new { E = 5 });
                    //Response.Redirect("error.aspx?E=5");
                    //Response.End();
                }
                Session["RetryCount"] = Retry;
                // failed to match
                return RedirectToAction("Message", "MessageDisplay", new { E = 2 });
                //Response.Redirect("Error.aspx?E=2");
                //Response.End();
            }

            Session["RetryCount"] = 0;
            GetReference = m_RLOC;
            GetName = Decoder.Pax;

            Session["RLOC"] = m_RLOC;
            Session["Name"] = Decoder.PaxName;

            ViewBag.RLOC = Decoder.RLOC;
            ViewBag.Agent = Decoder.Agent;
            ViewBag.ClientAddress = Decoder.ClientAddress;
            ViewBag.AgencyAddress = Decoder.AgencyAddress;
            //ClientAddress.InnerHtml = Decoder.ClientAddress;
            //AgencyAddress.InnerHtml = Decoder.AgencyAddress;
            //Pax.InnerHtml = Decoder.Pax;
            //RLOC.InnerText = Decoder.RLOC;
            //Agent.InnerText = Decoder.Agent;

            //---------------------------------------------------------------------------------------------------------------------------------------//

            if (Decoder.m_bkg != null)
            {
                foreach (Travelbytes.Common.REMARKITEM itm in Decoder.m_bkg.Remarks)
                {
                    if (itm.m_REMARKITEM.ToLower().IndexOf("company") > 0)
                    {
                        string Remarks2 = itm.m_REMARKITEM;
                        string[] GetCompany = Remarks2.Split(':');
                        if (GetCompany.Length > 0)
                        {
                            if (GetCompany[0].ToLower().IndexOf("company") > 0)
                            {
                                if (GetCompany[0].Trim().ToLower() == "qi 8 company" || GetCompany[0].Trim().ToLower() == "qi 9 company")
                                {
                                    strCompany = GetCompany[1].Trim();
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            string strUpdatedHTML = "";
            if (strCompany == CreditSuissesgCompany)
            {
                strUpdatedHTML = GetUpdatedHTMLString(Decoder.m_Response, str);
                strUpdatedHTML = GetComplianceDataAttached(strUpdatedHTML);
                strUpdatedHTML = ReplaceLinks(strUpdatedHTML);
            }
            else
            {
                strUpdatedHTML = str;
                strUpdatedHTML = ReplaceLinks(strUpdatedHTML);
            }
            //---------------------------------------------------------------------------------------------------------------------------------------//

            if (!string.IsNullOrEmpty(strUpdatedHTML))
            {
                //results.InnerHtml = strUpdatedHTML;
                ViewBag.results = strUpdatedHTML;
            }
            else
            {
                //results.InnerHtml = str;
                ViewBag.results = str;
            }

            //results.InnerHtml = str;
            Session["Decoder"] = Decoder;

            //Decoder-----------------------------------------------------------------------------------------------------------------------------

            return View();
        }