/// <summary> /// InvoiceView /// </summary> /// <returns></returns> public ActionResult InvoiceView() { ViewBag.TabDisplay = 1; ViewBag.theGoClick = 2; Session["theGoClick"] = 2; try { m_User = GetUser("Diablo").User; m_PSW = GetUser("Diablo").PSW; XmlDocument doc = new XmlDocument(); string Path = Server.MapPath(""); if (!Path.EndsWith("\\")) { Path += "\\"; } doc.Load(Path + "Nlog.config"); LogManager.Configuration = new XmlLoggingConfiguration(doc.DocumentElement, null); logger = LogManager.GetLogger("Travelbytes.TravelPlans"); } catch (Exception e) { System.Diagnostics.Trace.WriteLine("Logger initialisation failed\r\n" + e.Message); } // Put user code to initialize the page here LoadSessionVars(); GetQueryVars(); Event1 = new AutoResetEvent(false); Event2 = new AutoResetEvent(false); Event3 = new AutoResetEvent(false); Event4 = new AutoResetEvent(false); ViewBag.Adobe = false; //Adobe.Visible = false; if (m_DirectLink) { DisplayFile(); } if (Request.QueryString["F"] != null) { m_FileName = Convert.ToString(Request.QueryString["F"]); } if (m_RLOC.Length == 6 && m_FileName.Length > 0 && m_Location.Length > 0 && (m_Type == "V" || m_Type == "I") ) { // build location string string Store = ""; string Extention = ""; if (m_Type == "V") { Store = GetInvoiceStore(); Extention = ".pdf"; } else if (m_Type == "I") { Store = GetItineraryStore(); Extention = ".doc"; } if (m_Location == "NA") { m_Location = ""; } string Location = Store; if (!Location.EndsWith("\\")) { Location += "\\"; } if (m_Location.StartsWith(@"\\")) { Location = m_Location; } else { Location += m_Location; } if (!Location.EndsWith("\\")) { Location += "\\"; } Location += m_RLOC[0] + "\\" + m_RLOC[1] + "\\" + m_RLOC[2] + "\\" + m_RLOC[3] + "\\" + m_RLOC[4] + "\\" + m_FileName; bool result = DisplayFilePDF(m_RLOC, Location, 0, Extention); if (result == false) { return(RedirectToAction("Message", "MessageDisplay", new { E = 28 })); } if (m_URL.Length > 0) { Tranx Tran = new Tranx(); Tran.InvoiceRetrieve(m_RLOC, m_Surname, m_FileName); String output = m_URL; Response.AppendHeader("Content-Disposition", "inline; filename=" + m_URL); return(File(output, "application/pdf")); //Response.Redirect(m_URL, true); } return(View()); //Need to work } if (m_InvoiceNumber.Length > 0) { int rValue = PullInvoice(); if (rValue == 0) { return(RedirectToAction("Message", "MessageDisplay", new { E = 13 })); } else if (rValue == 1) { return(RedirectToAction("InvoiceView", "Invoice", new { T = "V", R = gRLOC, M = gLocation, F = gInfoName })); } else if (rValue == 25) { return(RedirectToAction("Message", "MessageDisplay", new { E = 25 })); } else if (rValue == 26) { return(RedirectToAction("Message", "MessageDisplay", new { E = 26 })); } else if (rValue == 27) { return(RedirectToAction("Message", "MessageDisplay", new { E = 27 })); } } if ((m_RLOC == null || m_RLOC.Length == 0) || (m_Surname == null || m_Surname.Length == 0)) { logger.Debug("Enter : debug point 5"); return(RedirectToAction("Message", "MessageDisplay", new { E = 1 })); //return RedirectToAction("Index", "User", new { E = 1 }); //Response.Redirect("Default.aspx?E=1"); } bool bReturnValue = DoGo(); if (bReturnValue == false) { return(RedirectToAction("Message", "MessageDisplay", new { E = 33 })); } logger.Debug("m_RLOC : " + m_RLOC); return(View()); }
/// <summary> /// InvoiceView /// </summary> /// <returns></returns> public ActionResult InvoiceView() { ViewBag.TabDisplay = 1; ViewBag.theGoClick = 2; Session["theGoClick"] = 2; try { m_User = GetUser("Diablo").User; m_PSW = GetUser("Diablo").PSW; XmlDocument doc = new XmlDocument(); string Path = Server.MapPath(""); if (!Path.EndsWith("\\")) Path += "\\"; doc.Load(Path + "Nlog.config"); LogManager.Configuration = new XmlLoggingConfiguration(doc.DocumentElement, null); logger = LogManager.GetLogger("Travelbytes.TravelPlans"); } catch (Exception e) { System.Diagnostics.Trace.WriteLine("Logger initialisation failed\r\n" + e.Message); } // Put user code to initialize the page here LoadSessionVars(); GetQueryVars(); Event1 = new AutoResetEvent(false); Event2 = new AutoResetEvent(false); Event3 = new AutoResetEvent(false); Event4 = new AutoResetEvent(false); ViewBag.Adobe = false; //Adobe.Visible = false; if (m_DirectLink) DisplayFile(); if (Request.QueryString["F"] != null) { m_FileName = Convert.ToString(Request.QueryString["F"]); } if (m_RLOC.Length == 6 && m_FileName.Length > 0 && m_Location.Length > 0 && (m_Type == "V" || m_Type == "I") ) { // build location string string Store = ""; string Extention = ""; if (m_Type == "V") { Store = GetInvoiceStore(); Extention = ".pdf"; } else if (m_Type == "I") { Store = GetItineraryStore(); Extention = ".doc"; } if (m_Location == "NA") m_Location = ""; string Location = Store; if (!Location.EndsWith("\\")) Location += "\\"; if (m_Location.StartsWith(@"\\")) Location = m_Location; else Location += m_Location; if (!Location.EndsWith("\\")) Location += "\\"; Location += m_RLOC[0] + "\\" + m_RLOC[1] + "\\" + m_RLOC[2] + "\\" + m_RLOC[3] + "\\" + m_RLOC[4] + "\\" + m_FileName; bool result = DisplayFilePDF(m_RLOC, Location, 0, Extention); if (result == false) { return RedirectToAction("Message", "MessageDisplay", new { E = 28 }); } if (m_URL.Length > 0) { Tranx Tran = new Tranx(); Tran.InvoiceRetrieve(m_RLOC, m_Surname, m_FileName); String output = m_URL; Response.AppendHeader("Content-Disposition", "inline; filename=" + m_URL); return File(output, "application/pdf"); //Response.Redirect(m_URL, true); } return View(); //Need to work } if (m_InvoiceNumber.Length > 0) { int rValue = PullInvoice(); if (rValue == 0) { return RedirectToAction("Message", "MessageDisplay", new { E = 13 }); } else if (rValue == 1) { return RedirectToAction("InvoiceView", "Invoice", new { T = "V", R = gRLOC, M = gLocation, F = gInfoName }); } else if (rValue == 25) { return RedirectToAction("Message", "MessageDisplay", new { E = 25 }); } else if (rValue == 26) { return RedirectToAction("Message", "MessageDisplay", new { E = 26 }); } else if (rValue == 27) { return RedirectToAction("Message", "MessageDisplay", new { E = 27 }); } } if ((m_RLOC == null || m_RLOC.Length == 0) || (m_Surname == null || m_Surname.Length == 0)) { logger.Debug("Enter : debug point 5"); return RedirectToAction("Message", "MessageDisplay", new { E = 1 }); //return RedirectToAction("Index", "User", new { E = 1 }); //Response.Redirect("Default.aspx?E=1"); } bool bReturnValue = DoGo(); if (bReturnValue == false) { return RedirectToAction("Message", "MessageDisplay", new { E = 33 }); } logger.Debug("m_RLOC : " + m_RLOC); return View(); }