123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- using Bowin.Common.Utility;
- using Bowin.Web.Controls.Mvc;
- using EMIS.CommonLogic.EducationManagement;
- using EMIS.CommonLogic.EducationSchedule;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Common.Data;
- using EMIS.CommonLogic.CalendarManage;
- namespace EMIS.Web.Controllers.EducationSchedule
- {
- [Authorization]
- public class EducationMissionClassScheduleController : Controller
- {
- public ISchoolYearServices SchoolYearServices { get; set; }
- //任务班排课
- #region 0.0--定义--
- public IEducationMissionClassScheduleServices educationMissionClassScheduleServices { get; set; }
- #endregion
- #region 1.0 任务班排课列表数据加载
- public ActionResult List()
- {
- var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
- ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
- return View();
- }
- /// <summary>
- /// 查询任务班排课列表
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("SchoolyearDropdownList");
- var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
- var campusID = pararms.getExtraGuid("ComboGridCampus");
- var collegeID = pararms.getExtraGuid("ComboGridCollege");
- var StandardID = pararms.getExtraInt("DictionaryStandard");
- var departmentID = pararms.getExtraGuid("DepartmentDropdown");
- var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
- var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
- var approvalStatus = pararms.getExtraInt("ApprovalStatusDropdownList") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ApprovalStatusDropdownList");
- var teachingMode = pararms.getExtraInt("DictionaryTeachingMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMode");
- var result = educationMissionClassScheduleServices.GetEducationMissionClassScheduleViewGrid(configuretView, campusID, collegeID, schoolyearID, departmentID, coursematerialID, approvalStatus, teachingMode, grademajorID, gradeYearID, StandardID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- #endregion
- #region 2.0 Excel导出
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var campusID = Request.Form["ComboGridCampus"].ParseStrTo<Guid>();
- var collegeID = Request.Form["ComboGridCollege"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
- var grademajorID = Request.Form["GrademajorComboGrid"].ParseStrTo<Guid>();
- var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
- var schoolyearID = Request.Form["SchoolyearDropdownList"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDropdownList"].ParseStrTo<Guid>();
- var approvalStatus = Request.Form["ApprovalStatusDropdownList"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ApprovalStatusDropdownList"].ParseStrTo<int>();
- var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo<int>();
- var dt = educationMissionClassScheduleServices.GetEducationMissionClassScheduleViewList(configuretView, campusID, collegeID, schoolyearID, null, coursematerialID,
- approvalStatus, teachingModeID, grademajorID, gradeYearID).Select(x => new
- {
- x.OrderNo,
- x.Name,
- // x.SchoolyearCode,
- x.CourseCode,
- x.CourseName,
- x.DepartmentName,
- // x.CollegeName,
- x.ClassroomTypeName,
- x.StartStopWeeklyNum,
- x.Totalhours,
- x.CourseProcessTimes,
- x.ScheduledTimes,
- //x.SchedulingClassNum,
- x.ClassNum,
- x.TeacherName,
- x.ApprovalStatusName
- }).ToTable();
- string[] liststring = { "排课序号", "任务班名称","课程代码", "课程名称", "教研室", "教室类型",
- "执行周次", "总学时", "执行学时","已排学时", "班级人数","授课老师", "状态" };
- neh.Export(dt, liststring, "教学任务班基础信息");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功!"
- });
- }
- #endregion
- #region 3.0 删除排课信息
- [HttpPost]
- public ActionResult Delete(string educationMissionClassIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- var educationMissionClassArray = educationMissionClassIDs.Split(',');
- for (int i = 0; i < educationMissionClassArray.Length; i++)
- {
- if (!string.IsNullOrEmpty(educationMissionClassArray[i]))
- {
- Guid? educationMissionClassID = new Guid(educationMissionClassArray[i]);
- list.Add(educationMissionClassID);
- }
- }
- educationMissionClassScheduleServices.Delete(list);
- return Json(new ReturnMessage { IsSuccess = true, Message = "撤销成功 " });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "撤销失败:" + ex.Message });
- }
- }
- #endregion
- }
- }
|