protected void GenerateProductKey_Click(object sender, EventArgs e) { var productPackage = CommerceCommon.GetProductPackage(base.CurrentSueetieProduct.ProductID); var purchase2 = new ProductPurchase { UserID = base.CurrentSueetieUserID, CartLinkID = CommerceCommon.GetCartLinkList(base.CurrentSueetieProduct.ProductID).Find(p => p.LicenseTypeID == 1).CartLinkID, ProductID = base.CurrentSueetieProduct.ProductID, PurchaseKey = CommerceCommon.GeneratePurchaseKey(), ActionID = 2 }; var productPurchase = purchase2; var num = Purchases.RecordPurchase(productPurchase); var spt = (SueetiePackageType)Enum.ToObject(typeof(SueetiePackageType), productPackage.PackageTypeID); var productLicense = new ProductLicense { License = LicensingCommon.CreateLicenseKey(SueetieLicenseType.Free, spt), PackageTypeID = productPackage.PackageTypeID, LicenseTypeID = 1, Version = productPackage.Version, UserID = base.CurrentSueetieUserID, CartLinkID = productPurchase.CartLinkID, PurchaseID = num }; Licenses.CreateProductLicense(productLicense); this.ltLicenseGeneration.Text = SueetieLocalizer.GetMarketplaceString("license_created_message"); this.ltNewLicense.Text = productLicense.License; this.SetActivePanel(this.pnlLicenseGeneration); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { DataHelper.GetIntFromQueryString("l", -1); if (!LicensingCommon.IsValidLicense(SueetiePackageType.Marketplace)) { this.lblLicenseType.Text = SueetieLocalizer.GetLicensingString("license_marketplace_notvalid_title"); this.lblLicenseInfo.Text = SueetieLocalizer.GetLicensingString("license_marketplace_notvalid_message") + " " + SueetieLocalizer.GetLicensingString("license_visit_sueetiecom"); } else if (LicensingCommon.IsInTrialPeriod(SueetiePackageType.Marketplace)) { this.lblLicenseType.Text = SueetieLocalizer.GetLicensingString("license_marketplace_trialperiod_title"); this.lblLicenseInfo.Text = SueetieLocalizer.GetLicensingString("license_marketplace_trialperiod_message") + " " + SueetieLocalizer.GetLicensingString("license_visit_sueetiecom"); } else if (LicensingCommon.IsFreeLicense(SueetiePackageType.Marketplace)) { this.lblLicenseType.Text = SueetieLocalizer.GetLicensingString("license_marketplace_free_title"); this.lblLicenseInfo.Text = SueetieLocalizer.GetLicensingString("license_marketplace_free_message") + " " + SueetieLocalizer.GetLicensingString("license_visit_sueetiecom"); } else if (LicensingCommon.IsCommercialLicense(SueetiePackageType.Marketplace)) { this.lblLicenseType.Text = string.Format(SueetieLocalizer.GetLicensingString("license_marketplace_paid_title"), LicenseHelper.LicenseTypeDisplay(LicensingCommon.GetSueetieLicenseType(SueetiePackageType.Marketplace))); this.lblLicenseInfo.Text = SueetieLocalizer.GetLicensingString("license_marketplace_paid_message"); } this.ProcessHyperlinks(LicensingCommon.IsValidLicense(SueetiePackageType.Marketplace)); } }
public static List <SueetieProduct> LicensedProductListByCategory(this List <SueetieProduct> _products) { List <SueetieProduct> list = _products; if (LicensingCommon.IsFreeLicense(SueetiePackageType.Marketplace) && !CommerceHelper.IsAdminPage()) { list = _products.Take <SueetieProduct>(3).ToList <SueetieProduct>(); } return(list); }
protected void btnProductKey_OnClick(object sender, EventArgs e) { SueetiePackageType spt = (SueetiePackageType)Enum.ToObject(typeof(SueetiePackageType), int.Parse(this.rblPackageTypes.SelectedValue)); SueetieLicenseType type2 = (SueetieLicenseType)Enum.ToObject(typeof(SueetieLicenseType), int.Parse(this.rblLicenseTypes.SelectedValue)); CartLink cartLink = CommerceCommon.GetCartLink((int)spt, (int)type2); base.CurrentSueetieProduct = Products.GetSueetieProduct(cartLink.ProductID); ProductPurchase productPurchase = new ProductPurchase { UserID = this.ProductKeySueetieUser.UserID, CartLinkID = cartLink.CartLinkID, ProductID = cartLink.ProductID, PurchaseKey = CommerceCommon.GeneratePurchaseKey(), ActionID = base.CurrentSueetieProduct.ActionType() }; int num = Purchases.RecordPurchase(productPurchase); ProductPackage productPackage = CommerceCommon.GetProductPackage(cartLink.ProductID); Licenses.CreateProductLicense(new ProductLicense { PackageTypeID = productPackage.PackageTypeID, LicenseTypeID = cartLink.LicenseTypeID, Version = productPackage.Version, UserID = this.ProductKeySueetieUser.UserID, CartLinkID = cartLink.CartLinkID, PurchaseID = num, License = LicensingCommon.CreateLicenseKey(type2, spt) }); this.txtKey.Text = LicensingCommon.CreateLicenseKey(type2, spt); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { this.lblPurchaseTitle.Text = SueetieLocalizer.GetMarketplaceString("productpurchase_title_success"); this.pnlLicenses.Visible = false; this.transactionXID = base.Request.QueryString["tx"]; PaymentService primaryPaymentService = CommerceContext.Current.PrimaryPaymentService; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(primaryPaymentService.TransactionUrl); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; byte[] bytes = base.Request.BinaryRead(HttpContext.Current.Request.ContentLength); string str = Encoding.ASCII.GetString(bytes) + string.Format("&cmd=_notify-synch&tx={0}&at={1}", this.transactionXID, primaryPaymentService.IdentityToken); request.ContentLength = str.Length; StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII); writer.Write(str); writer.Close(); StreamReader reader = new StreamReader(request.GetResponse().GetResponseStream()); string input = reader.ReadToEnd(); reader.Close(); this.lblTransactionXID.Text = this.transactionXID; List <string> list = (from s in Regex.Split(input, "\n", RegexOptions.ExplicitCapture) where !string.IsNullOrEmpty(s) select s).ToList <string>(); if (list[0] == "SUCCESS") { List <ProductPurchase> list2 = new List <ProductPurchase>(); List <ProductLicense> list3 = new List <ProductLicense>(); this.PaymentProperties = this.CreateDictionary((from t in list where t.Contains("=") select t).ToList <string>()); int num = this.GetNum("num_cart_items"); int num2 = 0; int cartLinkID = -1; int num4 = -1; this.transactionXID = this.GetString("txn_id"); for (int i = 1; i <= num; i++) { num2 = this.GetNum("quantity".AddItemNum(i)); cartLinkID = this.GetNum("item_number".AddItemNum(i)); CartLink cartLink = CommerceCommon.GetCartLink(cartLinkID); for (int j = 0; j < num2; j++) { base.CurrentSueetieProduct = Products.GetSueetieProduct(cartLink.ProductID); ProductPurchase item = new ProductPurchase { TransactionXID = this.transactionXID, UserID = base.CurrentSueetieUserID, CartLinkID = cartLinkID, ProductID = cartLink.ProductID, PurchaseKey = CommerceCommon.GeneratePurchaseKey(), ActionID = base.CurrentSueetieProduct.ActionType() }; list2.Add(item); num4 = Purchases.RecordPurchase(item); if (base.CurrentSueetieProduct.ProductTypeID == 5) { ProductPackage productPackage = CommerceCommon.GetProductPackage(cartLink.ProductID); SueetiePackageType spt = (SueetiePackageType)System.Enum.ToObject(typeof(SueetiePackageType), productPackage.PackageTypeID); ProductLicense license = new ProductLicense { PackageTypeID = productPackage.PackageTypeID, LicenseTypeID = cartLink.LicenseTypeID, Version = productPackage.Version, UserID = base.CurrentSueetieUserID, CartLinkID = cartLinkID, PurchaseID = num4, License = Guid.NewGuid().ToString().ToUpper() }; SueetieLicenseType type2 = (SueetieLicenseType)System.Enum.ToObject(typeof(SueetieLicenseType), cartLink.LicenseTypeID); license.License = LicensingCommon.CreateLicenseKey(type2, spt); list3.Add(license); Licenses.CreateProductLicense(license); } } } this.rptPurchases.DataSource = Purchases.GetPurchasesByTransaction(this.transactionXID); this.rptPurchases.DataBind(); if (list3.Count > 0) { this.rptLicenses.DataSource = Licenses.GetLicensesByTransaction(this.transactionXID); this.rptLicenses.DataBind(); this.pnlLicenses.Visible = true; } } else { this.lblPurchaseTitle.Text = SueetieLocalizer.GetMarketplaceString("productpurchase_title_failure"); this.pnlLicenses.Visible = false; this.pnlPurchases.Visible = false; this.pnlTransactionCode.Visible = false; this.pnlSuccess.Visible = false; this.pnlFailure.Visible = true; MailMessage message = new MailMessage { From = new MailAddress(SiteSettings.Instance.FromEmail, SiteSettings.Instance.FromName) }; MailAddress address = new MailAddress(SiteSettings.Instance.ContactEmail, SiteSettings.Instance.SiteName + SueetieLocalizer.GetMarketplaceString("purchase_failure_email_admin")); message.To.Add(address); message.Subject = SueetieLocalizer.GetMarketplaceString("purchase_failure_email_subject"); string str4 = SueetieLocalizer.GetMarketplaceString("purchase_failure_email_firstline") + Environment.NewLine + Environment.NewLine; object obj2 = str4 + base.CurrentSueetieUser.UserName.ToString() + " (" + base.CurrentSueetieUser.DisplayName + ")"; string str3 = string.Concat(new object[] { obj2, Environment.NewLine, DateTime.Now.ToLongDateString(), ' ', DateTime.Now.ToLongTimeString() }) + Environment.NewLine + Environment.NewLine; message.Body = str3; if (SueetieConfiguration.Get().Core.SendEmails) { EmailHelper.AsyncSendEmail(message); } } } }