Ejemplo n.º 1
0
        public productSmall getProductSummaryOneItem(string productUrl, tbl_product item, CultureInfo currentCultureInfo, string langCode, string photoWidth, string photoHeight)
        {
            productSmall helperItem = new productSmall();

            // Car Brand , Car Model  Validation
            if (item.tbl_carModelProduct == null || item.tbl_carModelProduct.Where(a => a.tbl_carModel != null).FirstOrDefault() == null || item.tbl_carModelProduct.Where(a => a.tbl_carModel != null).FirstOrDefault().tbl_carModel == null || item.tbl_carModelProduct.Where(a => a.tbl_carModel != null).FirstOrDefault().tbl_carModel.tbl_carBrand == null)
            {
                return null;
            }

            helperItem.brand = item.tbl_carModelProduct.Where(a => a.tbl_carModel != null).FirstOrDefault().tbl_carModel.tbl_carBrand.name;
            helperItem.currency = "TL";
            helperItem.model = item.tbl_carModelProduct.Where(a => a.tbl_carModel != null).FirstOrDefault().tbl_carModel.name;
            helperItem.name = item.name;
            helperItem.shortDescription = item.shortDescription;
            helperItem.width = photoWidth;
            helperItem.height = photoHeight;

            if (item.tbl_gallery == null || item.tbl_gallery.Where(a => a.statu).Count() == 0)
            {
                helperItem.photo = "ImageShow/Resize/Gallery/" + "noPhoto.png" + "/" + photoWidth + "/" + photoHeight;
            }
            else
            {
                helperItem.photo = "ImageShow/ShowGuid/gallery/" + item.tbl_gallery.Where(a => a.statu).OrderBy(a => a.sequence).FirstOrDefault().guid + "/" + photoWidth + "/" + photoHeight;

            }

            decimal price = calcPriceProduct(item);
            helperItem.price = price.ToString("F2", currentCultureInfo);

            helperItem.url = langCode + "/" + productUrl + "/" + item.tbl_carModelProduct.FirstOrDefault().tbl_carModel.tbl_carBrand.url + "/" + item.tbl_carModelProduct.Where(a => a.tbl_carModel != null).FirstOrDefault().tbl_carModel.url + "/" + item.url + ".html";
            helperItem.productId = item.productId;

            var taxItem = getProductWithoutTaxPriceAndTaxPrice(item, currentCultureInfo);
            helperItem.withoutTaxPrice = taxItem.Item2;

            return helperItem;
        }
Ejemplo n.º 2
0
        public List<productSmall> getProductSummary(string productUrl, List<tbl_product> list, string langCulture, string langCode, string photoWidth, string photoHeight)
        {
            List<productSmall> helperList = new List<productSmall>();

            var currentCultureInfo = CultureInfo.CreateSpecificCulture(langCulture);

            foreach (var item in list)
            {
                productSmall helperItem = new productSmall();

                // Car Brand , Car Model  Validation
                if (item.tbl_carModelProduct == null || item.tbl_carModelProduct.Where(a => a.tbl_carModel != null).FirstOrDefault() == null || item.tbl_carModelProduct.Where(a => a.tbl_carModel != null).FirstOrDefault().tbl_carModel == null || item.tbl_carModelProduct.Where(a => a.tbl_carModel != null).FirstOrDefault().tbl_carModel.tbl_carBrand == null)
                {
                    continue;
                }

                helperItem = getProductSummaryOneItem(productUrl, item, currentCultureInfo, langCode, photoWidth, photoHeight);
                helperList.Add(helperItem);
            }

            return helperList;
        }