本文整理汇总了C#中Nop.Web.Models.Media.PictureModel类的典型用法代码示例。如果您正苦于以下问题:C# PictureModel类的具体用法?C# PictureModel怎么用?C# PictureModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PictureModel类属于Nop.Web.Models.Media命名空间,在下文中一共展示了PictureModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProductDetailsModel
public ProductDetailsModel()
{
DefaultPictureModel = new PictureModel();
PictureModels = new List<PictureModel>();
ProductVariantModels = new List<ProductVariantModel>();
SpecificationAttributeModels = new List<ProductSpecificationModel>();
}
示例2: ProductOverviewModel
public ProductOverviewModel()
{
ProductPrice = new ProductPriceModel();
DefaultPictureModel = new PictureModel();
SpecificationAttributeModels = new List<ProductSpecificationModel>();
ReviewOverviewModel = new ProductReviewOverviewModel();
}
示例3: ManufacturerModel
public ManufacturerModel()
{
PictureModel = new PictureModel();
FeaturedProducts = new List<ProductModel>();
Products = new List<ProductModel>();
PagingFilteringContext = new CatalogPagingFilteringModel();
}
示例4: VendorModel
private ICollection<Branch> _branches; //add by hz
#endregion Fields
#region Constructors
public VendorModel()
{
PictureModel = new PictureModel();
FeaturedProducts = new List<ProductOverviewModel>();
Products = new List<ProductOverviewModel>();
PagingFilteringContext = new CatalogPagingFilteringModel();
Branches = new List<BranchModel>();
}
示例5: ProductModel
public ProductModel()
{
ProductPrice = new ProductPriceModel();
DefaultPictureModel = new PictureModel();
PictureModels = new List<PictureModel>();
ProductVariantModels = new List<ProductVariantModel>();
SpecificationAttributeModels = new List<ProductSpecificationModel>();
}
示例6: CategoryModel
public CategoryModel()
{
PictureModel = new PictureModel();
FeaturedProducts = new List<ProductOverviewModel>();
Products = new List<ProductOverviewModel>();
PagingFilteringContext = new CatalogPagingFilteringModel();
SubCategories = new List<SubCategoryModel>();
CategoryBreadcrumb = new List<CategoryModel>();
}
示例7: ManufacturerModel
public ManufacturerModel()
{
PictureModel = new PictureModel();
FeaturedProducts = new List<ProductModel>();
Products = new List<ProductModel>();
PagingFilteringContext = new CatalogPagingFilteringModel();
AvailableSortOptions = new List<SelectListItem>();
AvailableViewModes = new List<SelectListItem>();
PageSizeOptions = new List<SelectListItem>();
}
示例8: ProductDetailsModel
public ProductDetailsModel()
{
DefaultPictureModel = new PictureModel();
PictureModels = new List<PictureModel>();
GiftCard = new GiftCardModel();
ProductPrice = new ProductPriceModel();
AddToCart = new AddToCartModel();
ProductVariantAttributes = new List<ProductVariantAttributeModel>();
AssociatedProducts = new List<ProductDetailsModel>();
}
示例9: CategoryModel
public CategoryModel()
{
PictureModel = new PictureModel();
FeaturedProducts = new List<ProductModel>();
Products = new List<ProductModel>();
PagingFilteringContext = new CatalogPagingFilteringModel();
SubCategories = new List<SubCategoryModel>();
CategoryBreadcrumb = new List<CategoryModel>();
AvailableSortOptions = new List<SelectListItem>();
AvailableViewModes = new List<SelectListItem>();
PageSizeOptions = new List<SelectListItem>();
}
示例10: GetProduct
public ProductDetailsModel GetProduct(string name)
{
var product = _productRepository.Table.FirstOrDefault(x => x.Name == name.Trim());
var model = new ProductDetailsModel();
if (product != null)
{
model.Name = product.Name;
const bool isAssociatedProduct = false;
model.DefaultPictureZoomEnabled = false;
//default picture
var defaultPictureSize = _mediaSettings.ProductDetailsPictureSize;
//prepare picture models
var productPicturesCacheKey = string.Format(ModelCacheEventConsumer.PRODUCT_DETAILS_PICTURES_MODEL_KEY, product.Id, defaultPictureSize, isAssociatedProduct, _workContext.WorkingLanguage.Id, _webHelper.IsCurrentConnectionSecured(), _storeContext.CurrentStore.Id);
var cachedPictures = _cacheManager.Get(productPicturesCacheKey, () =>
{
var pictures = _pictureService.GetPicturesByProductId(product.Id);
var defaultPictureModel = new PictureModel()
{
ImageUrl = _pictureService.GetPictureUrl(pictures.FirstOrDefault(), defaultPictureSize, !isAssociatedProduct),
FullSizeImageUrl = _pictureService.GetPictureUrl(pictures.FirstOrDefault(), 0, !isAssociatedProduct),
Title = string.Format(_localizationService.GetResource("Media.Product.ImageLinkTitleFormat.Details"), model.Name),
AlternateText = string.Format(_localizationService.GetResource("Media.Product.ImageAlternateTextFormat.Details"), model.Name),
};
//all pictures
var pictureModels = new List<PictureModel>();
foreach (var picture in pictures)
{
pictureModels.Add(new PictureModel()
{
ImageUrl = _pictureService.GetPictureUrl(picture, 380),
FullSizeImageUrl = _pictureService.GetPictureUrl(picture),
Title = string.Format(_localizationService.GetResource("Media.Product.ImageLinkTitleFormat.Details"), model.Name),
AlternateText = string.Format(_localizationService.GetResource("Media.Product.ImageAlternateTextFormat.Details"), model.Name),
});
}
return new { DefaultPictureModel = defaultPictureModel, PictureModels = pictureModels };
});
model.DefaultPictureModel = cachedPictures.DefaultPictureModel;
model.PictureModels = cachedPictures.PictureModels;
}
return model;
}
示例11: ProductDetailsModel
public ProductDetailsModel()
{
DefaultPictureModel = new PictureModel();
PictureModels = new List<PictureModel>();
GiftCard = new GiftCardModel();
ProductPrice = new ProductPriceModel();
AddToCart = new AddToCartModel();
ProductAttributes = new List<ProductAttributeModel>();
AssociatedProducts = new List<ProductDetailsModel>();
VendorModel = new VendorBriefInfoModel();
Breadcrumb = new ProductBreadcrumbModel();
ProductTags = new List<ProductTagModel>();
ProductSpecifications= new List<ProductSpecificationModel>();
ProductManufacturers = new List<ManufacturerModel>();
ProductReviewOverview = new ProductReviewOverviewModel();
TierPrices = new List<TierPriceModel>();
}
示例12: PrepareProductOverviewModels
protected IEnumerable<ProductOverviewModel> PrepareProductOverviewModels(IEnumerable<Product> products,
bool preparePriceModel = true, bool preparePictureModel = true,
int? productThumbPictureSize = null, bool prepareSpecificationAttributes = false,
bool forceRedirectionAfterAddingToCart = false)
{
if (products == null)
throw new ArgumentNullException("products");
//performance optimization. let's load all variants at one go
var allVariants = _productService.GetProductVariantsByProductIds(products.Select(x => x.Id).ToArray());
var models = new List<ProductOverviewModel>();
foreach (var product in products)
{
var model = new ProductOverviewModel()
{
Id = product.Id,
Name = product.GetLocalized(x => x.Name),
ShortDescription = product.GetLocalized(x => x.ShortDescription),
FullDescription = product.GetLocalized(x => x.FullDescription),
SeName = product.GetSeName(),
};
//price
if (preparePriceModel)
{
#region Prepare product price
var priceModel = new ProductOverviewModel.ProductPriceModel();
//var productVariants = _productService.GetProductVariantsByProductId(product.Id);
//we use already loaded variants
var productVariants = allVariants.Where(x => x.ProductId == product.Id).ToList();
switch (productVariants.Count)
{
case 0:
{
//no variants
priceModel.OldPrice = null;
priceModel.Price = null;
}
break;
default:
{
if (_permissionService.Authorize(StandardPermissionProvider.DisplayPrices))
{
//calculate for the maximum quantity (in case if we have tier prices)
decimal? minimalPrice = null;
var productVariant = _priceCalculationService.GetProductVariantWithMinimalPrice(productVariants, _workContext.CurrentCustomer, true, int.MaxValue, out minimalPrice);
if (!productVariant.CustomerEntersPrice)
{
if (productVariant.CallForPrice)
{
priceModel.OldPrice = null;
priceModel.Price = _localizationService.GetResource("Products.CallForPrice");
}
else if (minimalPrice.HasValue)
{
//calculate prices
decimal taxRate = decimal.Zero;
decimal oldPriceBase = _taxService.GetProductPrice(productVariant, productVariant.OldPrice, out taxRate);
decimal finalPriceBase = _taxService.GetProductPrice(productVariant, minimalPrice.Value, out taxRate);
decimal oldPrice = _currencyService.ConvertFromPrimaryStoreCurrency(oldPriceBase, _workContext.WorkingCurrency);
decimal finalPrice = _currencyService.ConvertFromPrimaryStoreCurrency(finalPriceBase, _workContext.WorkingCurrency);
//do we have tier prices configured?
var tierPrices = new List<TierPrice>();
if (productVariant.HasTierPrices)
{
tierPrices.AddRange(productVariant.TierPrices
.OrderBy(tp => tp.Quantity)
.ToList()
.FilterForCustomer(_workContext.CurrentCustomer)
.RemoveDuplicatedQuantities());
}
bool displayFromMessage =
//When there is just one tier (with qty 1), there are no actual savings in the list.
(tierPrices.Count > 0 && !(tierPrices.Count == 1 && tierPrices[0].Quantity <= 1)) ||
//we have more than one variant
(productVariants.Count > 1);
if (displayFromMessage)
{
priceModel.OldPrice = null;
priceModel.Price = String.Format(_localizationService.GetResource("Products.PriceRangeFrom"), _priceFormatter.FormatPrice(finalPrice));
}
else
{
if (finalPriceBase != oldPriceBase && oldPriceBase != decimal.Zero)
{
priceModel.OldPrice = _priceFormatter.FormatPrice(oldPrice);
priceModel.Price = _priceFormatter.FormatPrice(finalPrice);
}
else
{
priceModel.OldPrice = null;
priceModel.Price = _priceFormatter.FormatPrice(finalPrice);
}
//.........这里部分代码省略.........
示例13: VendorAll
public ActionResult VendorAll()
{
var model = new List<VendorModel>();
var vendors = _vendorService.GetAllVendors();
foreach (var vendor in vendors)
{
var modelMan = vendor.ToModel();
//prepare picture model
int pictureSize = _mediaSettings.ManufacturerThumbPictureSize;
var vendorPictureCacheKey = string.Format(ModelCacheEventConsumer.VENDOR_PICTURE_MODEL_KEY, vendor.Id, pictureSize, true, _workContext.WorkingLanguage.Id, _webHelper.IsCurrentConnectionSecured());
modelMan.PictureModel = _cacheManager.Get(vendorPictureCacheKey, () =>
{
var pictureModel = new PictureModel()
{
FullSizeImageUrl = _pictureService.GetPictureUrl(vendor.PictureId),
ImageUrl = _pictureService.GetPictureUrl(vendor.PictureId, pictureSize),
Title = string.Format(_localizationService.GetResource("Media.Vendor.ImageLinkTitleFormat"), modelMan.Name),
AlternateText = string.Format(_localizationService.GetResource("Media.Vendor.ImageAlternateTextFormat"), modelMan.Name)
};
return pictureModel;
});
model.Add(modelMan);
}
return View(model);
}
示例14: ShoppingCartItemModel
public ShoppingCartItemModel()
{
Picture = new PictureModel();
AllowedQuantities = new List<SelectListItem>();
Warnings = new List<string>();
}
示例15: ProductAttributeValueModel
public ProductAttributeValueModel()
{
ImageSquaresPictureModel = new PictureModel();
}