protected void btnDelete_Click(object sender, EventArgs e) { if (OpenDropDownList.SelectedValue == string.Empty) { StatusLabel.Text = "There are no current issues!"; } else { CreateImages.DeleteImages(OpenDropDownList.SelectedValue); StatusLabel.Text = MagazineData.DeleteIssue(OpenDropDownList.SelectedValue); OpenDropDownList.DataBind(); Panel1.Visible = true; IssuePanel.Visible = false; } }
protected void btnUpdate_Click(object sender, EventArgs e) { if (FileUpload.HasFile) { UploadPdfFile(); } string[] pdfFiles = Directory.GetFiles(Server.MapPath("~/pdf")); string[] orgPdfFiles = Directory.GetFiles(Server.MapPath("~/content/" + OpenDropDownList.SelectedValue), "*.pdf"); if (pdfFiles.Length == 0) { File.Copy(orgPdfFiles[0], Server.MapPath("~/pdf/") + "temp.pdf"); } string[] jpgFiles = Directory.GetFiles(Server.MapPath("~/content/" + OpenDropDownList.SelectedValue), "*.jpg"); foreach (string file in jpgFiles) { File.Delete(file); } Issue newIssue = new Issue(); newIssue.IssueId = OpenDropDownList.SelectedValue; newIssue.IssueDirectory = ConfigurationManager.AppSettings["imagepath"] + OpenDropDownList.SelectedValue; newIssue.Resolution = ResolutionDropDownList.SelectedValue; newIssue.Quality = QualityTextBox.Text; newIssue.TextAntialiasing = TxtAliasingDropDownList.SelectedValue; newIssue.GraphicsAntialiasing = GraphAliasingDropDownList.SelectedValue; StatusLabel.Text = CreateImages.CreateImagesGhostScript(newIssue); string pdfpath = HttpContext.Current.Server.MapPath("~/pdf"); string sourcePDF = pdfpath + @"\temp.pdf"; string destinationPDF = newIssue.IssueDirectory + @"\" + newIssue.IssueId + ".pdf"; File.Copy(sourcePDF, destinationPDF, true); File.Delete(sourcePDF); MagazineData.UpdateIssue(newIssue); CreateXML.CreatePagesXMLFile(newIssue.IssueId); Panel1.Visible = true; btnPreview.Visible = true; RequiredFieldValidator4.Visible = false; }