public ActionResult ExportReport8(string studentsexport, string durationexport, string monthexport, string yearexport) { DateTime startdate = DateTime.Now; DateTime enddate = DateTime.Now; if (durationexport == "a-month") { startdate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport), 1); enddate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport), DateTime.DaysInMonth(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport))); } else if (durationexport == "a-quarter") { startdate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport), 1); enddate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport) + 2, DateTime.DaysInMonth(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport) + 2)); } else if (durationexport == "a-year") { startdate = new DateTime(Convert.ToInt32(yearexport), 1, 1); enddate = new DateTime(Convert.ToInt32(yearexport), 12, 31); } else if (durationexport == "a-year-to-date") { startdate = DateTime.Now.AddYears(-1); enddate = DateTime.Now; } var model = _webClient.DownloadData <List <Report8Export> >("getreport8export", new { StartDate = startdate, EndDate = enddate, StudentIds = studentsexport, UserId = _authService.CurrentUserData.UserId }); var _exportManager = new Services.ExportImport.ExportManager(); var bytes = _exportManager.ExportReport8ToXlsx(model); string TextXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return(File(bytes, TextXlsx, "Report8.xlsx")); }
public ActionResult ExportReport4(string subsectionexport, string languageexport, string durationexport, string cityexport, string monthexport, string yearexport, string publisherexport) { DateTime startdate = DateTime.Now; DateTime enddate = DateTime.Now; if (durationexport == "a-month") { startdate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport), 1); enddate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport), DateTime.DaysInMonth(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport))); } else if (durationexport == "a-quarter") { startdate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport), 1); enddate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport) + 2, DateTime.DaysInMonth(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport) + 2)); } else if (durationexport == "a-year") { startdate = new DateTime(Convert.ToInt32(yearexport), 1, 1); enddate = new DateTime(Convert.ToInt32(yearexport), 12, 31); } else if (durationexport == "a-year-to-date") { startdate = DateTime.Now.AddYears(-1); enddate = DateTime.Now; } var model = _webClient.DownloadData <List <Report3Export> >("getreport4export", new { StartDate = startdate, EndDate = enddate, LanguageIds = languageexport, SubsectionIds = subsectionexport, Publisher = publisherexport, City = cityexport }); var _exportManager = new Services.ExportImport.ExportManager(); var bytes = _exportManager.ExportReport4ToXlsx(model); string TextXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return(File(bytes, TextXlsx, "Report4.xlsx")); }
public ActionResult ExportReport5(string gradeexport, string durationexport, string cityexport, string monthexport, string yearexport, int schoolexport) { DateTime startdate = DateTime.Now; DateTime enddate = DateTime.Now; if (durationexport == "a-month") { startdate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport), 1); enddate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport), DateTime.DaysInMonth(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport))); } else if (durationexport == "a-quarter") { startdate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport), 1); enddate = new DateTime(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport) + 2, DateTime.DaysInMonth(Convert.ToInt32(yearexport), Convert.ToInt32(monthexport) + 2)); } else if (durationexport == "a-year") { startdate = new DateTime(Convert.ToInt32(yearexport), 1, 1); enddate = new DateTime(Convert.ToInt32(yearexport), 12, 31); } else if (durationexport == "a-year-to-date") { startdate = DateTime.Now.AddYears(-1); enddate = DateTime.Now; } var model = _webClient.DownloadData <List <Report5Export> >("getreport5export", new { StartDate = startdate, EndDate = enddate, GradeIds = gradeexport, SchoolId = schoolexport }); var _exportManager = new Services.ExportImport.ExportManager(); var bytes = _exportManager.ExportReport5ToXlsx(model.Skip(0).Take(1), model.Skip(1).Take(1)); string TextXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return(File(bytes, TextXlsx, "Report5.xlsx")); }
public ActionResult ExportElibraryAdminstoExcel() { var model = _webClient.DownloadData <APIPagedList <UserRegistrationModel> >("getelibraryadminslist", new { PageIndex = 1, PageSize = int.MaxValue, SearchText = "" }); var _exportManager = new Services.ExportImport.ExportManager(); foreach (UserRegistrationModel elibadmin in model.Items) { if (!(elibadmin.Status) && elibadmin.IsTrashed) { elibadmin.Result = "Disabled"; } else if (elibadmin.Status && !(elibadmin.IsTrashed) && (elibadmin.LastLoginDate) != null) { elibadmin.Result = "ACTIVE"; } else if (elibadmin.Status && !(elibadmin.IsTrashed) && (elibadmin.LastLoginDate) == null) { elibadmin.Result = "REGISTERED"; } else if (!elibadmin.Status && !elibadmin.IsTrashed && (elibadmin.LastLoginDate) == null) { elibadmin.Result = "CREATED"; } } var bytes = _exportManager.ExportElibraryAdminsToXlsx(model.Items); string TextXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return(File(bytes, TextXlsx, "elibraryadmins.xlsx")); }
public ActionResult ExportSchoolStudentstoExcel(string schooluid_ofstudents) { var model = _webClient.DownloadData <APIPagedList <StudentRegistrationModel> >("getstudentsofschool", new { PageIndex = 1, PageSize = int.MaxValue, SchoolUId = schooluid_ofstudents, Grade = "" }); var _exportManager = new Services.ExportImport.ExportManager(); foreach (StudentRegistrationModel student in model.Items) { if (!(student.Status) && student.IsTrashed) { student.Result = "Disabled"; } else if (student.Status && !(student.IsTrashed) && (student.LastLoginDate) != null) { student.Result = "ACTIVE"; } else if (student.Status && !(student.IsTrashed) && (student.LastLoginDate) == null) { student.Result = "REGISTERED"; } else if (!student.Status && !student.IsTrashed && (student.LastLoginDate) == null) { student.Result = "CREATED"; } } var bytes = _exportManager.ExportSchoolStudentsToXlsx(model.Items); string TextXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return(File(bytes, TextXlsx, "schoolstudent.xlsx")); }
public ActionResult ExportSelectedBookstoExcel(string selectedSubSectionIds_export = "", string selectedLanguageIds_export = "", string selectedBookTypeIds_export = "", bool HasActivity_export = false, bool HasAnimation_export = false, bool HasReadAloud_export = false) { var model = _webClient.DownloadData <List <ExportBook> >("getbookslistforexport", new { SubSection = selectedSubSectionIds_export, Language = selectedLanguageIds_export, BookType = selectedBookTypeIds_export, HasActivity = HasActivity_export, HasAnimation = HasAnimation_export, HasReadAloud = HasReadAloud_export }); var _exportManager = new Services.ExportImport.ExportManager(); var bytes = _exportManager.ExportBooksToXlsx(model); string TextXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return(File(bytes, TextXlsx, "books.xlsx")); }
public ActionResult ExportReport6(string SubSectionIds = "", string LanguageIds = "") { var model = _webClient.DownloadData <List <Book> >("getreport6forexport", new { SubsectionIds = SubSectionIds, LanguageIds = LanguageIds }); var _exportManager = new Services.ExportImport.ExportManager(); var bytes = _exportManager.ExportReport6ToXlsx(model); string TextXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return(File(bytes, TextXlsx, "Report6.xlsx")); }
public ActionResult ExportReport1(string SchoolIdsExport = "", string UserTypesExport = "", string type = "all") { List <StudentRegistrationModel> model = new List <StudentRegistrationModel>(); if (type == "all") { var apimodel = _webClient.DownloadData <RegistrationAndLoginResult>("getregistrationandloginreport", new { UserType = UserTypesExport, SchoolIds = SchoolIdsExport, PageSize = int.MaxValue, PageIndex = 1 }); model.InsertRange(0, apimodel.Created.Items); model.InsertRange(0, apimodel.Registered.Items); model.InsertRange(0, apimodel.Active.Items); } else { var apimodel = _webClient.DownloadData <APIPagedList <StudentRegistrationModel> >("getregistrationandloginreportlist", new { UserType = UserTypesExport, SchoolIds = SchoolIdsExport, PageSize = int.MaxValue, PageIndex = 1, Type = type }); model = apimodel.Items; } var _exportManager = new Services.ExportImport.ExportManager(); var bytes = _exportManager.ExportReport1ToXlsx(model); string TextXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return(File(bytes, TextXlsx, "Report1.xlsx")); }
public ActionResult ExportReport1SchoolAdmin(string typeexport = "all") { List <StudentRegistrationModel> model = new List <StudentRegistrationModel>(); if (typeexport == "all") { var apimodel = _webClient.DownloadData <Report1SchoolAdminResult>("getreport1schooladmin", new { SchoolUId = _authService.CurrentUserData.SchoolUId, PageSize = int.MaxValue, PageIndex = 1, IsExport = true }); model.InsertRange(0, apimodel.Created.Items); model.InsertRange(0, apimodel.Registered.Items); model.InsertRange(0, apimodel.Active.Items); } else { var apimodel = _webClient.DownloadData <APIPagedList <StudentRegistrationModel> >("getreport1schooladminlist", new { SchoolUId = _authService.CurrentUserData.SchoolUId, PageSize = int.MaxValue, PageIndex = 1, Type = typeexport, Section = "export", GradeId = 0 }); model = apimodel.Items; } var _exportManager = new Services.ExportImport.ExportManager(); var bytes = _exportManager.ExportReport1ToXlsx(model); string TextXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return(File(bytes, TextXlsx, "Report1.xlsx")); }