Example #1
0
        protected void dlImages_EditCommand(object source, DataListCommandEventArgs e)
        {
            // xóa ảnh
            Label         lblid   = (Label)e.Item.FindControl("lbl_ID");
            Label         lblURL  = (Label)e.Item.FindControl("lbl_URL");
            int           ImageID = int.Parse(lblid.Text);
            ImageFilesDAL obj     = new ImageFilesDAL();

            try
            {
                string strRootPathVirtual = System.Configuration.ConfigurationManager.AppSettings["UploadPathBDT"] + lblURL.Text;
                string savepath           = Server.MapPath(strRootPathVirtual);
                if (File.Exists(savepath))
                {
                    File.Delete(savepath);
                }
            }
            catch {; }
            obj.Delete_Image(ImageID);
            ListImages();
        }
Example #2
0
        protected void dlImages_EditCommand(object source, DataListCommandEventArgs e)
        {
            // xóa ảnh
            Label         lblid   = (Label)e.Item.FindControl("lbl_ID");
            Label         lblURL  = (Label)e.Item.FindControl("lbl_URL");
            int           ImageID = int.Parse(lblid.Text);
            ImageFilesDAL obj     = new ImageFilesDAL();

            try
            {
                string strRootPathVirtual = System.Configuration.ConfigurationManager.AppSettings["UploadPathBDT"] + lblURL.Text;
                string savepath           = Server.MapPath(strRootPathVirtual);
                if (File.Exists(savepath))
                {
                    File.Delete(savepath);
                    WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Xóa ảnh]", Convert.ToInt32(Request["Menu_ID"]).ToString(), "[Xóa ảnh] [Thao tác xóa ảnh trên server: " + lblURL.Text + "]", 0, ConstAction.BaoDT);
                }
            }
            catch {; }
            obj.Delete_Image(ImageID);
            ListImages();
        }