Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.DescriptionTextBox.Attributes.Add("onkeydown", "textCounter(this,500);");
            this.DescriptionTextBox.Attributes.Add("onkeyup", "textCounter(this,500);");

            if (!this.Page.IsPostBack)
            {
                this.lblNeedCategories.Text = "You must add a category before placing an ad. If you are a Marketplace Administrator</br> you can do that <a href=\"/marketplace/admin/Categories.aspx\">here.</a>";

                bool flag = CommerceCommon.HasMarketplaceCategories();
                this.phHasCategories.Visible = flag;
                this.phNoCategories.Visible  = !flag;
                foreach (ProductTypeItem item in CommerceCommon.GetProductTypeItemList())
                {
                    this.rblProductTypes.Items.Add(new ListItem(item.ProductTypeDescription, item.ProductTypeID.ToString()));
                }
                foreach (PurchaseTypeItem item2 in CommerceCommon.GetPurchaseTypeItemList())
                {
                    this.rblPurchaseTypes.Items.Add(new ListItem(item2.PurchaseTypeDescription, item2.PurchaseTypeID.ToString()));
                }
                this.rblPurchaseTypes.Items.FindByValue("1").Selected = true;
                if (CommerceCommon.IsSueetiePackageDistributor())
                {
                    this.rblProductTypes.Items.Add(new ListItem("Sueetie Package", "5"));
                }
                this.rblProductTypes.Items.FindByValue("1").Selected = true;
                this.PostAdWizard.MoveTo(this.PostAdWizard.WizardSteps[0]);
            }
            Button button = (Button)this.PostAdWizard.FindControl("StartNavigationTemplateContainerID$StartNextButton");

            button.Visible = false;
        }
        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);
        }
