예제 #1
0
        protected void BtnSaveGalleryImg_Click(object sender, EventArgs e)
        {
            ProductImages prodImgs = new ProductImages();
            prodImgs.AddNew();
            prodImgs.ProductID = productID;
            prodImgs.NameEn = txtProdImgName.Text;

            if (FileUploadProdGalleryImg.HasFile)
            {
                Bitmap UpImg = (Bitmap)Bitmap.FromStream(FileUploadProdGalleryImg.PostedFile.InputStream);
                string path = "UploadedFiles/Products/" + DateTime.Now.ToString("ddMMyyyyhhmmss") + FileUploadProdGalleryImg.FileName;
                UpImg.Save(MapPath(path), System.Drawing.Imaging.ImageFormat.Png);
                prodImgs.ImagePath = path;
            }
            prodImgs.Save();
            galleryBind();
        }
예제 #2
0
 protected void ProdImgsGallery_ItemCommand(object source, DataListCommandEventArgs e)
 {
     if (e.CommandName =="DelteImg")
     {
         ProductImages prodImgs = new ProductImages();
         prodImgs.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString()));
         prodImgs.MarkAsDeleted();
         prodImgs.Save();
         galleryBind();
     }
 }