public ActionResult ManagerRPTEXCELall(string startDate = "", string endDate="") { ManagerinfoEntity _Model = new ManagerinfoEntity(); _Model.StartDate = startDate; _Model.EndDate = endDate; ALLManagerrptEntity obj; ReportClass rptH = new ReportClass(); ArrayList al = new ArrayList(); rptH.FileName = Server.MapPath("/Reports/ALLManagerrpt.rpt"); rptH.Load(); DataTable dt = (DataTable)ExecuteDB(ERPTask.AG_GetManagerRecord, _Model); List<ManagerinfoEntity> ItemList = null; ItemList = new List<ManagerinfoEntity>(); foreach (DataRow dr in dt.Rows) { ItemList.Add(new ManagerinfoEntity() { PDate = dr["PDate"].ToString(), EMPID = dr["EMPID"].ToString(), EName = dr["EName"].ToString(), Designation = dr["Designation"].ToString(), DeptName = dr["DeptName"].ToString(), Intime = dr["Intime"].ToString(), Outtime = dr["Outtime"].ToString(), Status = dr["Status"].ToString(), }); } foreach (ManagerinfoEntity dr in ItemList) { obj = new ALLManagerrptEntity(); obj.PDate = dr.PDate; obj.EMPID = dr.EMPID; obj.EName = dr.EName; obj.Designation = dr.Designation; obj.DeptName = dr.DeptName; obj.Intime = dr.Intime; obj.Outtime = dr.Outtime; obj.Status = dr.Status; al.Add(obj); } rptH.SetDataSource(al); MemoryStream stream = (MemoryStream)rptH.ExportToStream(ExportFormatType.Excel); return File(stream, "application/octet-stream", "ManagerAttend.xls"); }
public ActionResult ALLManagerRPTEXCEL() { ALLManagerrptEntity obj; ReportClass rptH = new ReportClass(); ArrayList al = new ArrayList(); rptH.FileName = Server.MapPath("/Reports/ALLManagerrpt.rpt"); rptH.Load(); List<ManagerinfoEntity> ItemList = (List<ManagerinfoEntity>)Session["ALLMGR"]; foreach (ManagerinfoEntity dr in ItemList) { obj = new ALLManagerrptEntity(); obj.PDate = dr.PDate; obj.EMPID = dr.EMPID; obj.EName = dr.EName; obj.Designation = dr.Designation; obj.DeptName = dr.DeptName; obj.Intime = dr.Intime; obj.Outtime = dr.Outtime; obj.Status = dr.Status; al.Add(obj); } rptH.SetDataSource(al); MemoryStream stream = (MemoryStream)rptH.ExportToStream(ExportFormatType.Excel); return File(stream, "application/octet-stream", "ManagerAttend.xls"); }