Пример #1
0
        private void BindData(List <DTO.Product> lst)
        {
            List <DTO.Manufacturer> lstManu   = Product_BUS.GetAllManufacturer();
            List <DTO.Origin>       lstOrigin = Product_BUS.GetAllOrigin();
            var obj = lst.Select((item, index) =>
            {
                return(new
                {
                    ProductID = item.ProductID,
                    ProductName = item.ProductName,
                    Price = item.Price.ToString("0,0", CultureInfo.CurrentCulture),
                    Summary = HttpUtility.UrlDecode(item.Summary),
                    ManufacturerName = Product_BUS.GetManufacturerName(item.ManufacturerID, lstManu),
                    OriginName = Product_BUS.GetOriginName(item.OriginID, lstOrigin),
                    Quantity = item.Quantity.ToString("0,0", CultureInfo.CurrentCulture),
                    Image = "../../Img/images/" + (string.IsNullOrEmpty(item.Image) ? "noimg.png" : item.Image),
                    LinkEdit = "ProductDetail.aspx?productID=" + item.ProductID,
                    LinkSale = "ProductSale.aspx?productID=" + item.ProductID,
                    LinkGift = "ProductGift.aspx?productID=" + item.ProductID,
                    LinkDelete = "ProductDelete.aspx?productID=" + item.ProductID,
                    FnDelete = "DeleteProduct('" + item.ProductID.ToString().Trim() + "', '" + item.ProductName.ToString() + "')",
                    Rate = new Product_BUS().GetRateString(item.ProductID),
                    Sale = !item.IsSale ? "Không có khuyến mại" : "Khuyến mại: Giảm " + item.AmountSale.ToString("0,0", CultureInfo.CurrentCulture)
                           + " đ khi mua từ " + item.QuantitySale + " sp trở lên",
                    CategoryInfo = GetCategoriesOfProduct(item.ProductID)
                });
            });

            DataList1.DataSource = obj;
            DataList1.DataBind();
        }
Пример #2
0
        private string GetProductInfo()
        {
            List <Manufacturer> lstManu   = CommonBUS.GetAllManufacturer();
            List <Origin>       lstOrigin = CommonBUS.GetAllOrigin();
            string info = "";

            info += "Tên sản phẩm: <b>" + product.ProductName + "</b><br>";
            info += "<br>Nhà SX: <b>" + Product_BUS.GetManufacturerName(product.ManufacturerID, lstManu) + "</b><br>";
            info += "<br>Xuất xứ: <b>" + Product_BUS.GetOriginName(product.OriginID, lstOrigin) + "</b><br>";
            info += "<br>Giá bán: <b>" + product.Price.ToString("0,0", CultureInfo.CurrentCulture) + "đ</b><br>";

            return(info);
        }