protected void generateLTFUExcell(string reportingdatefrom, string reportingdateto) { ReportingResultsManager reportingLogic = new ReportingResultsManager(); DataTable dt = reportingLogic.getltfu(Convert.ToDateTime(reportingdatefrom), Convert.ToDateTime(reportingdateto)); //IQWebUtils theUtils = new IQWebUtils(); //theUtils.ExporttoExcel(dt, Response); using (XLWorkbook wb = new XLWorkbook()) { String timeStamp = GetTimestamp(DateTime.Now); var ws = wb.Worksheets.Add(dt, "ltfu"); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.Charset = ""; HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + "LTFU" + timeStamp + ".xlsx"); using (MemoryStream MyMemoryStream = new MemoryStream()) { wb.SaveAs(MyMemoryStream); MyMemoryStream.WriteTo(HttpContext.Current.Response.OutputStream); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); } } }
public int getltfu(string fromdate, string todate) { ReportingResultsManager reportingLogic = new ReportingResultsManager(); int ltfu = 0; DataTable theDT = reportingLogic.getltfu(Convert.ToDateTime(fromdate), Convert.ToDateTime(todate)); ltfu = theDT.Rows.Count; return(ltfu); }
public ArrayList getltfull(string fromdate, string todate) { ReportingResultsManager reportingLogic = new ReportingResultsManager(); DataTable theDT = reportingLogic.getltfu(Convert.ToDateTime(fromdate), Convert.ToDateTime(todate)); ArrayList rows = new ArrayList(); int n = 0; foreach (DataRow items in theDT.Rows) { string[] i = new string[13] { n.ToString(), items["CCCNumber"].ToString(), items["FirstName"].ToString(), items["MiddleName"].ToString(), items["LastName"].ToString(), items["MobileNumber"].ToString(), Convert.ToDateTime(items["DispenseDate"]).ToString("dd-MMM-yyyy"), items["Drug"].ToString(), Convert.ToDateTime(items["ExpectedReturn"]).ToString("dd-MMM-yyyy"), items["DaysOverDue"].ToString(), items["Traced"].ToString(), items["PID"].ToString(), items["personid"].ToString() }; rows.Add(i); } return(rows); }