public ProductImage Clone() { ProductImage result = new ProductImage(); result.AlternateText = this.AlternateText; result.Bvin = string.Empty; result.Caption = this.Caption; result.FileName = this.FileName; result.LastUpdatedUtc = this.LastUpdatedUtc; result.ProductId = this.ProductId; result.SortOrder = this.SortOrder; result.StoreId = this.StoreId; return result; }
private void RenderSingleAdditionalImage(StringBuilder sb, ProductImage img) { string mediumUrl = MerchantTribe.Commerce.Storage.DiskStorage.ProductAdditionalImageUrlMedium(MTApp, img.ProductId, img.Bvin, img.FileName, false); string largeUrl = MerchantTribe.Commerce.Storage.DiskStorage.ProductAdditionalImageUrlOriginal(MTApp, img.ProductId, img.Bvin, img.FileName, false); sb.Append("<a href=\"" + largeUrl + "\" alt=\"" + mediumUrl + "\" class=\"popover\">"); sb.Append("<img src=\""); sb.Append(MerchantTribe.Commerce.Storage.DiskStorage.ProductAdditionalImageUrlTiny(MTApp, img.ProductId, img.Bvin, img.FileName, false)); sb.Append("\" border=\"0\" alt=\"" + img.AlternateText + "\" />"); sb.Append("</a>"); }
protected void btnAdd_Click(object sender, EventArgs e) { // Image Upload if ((this.imgupload.HasFile)) { string fileName = System.IO.Path.GetFileNameWithoutExtension(imgupload.FileName); string ext = System.IO.Path.GetExtension(imgupload.FileName); if (MerchantTribe.Commerce.Storage.DiskStorage.ValidateImageType(ext)) { fileName = MerchantTribe.Web.Text.CleanFileName(fileName); ProductImage img = new ProductImage(); img.Bvin = System.Guid.NewGuid().ToString(); if (MerchantTribe.Commerce.Storage.DiskStorage.UploadAdditionalProductImage(MTApp.CurrentStore.Id, this.ProductIdField.Value, img.Bvin, this.imgupload.PostedFile)) { img.AlternateText = fileName + ext; img.FileName = fileName + ext; img.Caption = string.Empty; img.ProductId = this.ProductIdField.Value; if (MTApp.CatalogServices.ProductImages.Create(img)) { this.MessageBox1.ShowOk("New Image Added at " + DateTime.Now.ToString() + "."); } else { this.MessageBox1.ShowWarning("Unable to save image record. Unknown error."); } } else { this.MessageBox1.ShowWarning("Unable to save image. Unknown error."); } LoadImages(); } else { this.MessageBox1.ShowError("Only .PNG, .JPG, .GIF file types are allowed for icon images"); } } }
private void RenderSingleItem(StringBuilder sb, ProductImage img) { //string destinationLink = "ProductChoices_Edit.aspx?cid=" + o.Bvin + "&id=" + productBvin; string destinationLink = "#"; sb.Append("<div class=\"dragitem\" id=\"img" + img.Bvin + "\"><table class=\"formtable\" width=\"100%\"><tr>"); sb.Append("<td width=\"25%\"><a href=\"" + destinationLink + "\">"); sb.Append("<img src=\""); sb.Append(MerchantTribe.Commerce.Storage.DiskStorage.ProductAdditionalImageUrlTiny(MTApp, img.ProductId, img.Bvin, img.FileName, true)); sb.Append("\" border=\"0\" alt=\"" + img.AlternateText + "\" />"); sb.Append("</a></td>"); sb.Append("<td>"); sb.Append(img.Caption); sb.Append("</td>"); //sb.Append("<td width=\"75\"><a href=\"" + destinationLink + "\"><img src=\"../images/buttons/edit.png\" alt=\"edit\" /></a></td>"); sb.Append("<td width=\"30\"><a href=\"#\" class=\"trash\" id=\"rem" + img.Bvin + "\""); sb.Append("><img src=\"../../images/system/trashcan.png\" alt=\"Delete\" /></a></td>"); sb.Append("<td width=\"30\"><a href=\"#\" class=\"handle\"><img src=\"../../images/system/draghandle.png\" alt=\"Move\" /></a></td>"); sb.Append("</tr></table></div>"); }