protected void Page_Load(object sender, EventArgs e) { string culture = "nl-NL"; if (Session["culture"] != null) culture = Session["culture"] as string; IncludePage(ShowProductInc, Resources.Resource.incShowProduct); IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2); using (Database db = new MySqlDatabase()) { UserInfo ui = db.GetUser(Util.UserId); ClientInfo ci = db.GetClientInfo(Util.UserId); DataSet ds = db.GetRegister(Util.UserId); int protectedTracks = ds.Tables[0].Rows.Count; LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle; LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName()); CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId)); ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks); decimal percentComplete = 0m; if (Session["percentComplete"] != null) percentComplete = Convert.ToDecimal(Session["percentComplete"]); CompletedLiteral.Text = string.Empty; if (percentComplete < 100) CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m); ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty); } long userid = Util.UserId; if (!IsPostBack) { DescriptionLiteral.Text = string.Empty; int pid = 0; if (Request.Params["pid"] != null) { string tmp = Request.Params["pid"]; if (!string.IsNullOrEmpty(tmp)) { int iTmp; if (int.TryParse(tmp, out iTmp)) pid = iTmp; } } if (pid <= 0) { DescriptionLiteral.Text = Resources.Resource.NoProductDescription; } else { string[] _desc = new string[] { "starter", "medium", "pro", "bulk" }; DescriptionImage.ImageUrl = string.Format(Resources.Resource.imgVaultFmt, _desc[pid - 1]); using (Database db = new MySqlDatabase()) { ProductInfoList pil = db.GetProducts(); foreach (ProductInfo pi in pil) { if (pi.ProductId == pid) { BuyProductButton.Visible = true; BuyProductButton.CommandName = pid.ToString(); /* if (User.Identity.IsAuthenticated) BuyProductButton.Visible = true; */ StringBuilder pricingInfo = new StringBuilder(); string iso2Country = "NL"; string isoCurrency = "EUR"; if (userid > -1) { ClientInfo ci = db.GetClientInfo(userid); if (ci != null) { iso2Country = Util.GetCountryIso2(ci.Country); isoCurrency = Util.GetCurrencyIsoNameByCountryIso2(iso2Country); } } ProductPriceInfoList ppil = db.GetProductPrices(pi.ProductId, culture); if (ppil.Count > 0) { pricingInfo.Append("<table cellpadding='4'>"); foreach (ProductPriceInfo ppi in ppil) { if (ppi.Price == 0m) { pricingInfo.AppendFormat( "<tr><td><span class='priceInfo'>{0}</span></td></tr>", Resources.Resource.RequestQuotation); } else { string curr = Util.GetCurrencySymbolByCountryIso2("NL"); string currFmt = Util.GetCurrencyFormatByCountryIso2("NL"); pricingInfo.AppendFormat("<tr><td><span class='priceInfo'>{0}</span></td><td><span class='priceInfo'>", Resources.Resource.Price); pricingInfo.AppendFormat(currFmt, curr, ppi.Price); pricingInfo.Append("</span></td></tr>"); } } pricingInfo.Append("</table>"); } TitleLiteral.Text = db.GetProductTitle(pi.ProductId, culture); string desc = db.GetProductDescription(pi.ProductId, culture); if (string.IsNullOrEmpty(desc)) desc = pi.Description; if (string.IsNullOrEmpty(desc)) DescriptionLiteral.Text = "<p><h1>" + pi.Name + "</h1></p>" + pricingInfo.ToString(); else DescriptionLiteral.Text = desc + pricingInfo.ToString(); } } } } } else { } }
protected void Page_Load(object sender, EventArgs e) { IncludePage(SelectProductInc, Resources.Resource.incSelectProduct); IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2); long userId = Util.UserId; divSignUp.Visible = (Session["userid"] == null); if (!IsPostBack) { using (Database db = new MySqlDatabase()) { ClientInfo ci = null; if (userId > -1) ci = db.GetClientInfo(userId); string currency = "EUR"; string countryIso2 = "NL"; string currencyFmt = "{0} {1:N2}"; if (ci != null) { countryIso2 = Util.GetCountryIso2(ci.Country); currency = Util.GetCurrencyIsoNameByCountryIso2("NL"); currencyFmt = Util.GetCurrencyFormatByCountryIso2("NL"); } string culture = "en-US"; if (Session["culture"] != null) culture = Session["culture"] as string; if (culture.Length == 2) { switch (culture) { case "nl": culture += "-NL"; break; case "en": culture += "US"; break; case "NL": culture = "nl-" + culture; break; case "US": culture = "en" + culture; break; } } ProductInfoList pil = db.GetProducts(); int i = 0; foreach (ProductInfo prod in pil) { ProductPriceInfoList ppil = db.GetProductPrices(prod.ProductId, culture); TableRow row = new TableRow(); row.VerticalAlign = VerticalAlign.Top; TableCell cell = new TableCell(); if (i < 4) { Image img = new Image(); img.ImageUrl = string.Format(Resources.Resource.imgVaultFmt, _desc[i]); cell.Controls.Add(img); ++i; } else { cell.Text = " "; } row.Cells.Add(cell); string desc = db.GetProductTitle(prod.ProductId, culture); cell = new TableCell(); Literal lit = new Literal(); lit.Text = "<div style=\"margin-left:8px;margin-right:8px;\">" + desc + "</div>"; cell.Controls.Add(lit); row.Cells.Add(cell); cell = new TableCell(); cell.Width = Unit.Pixel(50); cell.Font.Bold = true; cell.HorizontalAlign = HorizontalAlign.Center; if (ppil[0].Price > 0m) { cell.Text = string.Format( currencyFmt, Util.GetCurrencySymbolByCountryIso2("NL"), ppil[0].Price); } else { cell.Text = Resources.Resource.Quotation; } row.Cells.Add(cell); cell = new TableCell(); HyperLink hl = new HyperLink(); hl.CssClass = "linkBuy"; if (string.IsNullOrEmpty(countryIso2)) countryIso2 = "NL"; if (ppil[0].Price > 0m) { // Normal products, just process them hl.NavigateUrl = string.Format(Session["userid"] != null ? "~/Member/BuyProduct.aspx?pid={0}&country={1}&price={2}" : "~/Account/Login.aspx?pid={0}&country={1}&price={2}", prod.ProductId, countryIso2, ppil[0].Price); hl.ImageUrl = Resources.Resource.imgBuyCredits; } else { // Special products, check the description field to // find out more about the product switch (prod.Extra.ToLower()) { case "subscription": hl.NavigateUrl = string.Format(Session["userid"] != null ? "~/Member/Subscription.aspx?pid={0}&country={1}&price={2}" : "~/Account/Login.aspx?pid={0}&country={1}&price={2}&sub=1" ); break; default: hl.NavigateUrl = string.Format(Session["userid"] != null ? "~/Member/Quotation.aspx?pid={0}&country={1}&price={2}" : "~/Account/Login.aspx?pid={0}&country={1}&price={2}&sub=0", prod.ProductId, countryIso2, 0); hl.ImageUrl = Resources.Resource.imgQuotation; break; } } cell.Controls.Add(hl); row.Cells.Add (cell); ProductTable.Rows.Add (row); } } } else { } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["culture"] == null) { string culture = Request.UserLanguages[0]; Session["culture"] = culture; Culture = culture; UICulture = culture; Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture); Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture); } } if (!User.Identity.IsAuthenticated) { ClearUserSession(); } else { if (Session["userid"] != null && Session["useruid"] != null && Session["access"] != null && Session["subscriptiontype"] != null) { Response.Redirect("~/Member/MemberHome.aspx", false); } } IncludePage(DefaultInc, Resources.Resource.incDefault); IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement); if (!IsPostBack) { Config cfg = new Config(); cfg.Load(Server.MapPath("~/Config/trackprotect.config")); using (Database db = new MySqlDatabase()) { RegisterStarterButton.CommandName = "-1"; RegisterMediumButton.CommandName = "-1"; RegisterProButton.CommandName = "-1"; RegisterEnterpriseButton.CommandName = "-1"; ProductInfoList pil = db.GetProducts(); foreach (ProductInfo pi in pil) { switch (pi.ProductId) { case 1: RegisterStarterButton.CommandName = pi.ProductId.ToString(); break; case 2: RegisterMediumButton.CommandName = pi.ProductId.ToString(); break; case 3: RegisterProButton.CommandName = pi.ProductId.ToString(); break; case 4: RegisterEnterpriseButton.CommandName = pi.ProductId.ToString(); break; } } } } else { } }