Exemplo n.º 1
0
        protected void ibtnPublicationsRemoveFile_Click(object sender, EventArgs e)
        {
            int  FileID  = 0;
            bool success = false;

            success = int.TryParse(((ImageButton)sender).CommandArgument, out FileID);

            if (success)
            {
                File fileToDelete = FileBLL.GetByID(FileID);

                using (var ts = new TransactionScope())
                {
                    FileBLL.DeletePDF(fileToDelete);

                    //Update the current application
                    Application application = selectedApplication;

                    application.Files.Remove(fileToDelete);

                    ApplicationBLL.EnsurePersistent(application);

                    ts.CommitTransaction();
                }
            }

            rptPublications.DataSource = GetFilesOfType(STR_Publication);
            rptPublications.DataBind();
        }