internal static List<ProductFile> GetProductDocumentsAndFiles(List<ProductDocumentFileInfo> importedDocuments) { List<ProductFile> productFiles = new List<ProductFile>(); foreach (var importedDocument in importedDocuments) { ProductFile productFile = new ProductFile(); productFile.Id = importedDocument.Document.Id; productFile.Title = importedDocument.Document.Title; productFile.Url = importedDocument.Document.Url; productFile.FileName = importedDocument.Document.FilePath; productFile.FileSize = importedDocument.Document.TotalSize.ToString(); productFile.Extension = importedDocument.Document.Extension; productFile.UploadedDate = importedDocument.Document.DateCreated.ToShortDateString(); productFiles.Add(productFile); } return productFiles; }
public ProductListItem(Product model) { ProductFile file = new ProductFile(); this.ID = model.ID; this.Title = model.Title; this.Url = "/Product/Show/" + model.ID; this.FacePath = "/Product/"; using (DB db = new DB()) { file = db.ProductFiles.Where(pf => pf.FileTypeAsInt == 0 && pf.ProductID == model.ID && pf.IsUse == true).FirstOrDefault(); if (file == null) { this.FacePath = "/Images/productpre.jpg"; } else { this.FacePath = file.Path; } } }
private void PopulateProductControls() { if (store == null) { return; } Product product; ListItem listItem; if (productGuid != Guid.Empty) { product = new Product(productGuid); listItem = ddTaxClassGuid.Items.FindByValue(product.TaxClassGuid.ToString()); if (listItem != null) { ddTaxClassGuid.ClearSelection(); listItem.Selected = true; } Title = SiteUtils.FormatPageTitle(siteSettings, WebStoreResources.ProductEditHeading + " - " + product.Name); heading.Text += Server.HtmlEncode(" : " + product.Name); txtName.Text = product.Name; edAbstract.Text = product.Teaser; edDescription.Text = product.Description; txtMetaDescription.Text = product.MetaDescription; txtMetaKeywords.Text = product.MetaKeywords; //txtSku.Text = product.Sku.ToString(); txtModelNumber.Text = product.ModelNumber.ToString(); chkShowInProductList.Checked = product.ShowInProductList; chkEnableRating.Checked = product.EnableRating; listItem = ddStatus.Items.FindByValue(((int)product.Status).ToString()); if (listItem != null) { ddStatus.ClearSelection(); listItem.Selected = true; } listItem = ddFullfillmentType.Items.FindByValue(((int)product.FulfillmentType).ToString()); if (listItem != null) { ddFullfillmentType.ClearSelection(); listItem.Selected = true; } if (product.FulfillmentType == FulfillmentType.Download) { pnlUpload.Enabled = true; pnlFileUpload.Enabled = true; ProductFile productFile = new ProductFile(productGuid); if (productFile.ProductGuid != Guid.Empty) { lnkDownload.Text = productFile.FileName; lnkDownload.NavigateUrl = SiteRoot + "/WebStore/ProductDownload.aspx?pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString() + "&prod=" + productFile.ProductGuid.ToString(); } } if (product.TeaserFile.Length > 0) { lnkTeaserDownload.NavigateUrl = teaserFileBasePath + product.TeaserFile; lnkTeaserDownload.Visible = true; if (product.TeaserFileLink.Length > 0) { lnkTeaserDownload.Text = product.TeaserFileLink; } else { lnkTeaserDownload.Text = product.TeaserFile; } txtTeaserFileLinkText.Text = product.TeaserFileLink; btnDeleteTeaser.Visible = true; } txtWeight.Text = product.Weight.ToString(); txtShippingAmount.Text = product.ShippingAmount.ToString("c", currencyCulture); txtQuantityOnHand.Text = product.QuantityOnHand.ToInvariantString(); txtSortRank1.Text = product.SortRank1.ToInvariantString(); txtSortRank2.Text = product.SortRank2.ToInvariantString(); } }