using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.CommonLogic.CalendarManage;
using EMIS.ViewModel;
using EMIS.Web.Controls;
using Bowin.Web.Controls.Mvc;
using EMIS.CommonLogic.EducationSchedule;
using Bowin.Common.Utility;
using Bowin.Common.Exceptions;
using Bowin.Common.Data;
using EMIS.CommonLogic.Report;
namespace EMIS.Web.Controllers.EducationSchedule
{
[Authorization]
public class EducationSchedulingReportController : Controller
{
public ISchoolYearServices SchoolYearServices { get; set; }
public INewReportServices NewReportServices { get; set; }
public IRealtimeServices IRealtimeServices { get; set; }
//
// GET: /EducationReport/
public ActionResult ClassmajorReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult GrademajorReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult TeacherReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult ClassroomReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult DepartmentReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult ClassmajorPrintingReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult TeacherPrintingReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult ClassroomPrintingReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult BuildingReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult CollegeClassmajorFullReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult BuildingFullReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult CollegeTeacherFullReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult CollegeMissionClassTeacherFullReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult TeacherCollegeReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult StudentReport()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
public ActionResult UserReport()
{
return View();
}
public ActionResult MyReport()
{
return View();
}
///
/// 实时课表查询
///
///
public ActionResult Realtime()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
///
/// 实时课表列表查询
///
///
///
[HttpPost]
public ActionResult Realtime(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("SchoolyearDropdownList");
var collegeID = pararms.getExtraGuid("ComboGridCollege");
var openCollegeID = pararms.getExtraGuid("ComboGridOpenCollege");
var WeekNum = pararms.getExtraInt("ddlWeekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlWeekNum"); ;
var WeekDay = pararms.getExtraInt("WeekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("WeekDay"); ;
var Times = pararms.getExtraGuid("Times");
var ClassroomID = pararms.getExtraGuid("ClassroomID");
var result = IRealtimeServices.GetEducationMissionClassScheduleViewGrid(configuretView, collegeID, openCollegeID, schoolyearID, WeekNum, WeekDay, Times, ClassroomID, (int)pararms.page, (int)pararms.rows);
return Json(result);
}
///
/// 实时课表查询广体
///
///
public ActionResult RealtimeGT()
{
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
return View();
}
///
/// 实时课表列表查询广体
///
///
///
[HttpPost]
public ActionResult RealtimeGT(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("SchoolyearDropdownList");
var collegeID = pararms.getExtraGuid("ComboGridCollege");
var openCollegeID = pararms.getExtraGuid("ComboGridOpenCollege");
var WeekNum = pararms.getExtraInt("ddlWeekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlWeekNum"); ;
var WeekDay = pararms.getExtraInt("WeekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("WeekDay"); ;
var Times = pararms.getExtraGuid("Times");
var ClassroomID = pararms.getExtraGuid("ClassroomID");
var result = IRealtimeServices.GetEducationMissionClassScheduleViewGridGT(configuretView, collegeID, openCollegeID, schoolyearID, WeekNum, WeekDay, Times, ClassroomID, (int)pararms.page, (int)pararms.rows);
return Json(result);
}
///
/// Excel导出
///
///
[HttpPost]
public ActionResult Excel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
//var EducationMissionClassID = Request.Form["EducationMissionClassID"];
var schoolyearID = Request.Form["SchoolyearDropdownList"].ParseStrTo();
var collegeID = Request.Form["ComboGridCollege"].ParseStrTo();
var openCollegeID = Request.Form["ComboGridOpenCollege"].ParseStrTo();
var WeekNum = Request.Form["ddlWeekNum"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlWeekNum"].ParseStrTo();
var WeekDay = Request.Form["WeekDay"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["WeekDay"].ParseStrTo();
var Times = Request.Form["Times"].ParseStrTo();
var ClassroomID = Request.Form["ClassroomID"].ParseStrTo();
List EducationMissionClassList = new List();
var CoursesTimeID = Request.Form["TimeComboGrid"].ParseStrTo();
//if (EducationMissionClassID != "")
//{
// EducationMissionClassList = EducationMissionClassID.SplitIDString();
//}
//else
//{
// EducationMissionClassList = null;
//}
var dt = IRealtimeServices.GetEducationMissionClassScheduleViewGridForExcel(configuretView, collegeID, openCollegeID, schoolyearID, WeekNum, WeekDay, Times, ClassroomID).Select(x => new
{
x.ClassroomName,
x.WeekNum,
x.WeekdayName,
x.Times,
x.TimesHoure,
x.TeacherName,
x.Name,
x.OpenCollegeName,
x.CollegeName,
x.ClassNum
}).ToTable();
string[] liststring = {
"教室名称", "上课周次", "星期", "上课节次", "上课时间", "授课老师",
"任务班名称", @EMIS.Utility.RSL.Get("CourseCollege"), @EMIS.Utility.RSL.Get("College"), "人数"
};
neh.Export(dt, liststring, "实时课表信息" + DateTime.Now.ToString("yyyyMMdd"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
public ActionResult TeacherselfSchedulingPDF(Guid SchoolyearID, Guid? UserID)
{
var pdf = NewReportServices.TeacherselfSchedulingPDF(SchoolyearID, UserID);
return File(pdf.ToArray(), "application/pdf");
}
public ActionResult StudentForTeacherSchedulingPDF(Guid SchoolyearID, Guid StudentNo)
{
var pdf = NewReportServices.StudentForTeacherSchedulingPDF(SchoolyearID, StudentNo);
return File(pdf.ToArray(), "application/pdf");
}
public ActionResult ClassmajorSchedulingPDF(Guid SchoolyearID, Guid? CollegeID, Guid? ClassmajorID, int? Years)
{
var pdf = NewReportServices.ClassmajorSchedulingPDF(SchoolyearID, CollegeID, ClassmajorID, Years);
return File(pdf.ToArray(), "application/pdf");
}
public ActionResult ClassmajorPrintingSchedulingPDF(Guid SchoolyearID, Guid? CollegeID)
{
var pdf = NewReportServices.ClassmajorPrintingSchedulingPDF(SchoolyearID, CollegeID);
return File(pdf.ToArray(), "application/pdf");
}
public ActionResult TeacherSchedulingPDF(Guid SchoolyearID, Guid? CollegeID, Guid? UserID)
{
var pdf = NewReportServices.TeacherSchedulingPDF(SchoolyearID, CollegeID, UserID);
return File(pdf.ToArray(), "application/pdf");
}
public ActionResult TeacherPrintSchedulingPDF(Guid SchoolyearID, Guid? CollegeID)
{
var pdf = NewReportServices.TeacherPrintingSchedulingPDF(SchoolyearID, CollegeID);
return File(pdf.ToArray(), "application/pdf");
}
public ActionResult ClassroomReportPDF(Guid SchoolyearID, Guid? BuildingsInfoID, Guid? ClassroomID)
{
var pdf = NewReportServices.ClassroomReportPDF(SchoolyearID, BuildingsInfoID, ClassroomID);
return File(pdf.ToArray(), "application/pdf");
}
public ActionResult ClassroomPrintReportPDF(Guid SchoolyearID, Guid? BuildingsInfoID)
{
var pdf = NewReportServices.ClassroomPrintingReportPDF(SchoolyearID, BuildingsInfoID);
return File(pdf.ToArray(), "application/pdf");
}
public ActionResult DepartmentSchedulingPDF(Guid SchoolyearID, Guid CollegeID, Guid DepartmentID, Guid? HandleModeID)
{
var pdf = NewReportServices.DepartmentSchedulingPDF(SchoolyearID, CollegeID, DepartmentID, HandleModeID);
return File(pdf.ToArray(), "application/pdf");
}
public ActionResult CollegeSchedulingPDF(Guid SchoolyearID, Guid? CollegeID, int? Years)
{
var pdf = NewReportServices.CollegeSchedulingPDF(SchoolyearID, CollegeID, Years);
return File(pdf.ToArray(), "application/pdf");
}
}
}