Esempio n. 1
0
        private async Task <String> GetProductLabelsHtml(int id, string designName, int imageWidth, int imageHeight)
        {
            string returnHtml;
            var    pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName);
            var    labelsTask     = LabelService.GetLabelsByItemTypeId(StoreId, id, StoreConstants.ProductType);

            LabelHelper.StoreSettings = GetStoreSettings();
            LabelHelper.ImageWidth    = imageWidth == 0 ? GetSettingValueInt("ProductLabels_ImageWidth", 50) : imageWidth;
            LabelHelper.ImageHeight   = imageHeight == 0 ? GetSettingValueInt("ProductLabels_ImageHeight", 50) : imageHeight;


            await Task.WhenAll(pageDesignTask, labelsTask);

            var labels     = labelsTask.Result;
            var pageDesign = pageDesignTask.Result;

            if (pageDesign == null)
            {
                throw new Exception("PageDesing is null");
            }


            var pageOuput = LabelHelper.GetProductLabels(labels, pageDesign);

            returnHtml = pageOuput.PageOutputText;

            return(returnHtml);
        }