コード例 #1
0
        protected void rptOrderDetail_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            OrderDetail orderDetail = (OrderDetail)e.Item.DataItem;

            if (orderDetail != null)
            {
                Label lbProductName = (Label)e.Item.FindControl("lbProductName");
                if (lbProductName != null && orderDetail.Product != null)
                {
                    lbProductName.Text = ToSQL.EmptyNull(orderDetail.Product.Name);
                }
                Image imgProduct = (Image)e.Item.FindControl("imgProduct");
                if (imgProduct != null)
                {
                    string image = (new ProductImageRepo()).GetImageDefaultAllByProductId(ToSQL.SQLToInt(orderDetail.Product_ID));
                    if (CheckFileShared.CheckImageExist(image))
                    {
                        imgProduct.ImageUrl = "~/Resources/ImagesProduct/" + image;
                    }
                    else
                    {
                        imgProduct.ImageUrl = "~/Resources/ImagesProduct/no-image.png";
                    }
                }
            }
        }
コード例 #2
0
 public string SetImage(string s)
 {
     if (CheckFileShared.CheckImageExist(ToSQL.EmptyNull(s)))
     {
         return("Resources/ImagesProduct/" + ToSQL.EmptyNull(s));
     }
     else
     {
         return("Resources/ImagesProduct/no-image.png");
     }
 }
コード例 #3
0
ファイル: WishList.aspx.cs プロジェクト: htphongqn/B2C_EC
        protected void rptProducts_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Image       img = (Image)e.Item.FindControl("imgProduct");
            HiddenField hdf = (HiddenField)e.Item.FindControl("hdfProductId");

            if (img != null && hdf != null)
            {
                string image = (new ProductImageRepo()).GetImageDefaultAllByProductId(ToSQL.SQLToInt(hdf.Value));
                if (CheckFileShared.CheckImageExist(image))
                {
                    img.ImageUrl = "~/Resources/ImagesProduct/" + image;
                }
                else
                {
                    img.ImageUrl = "~/Resources/ImagesProduct/no-image.png";
                }
            }
        }