protected void btnAddLayer_Click(object sender, EventArgs e) { Bitmap UpImg = (Bitmap)Bitmap.FromStream(LayerImgFileUpload.PostedFile.InputStream); string path = "UploadedFiles/References/" + DateTime.Now.ToString("ddMMyyyyhhmmss") + LayerImgFileUpload.FileName; UpImg.Save(MapPath(path), System.Drawing.Imaging.ImageFormat.Png); BLL.ReferenceImages NewLayer = new BLL.ReferenceImages(); NewLayer.AddNew(); NewLayer.ReferenceID = getCurrentReference; NewLayer.NameEn = txtImageName.Text; NewLayer.IsActive = true; NewLayer.ImagePath = path; NewLayer.Save(); LoadAllReferenceImages(); txtImageName.Text = ""; }
protected void ImgBtnDeleteLayer_Click(object sender, ImageClickEventArgs e) { ImageButton btn = (ImageButton)sender; int ID = int.Parse(btn.CommandArgument.ToString()); BLL.ReferenceImages DeleteLayer = new BLL.ReferenceImages(); DeleteLayer.LoadByPrimaryKey(ID); DeleteLayer.MarkAsDeleted(); DeleteLayer.Save(); LoadAllReferenceImages(); }