本文整理汇总了C#中IWebHelper.IsCurrentConnectionSecured方法的典型用法代码示例。如果您正苦于以下问题:C# IWebHelper.IsCurrentConnectionSecured方法的具体用法?C# IWebHelper.IsCurrentConnectionSecured怎么用?C# IWebHelper.IsCurrentConnectionSecured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWebHelper
的用法示例。
在下文中一共展示了IWebHelper.IsCurrentConnectionSecured方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareProductOverviewModels
//.........这里部分代码省略.........
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);
}
}
if (product.IsRental)
{
//rental product
priceModel.OldPrice = priceFormatter.FormatRentalProductPeriod(product, priceModel.OldPrice);
priceModel.Price = priceFormatter.FormatRentalProductPeriod(product, priceModel.Price);
}
//property for German market
//we display tax/shipping info only with "shipping enabled" for this product
//we also ensure this it's not free shipping
priceModel.DisplayTaxShippingInfo = catalogSettings.DisplayTaxShippingInfoProductBoxes
&& product.IsShipEnabled &&
!product.IsFreeShipping;
}
}
}
else
{
//hide prices
priceModel.OldPrice = null;
priceModel.Price = null;
}
#endregion
}
break;
}
model.ProductPrice = priceModel;
#endregion
}
//picture
if (preparePictureModel)
{
#region Prepare product picture
//If a size has been set in the view, we use it in priority
int pictureSize = productThumbPictureSize.HasValue ? productThumbPictureSize.Value : mediaSettings.ProductThumbPictureSize;
//prepare picture model
var defaultProductPictureCacheKey = string.Format(ModelCacheEventConsumer.PRODUCT_DEFAULTPICTURE_MODEL_KEY, product.Id, pictureSize, true, workContext.WorkingLanguage.Id, webHelper.IsCurrentConnectionSecured(), storeContext.CurrentStore.Id);
model.DefaultPictureModel = cacheManager.Get(defaultProductPictureCacheKey, () =>
{
var picture = pictureService.GetPicturesByProductId(product.Id, 1).FirstOrDefault();
var pictureModel = new PictureModel
{
ImageUrl = pictureService.GetPictureUrl(picture, pictureSize),
FullSizeImageUrl = pictureService.GetPictureUrl(picture)
};
//"title" attribute
pictureModel.Title = (picture != null && !string.IsNullOrEmpty(picture.TitleAttribute)) ?
picture.TitleAttribute :
string.Format(localizationService.GetResource("Media.Product.ImageLinkTitleFormat"), model.Name);
//"alt" attribute
pictureModel.AlternateText = (picture != null && !string.IsNullOrEmpty(picture.AltAttribute)) ?
picture.AltAttribute :
string.Format(localizationService.GetResource("Media.Product.ImageAlternateTextFormat"), model.Name);
return pictureModel;
});
#endregion
}
//specs
if (prepareSpecificationAttributes)
{
model.SpecificationAttributeModels = PrepareProductSpecificationModel(controller, workContext,
specificationAttributeService, cacheManager, product);
}
//reviews
model.ReviewOverviewModel = new ProductReviewOverviewModel
{
ProductId = product.Id,
RatingSum = product.ApprovedRatingSum,
TotalReviews = product.ApprovedTotalReviews,
AllowCustomerReviews = product.AllowCustomerReviews
};
models.Add(model);
}
return models;
}
示例2: PrepareProductOverviewModels
public IEnumerable<ProductOverviewModel> PrepareProductOverviewModels(
IWorkContext workContext,
IStoreContext storeContext,
IProductService productService,
ILocalizationService localizationService,
IPictureService pictureService,
IWebHelper webHelper,
ICacheManager cacheManager,
CatalogSettings catalogSettings,
MediaSettings mediaSettings,
IEnumerable<Product> products,
int? productThumbPictureSize = null)
{
if (products == null)
throw new ArgumentNullException("products");
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(),
};
//picture
#region Prepare product picture
//If a size has been set in the view, we use it in priority
int pictureSize = productThumbPictureSize.HasValue ? productThumbPictureSize.Value : mediaSettings.ProductThumbPictureSize;
//prepare picture model
var defaultProductPictureCacheKey = string.Format(ModelCacheEventConsumer.PRODUCT_DEFAULTPICTURE_MODEL_KEY, product.Id, pictureSize, true, workContext.WorkingLanguage.Id, webHelper.IsCurrentConnectionSecured(), storeContext.CurrentStore.Id);
model.DefaultPictureModel = cacheManager.Get(defaultProductPictureCacheKey, () =>
{
var picture = pictureService.GetPicturesByProductId(product.Id, 1).FirstOrDefault();
var pictureModel = new PictureModel
{
ImageUrl = pictureService.GetPictureUrl(picture, pictureSize),
FullSizeImageUrl = pictureService.GetPictureUrl(picture)
};
//"title" attribute
pictureModel.Title = (picture != null && !string.IsNullOrEmpty(picture.TitleAttribute)) ?
picture.TitleAttribute :
string.Format(localizationService.GetResource("Media.Product.ImageLinkTitleFormat"), model.Name);
//"alt" attribute
pictureModel.AlternateText = (picture != null && !string.IsNullOrEmpty(picture.AltAttribute)) ?
picture.AltAttribute :
string.Format(localizationService.GetResource("Media.Product.ImageAlternateTextFormat"), model.Name);
return pictureModel;
});
#endregion
models.Add(model);
}
return models;
}