protected void InitalLoad() { Session.Remove("sLogs"); Session.Abandon(); Session.Clear(); BaseMethods oGet = new BaseMethods(); gvDocsToPDF.DataSource = oGet.GetJobs(); gvDocsToPDF.DataBind(); BindGrid(); ltLocalDir.Text = sTmpFolderPath; ltFolderDir.Text = oGet.GenerateRandomFolderName(); oGet = null; }
protected void btnGetPDFs_Click(object sender, EventArgs e) { if (IsPostBack){ string sDir = ""; string sTemp; List<ClientLogger> LogList = new List<ClientLogger>(); BaseMethods sFldr = new BaseMethods(); sDir = sFldr.GenerateRandomFolderName(); DirectoryInfo di = Directory.CreateDirectory(sTmpFolderPath + sDir); sTemp = sTmpFolderPath + sDir + "\\" ; foreach (GridViewRow rw in gvDocsToPDF.Rows) { if (rw.RowType == DataControlRowType.DataRow) { CheckBox cbPDF = new CheckBox(); cbPDF = (CheckBox)(rw.FindControl("cbSelect")); if (cbPDF.Checked) { string sVolume, sSection, sFileName, sFileURL; sVolume = rw.Cells[1].Text.ToString(); sSection = rw.Cells[2].Text.ToString(); sFileName = rw.Cells[3].Text.ToString(); sFileURL = rw.Cells[4].Text.ToString(); DirectoryInfo oCreate = Directory.CreateDirectory(sTemp + sVolume); BaseMethods oJob = new BaseMethods(); LogList.Add(oJob.GetPDFfromURLPDF(sFileURL, sTemp, sFileName, sVolume, sSection)); oJob = null; } } } Session["sLogs"] = LogList; Session["sDir"] = sDir; BaseMethods oJobr = new BaseMethods(); foreach (System.IO.DirectoryInfo g in di.GetDirectories()) { List<ClientLogger> PDFList = new List<ClientLogger>(); System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(g.FullName); foreach (System.IO.FileInfo f in dir.GetFiles("*.*")) { ClientLogger pdfLt = new ClientLogger(){ _sFile = f.Name, _sPath = f.DirectoryName, }; PDFList.Add(pdfLt); } oJobr.GetSinglePDFfromManyPDFs(PDFList, g.FullName, "_Vol.pdf"); } Response.Redirect("Processed.aspx"); } }