private void hienthiThongtinSanpham(long sanphamID)
        {
            SanphamController   BRLsanpham  = new SanphamController();
            List <SanphamModel> glstSanpham = BRLsanpham.SanphamGetbyPK(sanphamID);

            if (glstSanpham.Count < 1)
            {
                Response.Redirect("~/DanhsachSanpham.aspx");
            }
            int loaispID = glstSanpham[0].FK_iLoaiSanphamID;

            if (loaispID > 0)
            {
                List <LoaiSanphamModel> glstLoaiSanpham = BRLsanpham.LoaiSanphamGetbyPK(loaispID);
                if (glstSanpham.Count > 0)
                {
                    lblLoaiSanpham.Text = glstLoaiSanpham[0].sTenLoaiSanpham;
                }
            }
            imageSanpham.ImageUrl = string.Format("~/{0}", glstSanpham[0].sHinhanh);
            lblTenSanpham.Text    = glstSanpham[0].sTenSanpham;
            decimal giaDangapdung = BRLsanpham.GetGiaDangApdungByFKSanphamID(glstSanpham[0].PK_iSanphamID);

            if (giaDangapdung > 0)
            {
                lblGiaChuaKhuyenmai.Text = string.Format("{0:C0}", giaDangapdung);
            }
            else
            {
                lblGiaChuaKhuyenmai.Text = "Liên hệ";
            }
        }
 protected void rptSanpham_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         SanphamModel sanpham = e.Item.DataItem as SanphamModel;
         if (sanpham != null)
         {
             Image imgSanpham = e.Item.FindControl("imgSanpham") as Image;
             if (imgSanpham != null)
             {
                 imgSanpham.ImageUrl = string.Format("~/{0}", sanpham.sHinhanh);
             }
             Literal           ltrGiaDangApdung = e.Item.FindControl("ltrGiaDangApdung") as Literal;
             SanphamController brlSanpham       = new SanphamController();
             if (ltrGiaDangApdung != null)
             {
                 decimal giaDangApdung = brlSanpham.GetGiaDangApdungByFKSanphamID(sanpham.PK_iSanphamID);
                 ltrGiaDangApdung.Text = giaDangApdung < 0 ? "Liên hệ" : giaDangApdung.ToString("C0");
             }
             Literal ltrLoaiSanpham = e.Item.FindControl("ltrLoaiSanpham") as Literal;
             if (ltrLoaiSanpham != null)
             {
                 int loaiSanphamID = sanpham.FK_iLoaiSanphamID;
                 if (loaiSanphamID > 0)
                 {
                     List <LoaiSanphamModel> glstLoaisanpham = brlSanpham.LoaiSanphamGetbyPK(loaiSanphamID);
                     if (glstLoaisanpham.Count > 0)
                     {
                         ltrLoaiSanpham.Text = glstLoaisanpham[0].sTenLoaiSanpham;
                     }
                 }
             }
             Literal ltrKhuyenmaiDangApdung = e.Item.FindControl("ltrKhuyenmaiDangApdung") as Literal;
             if (ltrKhuyenmaiDangApdung != null)
             {
                 int khuyenmaiDangapdung = Convert.ToInt32(brlSanpham.GetKhuyenmaiDangApdungByFKSanphamID(sanpham.PK_iSanphamID) * 100);
                 ltrKhuyenmaiDangApdung.Text = khuyenmaiDangapdung < 0 ? string.Empty : string.Format("{0}%", khuyenmaiDangapdung);
             }
             HyperLink hrefDieuChinhgia = e.Item.FindControl("hrefDieuChinhgia") as HyperLink;
             if (hrefDieuChinhgia != null)
             {
                 hrefDieuChinhgia.NavigateUrl = string.Format("~/DieuchinhGia.aspx?gsp={0}", sanpham.PK_iSanphamID);
             }
             HyperLink hrefDieuChinhKhuyenmai = e.Item.FindControl("hrefDieuChinhKhuyenmai") as HyperLink;
             if (hrefDieuChinhKhuyenmai != null)
             {
                 hrefDieuChinhKhuyenmai.NavigateUrl = string.Format("~/DieuchinhKhuyenmai.aspx?kmsp={0}", sanpham.PK_iSanphamID);
             }
             HyperLink hrefCongthuc = e.Item.FindControl("hrefCongthuc") as HyperLink;
             if (hrefCongthuc != null)
             {
                 hrefCongthuc.NavigateUrl = string.Format("~/Congthuc.aspx?ctsp={0}", sanpham.PK_iSanphamID);
             }
         } //sanpham
     }     //ItemType
 }