public ActionResult terms_of_purchase() { // Get the current domain and the static page Domain currentDomain = Tools.GetCurrentDomain(); StaticPage staticPage = StaticPage.GetOneByConnectionId(2, currentDomain.front_end_language); staticPage = staticPage != null ? staticPage : new StaticPage(); // Get the translated texts KeyStringList tt = StaticText.GetAll(currentDomain.front_end_language, "id", "ASC"); // Create the bread crumb list List<BreadCrumb> breadCrumbs = new List<BreadCrumb>(2); breadCrumbs.Add(new BreadCrumb(tt.Get("start_page"), "/")); breadCrumbs.Add(new BreadCrumb(staticPage.link_name, "/home/terms_of_purchase")); // Set form values ViewBag.BreadCrumbs = breadCrumbs; ViewBag.CurrentCategory = new Category(); ViewBag.TranslatedTexts = tt; ViewBag.CurrentDomain = currentDomain; ViewBag.CurrentLanguage = Language.GetOneById(currentDomain.front_end_language); ViewBag.StaticPage = staticPage; ViewBag.PricesIncludesVat = Session["PricesIncludesVat"] != null ? Convert.ToBoolean(Session["PricesIncludesVat"]) : currentDomain.prices_includes_vat; ViewBag.CultureInfo = Tools.GetCultureInfo(ViewBag.CurrentLanguage); // Return the view return currentDomain.custom_theme_id == 0 ? View() : View("/Views/theme/terms_of_purchase.cshtml"); } // End of the terms_of_purchase method
} // End of the UnprotectCookieValue method /// <summary> /// Get a 404 not found page /// </summary> /// <returns>A string with html</returns> public static string GetHttpNotFoundPage() { // Create the string to return string htmlString = ""; // Get the current domain Domain currentDomain = Tools.GetCurrentDomain(); // Get the error page StaticPage staticPage = StaticPage.GetOneByConnectionId(5, currentDomain.front_end_language); staticPage = staticPage != null ? staticPage : new StaticPage(); // Get the translated texts KeyStringList tt = StaticText.GetAll(currentDomain.front_end_language, "id", "ASC"); // Create the Route data System.Web.Routing.RouteData routeData = new System.Web.Routing.RouteData(); routeData.Values.Add("controller", "home"); // Create the controller context System.Web.Mvc.ControllerContext context = new System.Web.Mvc.ControllerContext(new System.Web.Routing.RequestContext(new HttpContextWrapper(HttpContext.Current), routeData), new Annytab.Webshop.Controllers.homeController()); // Create the bread crumb list List<BreadCrumb> breadCrumbs = new List<BreadCrumb>(2); breadCrumbs.Add(new BreadCrumb(tt.Get("start_page"), "/")); breadCrumbs.Add(new BreadCrumb(staticPage.link_name, "/home/error/404")); // Set form values context.Controller.ViewBag.BreadCrumbs = breadCrumbs; context.Controller.ViewBag.CurrentCategory = new Category(); context.Controller.ViewBag.TranslatedTexts = tt; context.Controller.ViewBag.CurrentDomain = currentDomain; context.Controller.ViewBag.CurrentLanguage = Language.GetOneById(currentDomain.front_end_language); context.Controller.ViewBag.StaticPage = staticPage; context.Controller.ViewBag.PricesIncludesVat = HttpContext.Current.Session["PricesIncludesVat"] != null ? Convert.ToBoolean(HttpContext.Current.Session["PricesIncludesVat"]) : currentDomain.prices_includes_vat; // Render the view using (StringWriter stringWriter = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture)) { string viewPath = currentDomain.custom_theme_id == 0 ? "/Views/home/error.cshtml" : "/Views/theme/error.cshtml"; System.Web.Mvc.RazorView razor = new System.Web.Mvc.RazorView(context, viewPath, null, false, null); razor.Render(new System.Web.Mvc.ViewContext(context, razor, context.Controller.ViewData, context.Controller.TempData, stringWriter), stringWriter); htmlString += stringWriter.ToString(); } //// Create the web page //notFoundString += "<html><head>"; //notFoundString += "<meta charset=\"utf-8\">"; //notFoundString += "<title>" + staticPage.title + "</title></head>"; //notFoundString += "<body><div style=\"text-align:center;margin:200px auto auto auto;\"><h1>" + staticPage.title + "</h1>"; //notFoundString += "<p>" + staticPage.main_content + "</p>"; //notFoundString += "<a href=\"/\">" + tt.Get("start_page") + "</a></div></body>"; //notFoundString += "</html>"; // Return the string return htmlString; } // End of the GetHttpNotFoundPage method
} // End of the UnprotectCookieValue method /// <summary> /// Get a 404 not found page /// </summary> /// <returns>A string with html</returns> public static string GetHttpNotFoundPage() { // Create the string to return string htmlString = ""; // Get the current domain Domain currentDomain = Tools.GetCurrentDomain(); // Get the error page StaticPage staticPage = StaticPage.GetOneByConnectionId(4, currentDomain.front_end_language); staticPage = staticPage != null ? staticPage : new StaticPage(); // Get the translated texts KeyStringList tt = StaticText.GetAll(currentDomain.front_end_language, "id", "ASC"); // Create the Route data System.Web.Routing.RouteData routeData = new System.Web.Routing.RouteData(); routeData.Values.Add("controller", "home"); // Create the controller context System.Web.Mvc.ControllerContext context = new System.Web.Mvc.ControllerContext(new System.Web.Routing.RequestContext(new HttpContextWrapper(HttpContext.Current), routeData), new Annytab.Blogsite.Controllers.homeController()); // Create the bread crumb list List<BreadCrumb> breadCrumbs = new List<BreadCrumb>(2); breadCrumbs.Add(new BreadCrumb(tt.Get("start_page"), "/")); breadCrumbs.Add(new BreadCrumb(staticPage.link_name, "/home/error/404")); // Set form values context.Controller.ViewBag.BreadCrumbs = breadCrumbs; context.Controller.ViewBag.CurrentCategory = new Category(); context.Controller.ViewBag.TranslatedTexts = tt; context.Controller.ViewBag.CurrentDomain = currentDomain; context.Controller.ViewBag.CurrentLanguage = Language.GetOneById(currentDomain.front_end_language); context.Controller.ViewBag.StaticPage = staticPage; // Render the view using (StringWriter stringWriter = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture)) { string viewPath = currentDomain.custom_theme_id == 0 ? "/Views/home/error.cshtml" : "/Views/theme/error.cshtml"; System.Web.Mvc.RazorView razor = new System.Web.Mvc.RazorView(context, viewPath, null, false, null); razor.Render(new System.Web.Mvc.ViewContext(context, razor, context.Controller.ViewData, context.Controller.TempData, stringWriter), stringWriter); htmlString += stringWriter.ToString(); } // Return the string return htmlString; } // End of the GetHttpNotFoundPage method
public ActionResult error(string id = "") { // Get the current domain Domain currentDomain = Tools.GetCurrentDomain(); // Set the connection id byte connectionId = 3; if (id == "invalid-input") { connectionId = 4; } else if (id == "404") { connectionId = 5; } else { id = "general"; } // Get the error page StaticPage staticPage = StaticPage.GetOneByConnectionId(connectionId, currentDomain.front_end_language); staticPage = staticPage != null ? staticPage : new StaticPage(); // Get the translated texts KeyStringList tt = StaticText.GetAll(currentDomain.front_end_language, "id", "ASC"); // Create the bread crumb list List<BreadCrumb> breadCrumbs = new List<BreadCrumb>(2); breadCrumbs.Add(new BreadCrumb(tt.Get("start_page"), "/")); breadCrumbs.Add(new BreadCrumb(staticPage.link_name, "/home/error/" + id.ToString())); // Set form values ViewBag.BreadCrumbs = breadCrumbs; ViewBag.CurrentCategory = new Category(); ViewBag.TranslatedTexts = tt; ViewBag.CurrentDomain = currentDomain; ViewBag.CurrentLanguage = Language.GetOneById(currentDomain.front_end_language); ViewBag.StaticPage = staticPage; ViewBag.PricesIncludesVat = Session["PricesIncludesVat"] != null ? Convert.ToBoolean(Session["PricesIncludesVat"]) : currentDomain.prices_includes_vat; ViewBag.CultureInfo = Tools.GetCultureInfo(ViewBag.CurrentLanguage); // Return the view return currentDomain.custom_theme_id == 0 ? View() : View("/Views/theme/error.cshtml"); } // End of the error method
public ActionResult index() { // Get the current domain and the home page Domain currentDomain = Tools.GetCurrentDomain(); StaticPage staticPage = StaticPage.GetOneByConnectionId(1, currentDomain.front_end_language); staticPage = staticPage != null ? staticPage : new StaticPage(); // Set form values ViewBag.CurrentCategory = new Category(); ViewBag.BreadCrumbs = new List<BreadCrumb>(0); ViewBag.TranslatedTexts = StaticText.GetAll(currentDomain.front_end_language, "id", "ASC"); ViewBag.CurrentDomain = currentDomain; ViewBag.CurrentLanguage = Language.GetOneById(currentDomain.front_end_language); ViewBag.StaticPage = staticPage; ViewBag.UserSettings = (Dictionary<string, string>)Session["UserSettings"]; ViewBag.CultureInfo = Tools.GetCultureInfo(ViewBag.CurrentLanguage); // Return the view return currentDomain.custom_theme_id == 0 ? View() : View("/Views/theme/home.cshtml"); } // End of the index method