Beispiel #3
0
 protected void Submit_Click(object sender, EventArgs e)
 {
     CommerceCommon.UpdateCommerceSetting(new CommerceSetting("ActivityReportNum", this.txtActivityReportNum.Text));
     CommerceCommon.UpdateCommerceSetting(new CommerceSetting("MaxFullImageSize", this.txtMaxFullImageSize.Text));
     CommerceCommon.UpdateCommerceSetting(new CommerceSetting("FixedMediumImageHeight", this.txtFixedMediumImageHeight.Text));
     CommerceCommon.UpdateCommerceSetting(new CommerceSetting("FixedMediumImageWidth", this.txtFixedMediumImageWidth.Text));
     CommerceCommon.UpdateCommerceSetting(new CommerceSetting("FixedSmallImageHeight", this.txtFixedSmallImageHeight.Text));
     CommerceCommon.UpdateCommerceSetting(new CommerceSetting("FixedSmallImageWidth", this.txtFixedSmallImageWidth.Text));
     CommerceCommon.ClearCommerceSettingsCache();
     this.lblResults.Visible = true;
     this.lblResults.Text    = "Marketplace settings have been updated!";
 }
        public void Page_Load()
        {
            Predicate <CartLink> match           = null;
            Literal        child                 = new Literal();
            StringBuilder  builder               = new StringBuilder();
            string         str                   = string.Empty;
            string         title                 = string.Empty;
            PaymentService primaryPaymentService = CommerceContext.Current.PrimaryPaymentService;

            if (base.CurrentSueetieProduct.ProductTypeID == 5)
            {
                foreach (CartLink link in (from p in CommerceCommon.GetCartLinkList(base.CurrentSueetieProduct.ProductID)
                                           where p.LicenseTypeID > 11
                                           select p).ToList <CartLink>())
                {
                    title = link.PackageTypeDescription + " " + link.LicenseTypeDescription + " Product Key";
                    str   = string.Format(primaryPaymentService.PurchaseUrl, new object[] { primaryPaymentService.AccountName, link.CartLinkID, title, link.Price.ToString("##0.00"), primaryPaymentService.ReturnUrl, primaryPaymentService.ShoppingUrl });
                    if (this.IsSideBarLink)
                    {
                        builder.Append("<li><a href=\"" + str + "\">" + link.LicenseTypeDescription + " Product Key</a></li>");
                    }
                    else
                    {
                        builder.Append("<li><a href=\"" + str + "\">Add " + link.LicenseTypeDescription + " Product Key To Your Shopping Cart</a></li>");
                    }
                }
            }
            else if (base.CurrentSueetieProduct.PurchaseTypeID == 1)
            {
                if (match == null)
                {
                    match = p => p.ProductID == base.CurrentSueetieProduct.ProductID;
                }
                CartLink link2 = CommerceCommon.GetCartLinkList(base.CurrentSueetieProduct.ProductID).Find(match);
                title = base.CurrentSueetieProduct.Title;
                str   = string.Format(primaryPaymentService.PurchaseUrl, new object[] { primaryPaymentService.AccountName, link2.CartLinkID, title, link2.Price.ToString("##0.00"), primaryPaymentService.ReturnUrl, primaryPaymentService.ShoppingUrl });
                if (this.IsSideBarLink)
                {
                    builder.Append("<li><a href=\"" + str + "\">" + SueetieLocalizer.GetMarketplaceString("cartlink_commercial_sidebar") + "</a></li>");
                }
                else
                {
                    builder.Append("<li><a href=\"" + str + "\">" + string.Format(SueetieLocalizer.GetMarketplaceString("cartlink_commercial_bottom"), base.CurrentSueetieProduct.Title) + "</a></li>");
                }
            }
            child.Text = builder.ToString();
            if (child.Text.Trim().Length > 0)
            {
                this.Controls.Add(child);
            }
        }
 private void ProcessHyperlinks(bool isEnabled)
 {
     foreach (Control control in this.pnlMenu.Controls)
     {
         if ((control is HyperLink) && isEnabled)
         {
             string str = control.ID.Substring(2) + ".aspx";
             ((HyperLink)control).NavigateUrl = str;
         }
         if ((control is HyperLink) && !isEnabled)
         {
             ((HyperLink)control).NavigateUrl = "default.aspx?v=1";
         }
     }
     if (!CommerceCommon.IsSueetiePackageDistributor())
     {
         this.SueetieProductKeyLI.Visible = false;
     }
 }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        protected void AdFormView_OnDataBound(object sender, EventArgs e)
        {
            var dataItem = (SueetieProduct)this.AdFormView.DataItem;

            // Status Type
            var statusTypes = this.AdFormView.FindControl("ddStatusTypes") as DropDownList;

            foreach (ProductStatusType type in Enum.GetValues(typeof(ProductStatusType)))
            {
                statusTypes.Items.Add(new ListItem(Enum.GetName(typeof(ProductStatusType), type), type.ToString("D")));
            }

            statusTypes.Items.FindByValue(dataItem.StatusTypeID.ToString()).Selected = true;

            // Product Types
            var productTypes = this.AdFormView.FindControl("rblProductTypes") as RadioButtonList;

            foreach (var item in CommerceCommon.GetProductTypeItemList())
            {
                productTypes.Items.Add(new ListItem(item.ProductTypeDescription, item.ProductTypeID.ToString()));
            }

            if (CommerceCommon.IsSueetiePackageDistributor())
            {
                productTypes.Items.Add(new ListItem("Sueetie Package", "5"));
            }

            productTypes.Items.FindByValue(dataItem.ProductTypeID.ToString()).Selected = true;

            // Purchase Types
            var purchaseTypes = this.AdFormView.FindControl("ddPurchaseTypes") as DropDownList;

            foreach (var item2 in CommerceCommon.GetPurchaseTypeItemList())
            {
                purchaseTypes.Items.Add(new ListItem(item2.PurchaseTypeDescription, item2.PurchaseTypeID.ToString()));
            }

            purchaseTypes.Items.FindByValue(dataItem.PurchaseTypeID.ToString()).Selected = true;
        }
 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);
             }
         }
     }
 }
