Exemplo n.º 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();
        }
Exemplo n.º 2
0
        private void galleryBind()
        {
            ProductImages prodImgs = new ProductImages();
            prodImgs.Where.ProductID.Value = productID;
            prodImgs.Where.ProductID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            prodImgs.Query.Load();

            ProdImgsGallery.DataSource = prodImgs.DefaultView;
            ProdImgsGallery.DataBind();
        }
Exemplo n.º 3
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();
     }
 }