public string ReportPackager(int cropYear, DateTime reportDate, string shid, bool isActive, string fileName, string logoUrl, string pdfTempfolder, DateTime activityFromDate, DateTime activityToDate, bool isLienInfoWanted) { const string METHOD_NAME = "rptEquityStatement.ReportPackager: "; DirectoryInfo pdfDir = null; FileInfo[] pdfFiles = null; string filePath = ""; try { pdfDir = new DirectoryInfo(pdfTempfolder); // Build the output file name by getting a list of all PDF files // that begin with this session ID: use this as a name incrementer. pdfFiles = pdfDir.GetFiles(fileName + "*.pdf"); fileName += "_" + Convert.ToString(pdfFiles.Length + 1) + ".pdf"; filePath = pdfDir.FullName + @"\" + fileName; try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { if (String.IsNullOrEmpty(shid)) { shid = null; } using (SqlDataReader dr = WSCPayment.GetEquityStatement(conn, cropYear, shid, isActive, activityFromDate, activityToDate, isLienInfoWanted)) { using (System.IO.FileStream fs = new FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.Read)) { ReportBuilder(dr, cropYear, reportDate, logoUrl, fs); } } } } catch (System.Exception ex) { string errMsg = "cropYear: " + cropYear.ToString(); WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(METHOD_NAME + errMsg, ex); throw (wscEx); } return(filePath); } catch (System.Exception ex) { string errMsg = "cropYear: " + cropYear.ToString(); WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(METHOD_NAME + errMsg, ex); throw (wscEx); } }