Beispiel #9
0
        protected void PostAdWizard_FinishButtonClick(object sender, WizardNavigationEventArgs e)
        {
            if (this.Page.IsValid)
            {
                var purchaseType = PurchaseType.Commercial;
                if (Enum.IsDefined(typeof(PurchaseType), Convert.ToInt32(this.rblPurchaseTypes.SelectedValue)))
                {
                    purchaseType = (PurchaseType)Enum.Parse(typeof(PurchaseType), this.rblPurchaseTypes.SelectedValue);
                }

                var sueetieProduct = new SueetieProduct
                {
                    UserID             = this.CurrentSueetieUserID,
                    CategoryID         = this.CategoryPath.CurrentCategoryId,
                    Title              = this.TitleTextBox.Text,
                    SubTitle           = this.SubTitleTextBox.Text,
                    ProductDescription = this.DescriptionTextBox.Text,
                    DateCreated        = DateTime.Now,
                    DownloadURL        = this.UrlTextBox.Text,
                    Price              = decimal.Parse(this.PriceTextBox.Text),
                    PurchaseTypeID     = (int)purchaseType,
                    ProductTypeID      = int.Parse(this.rblProductTypes.SelectedValue.ToString()),
                    StatusTypeID       = 100
                };

                if (this.FileUploadControl != null && string.IsNullOrWhiteSpace(sueetieProduct.DownloadURL) && !string.IsNullOrWhiteSpace(this.FileUploadControl.FileName))
                {
                    sueetieProduct.DownloadURL = this.FileUploadControl.FileName;
                }

                int id = Products.CreateSueetieProduct(sueetieProduct);

                if (this.FileUploadControl != null && this.FileUploadControl.FileBytes != null && this.FileUploadControl.FileBytes.Length != 0)
                {
                    var localPath = sueetieProduct.ResolveFilePath(this.Server);
                    var directory = Path.GetDirectoryName(localPath);
                    if (!Directory.Exists(directory))
                    {
                        Directory.CreateDirectory(directory);
                    }

                    this.FileUploadControl.SaveAs(localPath);
                }

                var sueetieContent = new SueetieContent
                {
                    ContentTypeID = 0x12,
                    ApplicationID = SueetieApplications.Get().Marketplace.ApplicationID,
                    IsRestricted  = false,
                    SourceID      = id,
                    UserID        = base.CurrentSueetieUserID,
                    Permalink     = string.Concat(new object[] { "/", SueetieApplications.Get().Marketplace.ApplicationKey, "/ShowProduct.aspx?id=", id })
                };

                var contentId = SueetieCommon.AddSueetieContent(sueetieContent);
                SueetieLogs.LogUserEntry(UserLogCategoryType.MarketplaceProduct, contentId, base.CurrentSueetieUserID);

                this.UploadImagesLink.Visible     = true;
                this.UploadImagesLink.NavigateUrl = "ManagePhotos.aspx?id=" + id.ToString();

                CommerceCommon.ClearMarketplaceCache();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (DataHelper.GetIntFromQueryString("id", -1) == -1)
            {
                base.Response.Redirect("Browse.aspx");
                return;
            }

            if (this.Page.IsPostBack)
            {
                return;
            }

            var product = this.CurrentSueetieProduct;
            var user    = this.CurrentSueetieUser;

            base.CurrentContentID            = product.ContentID;
            this.PurchaseKey                 = CommerceCommon.GeneratePurchaseKey();
            this.LoginButtonLI2.Visible      = false;
            this.ProductKeyButtonLI2.Visible = false;
            this.DownloadButtonLI2.Visible   = false;

            this.DownloadButton2.Text = string.Format("Télécharger {0}", product.Title);
            this.LoginButton2.Text    = SueetieLocalizer.GetMarketplaceString(string.Format("loginto_{0}", product.ProductType.ToString().ToLower()));

            if (!this.IsFileAvailable)
            {
                this.lblOptions.Text = "Nous sommes désolés, mais ce document n'est pas disponible actuellement.";
                return;
            }

            if (user.IsRegistered)
            {
                this.lblOptions.Text = "Actions possibles en tant que visiteur";

                this.ResponseContactEmailTextBox.Text = this.EmailSenderAddressTextBox.Text = user.Email;
                this.ResponseContactNameTextBox.Text  = this.EmailSenderNameTextBox.Text = user.DisplayName;
            }
            else
            {
                this.lblOptions.Text = "Actions possibles en tant que membre";
            }

            if (product.PurchaseType == PurchaseType.FreeAll)
            {
                if (product.ProductType == ProductType.ElectronicDownload)
                {
                    this.DownloadButtonLI2.Visible = true;
                }
            }
            else if (product.PurchaseType == PurchaseType.FreeRegistered)
            {
                if (user.IsRegistered)
                {
                    this.DownloadButtonLI2.Visible = true;
                }
                else
                {
                    this.LoginButtonLI2.Visible = true;
                }
            }
        }