protected void AdsDataSource_Selected(object sender, ObjectDataSourceStatusEventArgs e) { SueetieProduct returnValue = e.ReturnValue as SueetieProduct; if (returnValue == null) { base.Response.Redirect("~/Browse.aspx", true); } else { this.ProductID = returnValue.ProductID; StringBuilder builder = new StringBuilder(); builder.Append("Document : "); builder.AppendLine(returnValue.Title); builder.Append("Catégorie : "); builder.AppendLine(returnValue.CategoryName); builder.Append("Prix : "); builder.AppendFormat("{0:c}", returnValue.Price); builder.AppendLine(); builder.AppendLine(); builder.Append("Url : "); builder.AppendLine(string.Format("http://{0}/{1}/ShowProduct.aspx?id={2}", HttpContext.Current.Request.Url.Host, SueetieApplications.Current.ApplicationKey, returnValue.ProductID)); builder.AppendLine(); builder.AppendLine(SiteSettings.Instance.SiteName); builder.AppendLine(string.Format("http://{0}", HttpContext.Current.Request.Url.Host)); this.EmailMessageTextBox.Text = builder.ToString(); this.EmailSubjectTextBox.Text = "Take a look at: " + returnValue.Title; } }
protected void rptProducts_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { SueetieProduct dataItem = (SueetieProduct)e.Item.DataItem; Image image = e.Item.FindControl("imgProductPhoto") as Image; if (dataItem.PreviewImageID == -1) { image.Visible = false; } else { image.ImageUrl = string.Format("/images/products/{0}.Md.jpg", dataItem.ProductID); } Image image2 = e.Item.FindControl("imgIsActive") as Image; image2.ImageUrl = "/images/shared/sueetie/true.png"; if (dataItem.StatusTypeID != 100) { image2.ImageUrl = "/images/shared/sueetie/false.png"; } HyperLink link = e.Item.FindControl("hlProduct") as HyperLink; link.NavigateUrl = string.Format("EditProduct.aspx?id={0}", dataItem.ProductID); HyperLink link2 = e.Item.FindControl("hlCategory") as HyperLink; link2.NavigateUrl = string.Format("ManageProducts.aspx?c={0}", dataItem.CategoryID); } }
protected void rptProducts_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { SueetieProduct dataItem = (SueetieProduct)e.Item.DataItem; Image image = e.Item.FindControl("imgProductPhoto") as Image; if (dataItem.PreviewImageID == -1) { image.Visible = false; } else { image.ImageUrl = string.Format("/images/products/{0}.Md.jpg", dataItem.ProductID); } HyperLink link = e.Item.FindControl("hlProduct") as HyperLink; link.NavigateUrl = string.Format("ShowProduct.aspx?id={0}", dataItem.ProductID); HyperLink link2 = e.Item.FindControl("hlCategory") as HyperLink; link2.NavigateUrl = string.Format("Browse.aspx?c={0}", dataItem.CategoryID); } }
protected void AdDataSource_OnUpdating(object sender, ObjectDataSourceMethodEventArgs e) { if (this.Page.IsValid) { var purchaseTypes = this.AdFormView.FindControl("ddPurchaseTypes") as DropDownList; var statusTypes = this.AdFormView.FindControl("ddStatusTypes") as DropDownList; var productTypes = this.AdFormView.FindControl("rblProductTypes") as RadioButtonList; var textBox = this.AdFormView.FindControl("PriceTextBox") as TextBox; var result = 0M; decimal.TryParse(textBox.Text, out result); var product = new SueetieProduct { CategoryID = this.CategoryDropDown.CurrentCategoryId, Title = e.InputParameters["title"] as string, SubTitle = e.InputParameters["subtitle"] as string, ProductDescription = e.InputParameters["productdescription"] as string, Price = result, ProductID = (int)e.InputParameters["productid"], DownloadURL = e.InputParameters["downloadurl"] as string, DocumentationURL = e.InputParameters["documentationurl"] as string, ImageGalleryURL = e.InputParameters["imagegalleryurl"] as string, PurchaseTypeID = int.Parse(purchaseTypes.SelectedValue), StatusTypeID = int.Parse(statusTypes.SelectedValue), ProductTypeID = int.Parse(productTypes.SelectedValue) }; e.InputParameters.Remove("productid"); e.InputParameters.Remove("title"); e.InputParameters.Remove("subtitle"); e.InputParameters.Remove("productdescription"); e.InputParameters.Remove("price"); e.InputParameters.Remove("purchasetypeid"); e.InputParameters.Remove("downloadurl"); e.InputParameters.Remove("ImageGalleryURL"); e.InputParameters.Remove("DocumentationURL"); e.InputParameters.Add("sueetieProduct", product); } }
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(); } }