protected void CouponCodeGoCommand(object sender, CommandEventArgs e) { string couponCode = CouponCodeEdit.Text; using (Database db = new MySqlDatabase()) { ClientInfo ci = db.GetClientInfo(Util.UserId); if (db.CheckActivationCode(couponCode)) { // Code is ok, raise the number of credits for this user db.MarkActivationCode(couponCode, Util.UserId); Config cfg = new Config(); cfg.Load(Server.MapPath("~/Config/trackprotect.config")); long prodid = 0; if (cfg["activationcode.productid"] != null) prodid = Convert.ToInt64(cfg["activationcode.productid"]); // Get the credits from the database ProductInfo pi = db.GetProductById(prodid); if (pi != null && pi.ProductId > 0) { // How many credits to issue string transactionIdCoupon = string.Format("COUPON {0}", couponCode); long orderId = db.CreateTransaction(Util.UserId, 0m, prodid, pi.Description); db.UpdateTransaction(orderId.ToString(), "OK", "OK", "Payment Completed", "COUPON", couponCode, couponCode, transactionIdCoupon, "COUPON", 0m, pi, "EUR", Util.GetCountryIso2(ci.Country)); db.UpdateUserCredits(Util.UserId, prodid, pi.Credits); db.AddCreditHistory(Util.UserId, prodid, pi.Credits, orderId); Response.Redirect(string.Format("~/Member/CouponSuccess.aspx?cradd={0}", pi.Credits), false); } } else { Response.Redirect(string.Format("~/Member/CouponFailure.aspx?couponcode={0}", couponCode), false); } } }
protected void Page_Load(object sender, EventArgs e) { Session["bodyid"] = "user-home"; //IncludePage(ProtectInc, Resources.Resource.incProtect); //IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2); LoginView lv = Master.FindControl("HeadLoginView") as LoginView; if (lv != null) { //lv.Visible = false; } LoginUser.DestinationPageUrl = "~/Member/MemberHome.aspx"; string productId = string.Empty; string country = string.Empty; string price = string.Empty; string addParams = string.Empty; if (Request.Params["pid"] != null) { productId = Request.Params["pid"]; if (Request.Params["country"] != null) country = Request.Params["country"]; if (Request.Params["price"] != null) price = Request.Params["price"]; if (!string.IsNullOrEmpty(productId)) { LogonMessage.Text = Resources.Resource.LogonRequiredForPurchase; int prodid = 0; if (!int.TryParse(productId, out prodid)) prodid = 0; ProductInfo prodInfo = null; using (Database db = new MySqlDatabase()) { prodInfo = db.GetProductById(prodid); } if (Request.Params["tid"] == null) { addParams = string.Format("pid={0}&country={1}&price={2}", productId, country, price); decimal decPrice = 0m; if (!decimal.TryParse(price, out decPrice)) decPrice = 0; if (decPrice > 0m) { if (System.String.Compare(prodInfo.Extra, "subscription", System.StringComparison.OrdinalIgnoreCase) != 0) LoginUser.DestinationPageUrl = "~/Member/BuyProduct.aspx?" + addParams; else LoginUser.DestinationPageUrl = "~/Member/Subscription.aspx?" + addParams; } else { LoginUser.DestinationPageUrl = "~/Member/Quotation.aspx?" + addParams; } } else { addParams = string.Format("tid={0}&pid={1}", Request.Params["tid"], Request.Params["pid"]); LoginUser.DestinationPageUrl = "~/Member/BuyProduct.aspx?" + addParams; } } } string guid = string.Empty; string type = string.Empty; string email = string.Empty; string emailRequesting = string.Empty; //messageDiv.Visible = false; if (Request.Params["id"] != null) { guid = Request.Params["id"]; if (Request.Params["tp"] != null) type = Request.Params["tp"]; addParams = string.Format("id={0}&tp={1}", guid, type); using (Database db = new MySqlDatabase()) { db.ProcessConfirmation(guid, Convert.ToInt32(type), out email, out emailRequesting); } LogonMessage.Text = string.Format(Resources.Resource.LogonEmailUnknown, email); //messageDiv.Visible = true; } //RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]) + "&" + addParams; if (Convert.ToString(Session["culture"]).Contains("nl")) { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_LanguageNL" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_LanguageUS" + "');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_LanguageUS" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_LanguageNL" + "');", true); } Control ctrlDiv = this.Master.FindControl("logoutDiv"); ctrlDiv.Visible = false; }
protected void SubscriptionSubmit_Click(object sender, EventArgs e) { int ecl, vcl; Util.GetUserClearanceLevels(Util.UserId, out vcl, out ecl); int qty = 0; if (int.TryParse(QuantityEdit.Text, out qty)) { int prodid = (int)Session["subscription.productid"]; decimal unitprice = (decimal)Session["subscription.unitprice"]; decimal baseprice = 0m; string desc = string.Empty; ProductInfo pi; using (Database db = new MySqlDatabase()) { pi = db.GetProductById(prodid); if (ecl < 100 || vcl < 100) { ProductPriceInfoList ppil = db.GetProductPrices(prodid, Request.Params["country"]); desc = pi.Name; baseprice = ppil[0].Price; } } decimal totalprice = baseprice + (unitprice * qty); Session["amt"] = totalprice; if (pi.Extra.Length > 0) pi.Extra += "\x01"; pi.Extra += string.Format("{0:F2}", baseprice); List<ProductInfo> products = new List<ProductInfo>(); if (baseprice > 0m) products.Add(pi); string name = string.Format("{0} credits", qty); //desc = string.Format("{0} credits @ EUR {1:F2}", qty, unitprice); desc = string.Format("Managed Plan {0} credits", qty); pi = new ProductInfo(0, name, desc, qty, unitprice.ToString()); if (baseprice == 0m) pi.Extra = "subscription"; products.Add(pi); PurchaseProduct(prodid, totalprice, desc, products.ToArray()); } }
protected void Page_Load(object sender, EventArgs e) { Session["bodyid"] = "user-home"; if (Session != null) { // Store essential session information temporarily string culture = Session["culture"] as string ?? "nl-NL"; Session.Clear(); FormsAuthentication.SignOut(); // Restore the essential session information Session["culture"] = culture; } if (Request.IsAuthenticated) { if (Request.Params["pid"] != null || Request.Params["tid"] != null) { Response.Redirect(string.Format("~/Account/Login.aspx?tid={0}&pid={1}", Request.Params["tid"], Request.Params["pid"]), false); } else { Response.Redirect("~/Default.aspx", false); } } Literal name = HeadLoginView.FindControl("HeadLoginName") as Literal; if (name != null) { if (Session["userid"] != null) { long userId = Util.UserId; using (Database db = new MySqlDatabase()) { ClientInfo ci = db.GetClientInfo(userId); name.Text = string.Format(" {0}", ci.GetFullName()); } } } SetStringForWizardLabel("PasswordLengthLabel", string.Format(Resources.Resource.NewPasswordReq, Membership.MinRequiredPasswordLength)); RegisterUser.ContinueDestinationPageUrl = REGISTER_CONTINUATION_PAGE; if (!string.IsNullOrEmpty(Request.Params["pid"])) { Session["register.pid"] = Request.Params["pid"]; Session["register.country"] = Request.Params["country"]; Session["register.price"] = Request.Params["price"]; } if (Session["register.pid"] != null) { string destinationPage = "BuyProduct"; decimal price = 0m; if (!decimal.TryParse(Session["register.price"] as string, out price)) price = 0m; if (price == 0m) { destinationPage = "Quotation"; } else { int prodid; if (!int.TryParse(Request.Params["pid"], out prodid)) prodid = 0; if (prodid > 0) { using (Database db = new MySqlDatabase()) { ProductInfo prodInfo = db.GetProductById(prodid); if (System.String.Compare(prodInfo.Extra, "subscription", System.StringComparison.OrdinalIgnoreCase) == 0) destinationPage = "Subscription"; } } } RegisterUser.ContinueDestinationPageUrl = string.Format("~/Member/{0}.aspx?pid={1}&country={2}&price={3}", destinationPage, Session["register.pid"], Session["register.country"], Session["register.price"]); } if (!string.IsNullOrEmpty(Request.Params["id"])) { Session["register.confirm.id"] = Request.Params["id"]; Session["register.confirm.tp"] = Request.Params["tp"]; RegisterUser.ContinueDestinationPageUrl = REGISTER_CONTINUATION_PAGE; // string.Format("~/Member/Confirm.aspx?id={0}&tp={1}", Request.Params["id"], Request.Params["tp"]); } if (!IsPostBack) { 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 (Request.Params["mode"] != null) { string tmp = Request.Params["mode"]; if (!string.IsNullOrEmpty(tmp)) { if (tmp.ToLower() == "edit") { TextBox userName = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("UserName") as TextBox; if (userName != null) userName.ReadOnly = true; } } } if (Request.Params["res"] != null) { string res = Request.Params["res"]; if (!string.IsNullOrEmpty(res)) { string errorMsg = Resources.Resource.SecurityCodeIncorrect; if (Session["errmsg"] != null) errorMsg = Session["errmsg"] as string; Literal ErrorMessage = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("ErrorMessage") as Literal; if (ErrorMessage != null) ErrorMessage.Text = string.Format(Resources.Resource.ErrorMessageFmt, errorMsg); } } if (Request.QueryString["ErrorId"] == "alreadyexist") { Response.Redirect("~/ThankYou.aspx?id=1"); } else if (Request.QueryString["ErrorId"] == "error") { Response.Redirect("~/ThankYou.aspx?id=2"); } else if (Request.QueryString["ErrorId"] == "cancel") { Response.Redirect("~/ThankYou.aspx?id=4"); } else if (Request.QueryString["ErrorId"] == "success") { string email = Request.QueryString["email"]; string firstName = Request.QueryString["first_name"]; string lastName = Request.QueryString["last_name"]; RegisterUser.UserName = Guid.NewGuid().ToString(); ViewState["pwd"] = GeneratePassword(); using (Database db = new MySqlDatabase()) {//Added by Nagesh to remove duplicate emails, Also removed email send function from db.registeruser, email should be sent from here only Util.UserId = db.RegisterUser(RegisterUser.UserName, "/", email, "", Convert.ToString(ViewState["pwd"]), null, null, 0); } RegisterClientInfoUsingFBCredentials(firstName, lastName, email, Convert.ToString(ViewState["pwd"])); Response.Redirect("~/ThankYou.aspx"); } else if (Request.QueryString["id"] != null && Request.QueryString["tp"] != null && Request.QueryString["requestingUserinfo"] != null) { string id = Request.QueryString["id"]; string relationType = Request.QueryString["tp"]; string fullName = string.Empty; try { fullName = EncryptionClass.Decrypt(Request.QueryString["requestingUserinfo"]); } catch { } if (!string.IsNullOrEmpty(fullName)) { TextBox FirstName = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("FirstName") as TextBox; FirstName.Text = fullName.Split(' ')[0]; TextBox LastName = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("LastName") as TextBox; LastName.Text = fullName.Split(' ')[1]; } string requestedEmail = string.Empty; using (Database db = new MySqlDatabase()) { db.getEmailByUniqueId(id, out requestedEmail); } string UserEmail = requestedEmail; TextBox Email = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("Email") as TextBox; Email.Text = UserEmail; } } IncludePage(FooterLiteral, Resources.Resource.FooterSection); if (Convert.ToString(Session["culture"]).Contains("nl")) { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "LanguageNL" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "LanguageUS" + "');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "LanguageUS" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "LanguageNL" + "');", true); } }