123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.CommonLogic.EducationManagement;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.EducationManage;
- using Bowin.Common.Linq.Entity;
- using Bowin.Common.Utility;
- using EMIS.ViewModel.EducationManagement;
- using Bowin.Common.Data;
- using EMIS.CommonLogic.CalendarManage;
- using Bowin.Common.Exceptions;
- using Bowin.Common.JSON;
- using EMIS.ViewModel.UniversityManage.TeacherManage;
- using EMIS.CommonLogic.EducationManage;
- namespace EMIS.Web.Controllers.EducationManage
- {
- [Authorization]
- public class AdultEducationMissionClassController : Controller
- {
- public IAdultEducationMissionClassServices AdulteducationMissionClassServices { get; set; }
- public Lazy<IAdultEducationMissionClassServices> staffServices { get; set; }
- public EMIS.CommonLogic.EducationManagement.IEducationMissionClassServices EducationMissionClassServices { get;set; }
-
- public ISchoolYearServices schoolYearServices { get; set; }
-
- /// <summary>
- /// 教学任务页面(成教)
- /// </summary>
- /// <returns></returns>
- 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("SchoolyearDropdown");
- var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
- var campusID = pararms.getExtraGuid("CampusDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var CoursesTimeID = pararms.getExtraGuid("TimeComboGrid");
- var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- var learningformID = pararms.getExtraInt("LearningformDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("LearningformDictionaryDropDown");
- var education = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
- var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
- var gradeYearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
- 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 LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
- var result = AdulteducationMissionClassServices.GetEducationMissionClassViewGrid(configuretView, campusID, collegeID, schoolyearID, standardID, coursematerialID, approvalStatus, teachingMode, classmajorID, gradeYearID, CoursesTimeID,learningformID,education,LearnSystem, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- /// <summary>
- /// 教学安排
- /// </summary>
- /// <param name="educationMissionClassView"></param>
- /// <returns></returns>
- public ActionResult Edit(Guid? educationMissionClassID)
- {
- EducationMissionImportClassView educationMissionClassView = new EducationMissionImportClassView();
- if (educationMissionClassID != null && educationMissionClassID != Guid.Empty)
- {
- educationMissionClassView = AdulteducationMissionClassServices.GetEducationMissionClassView(educationMissionClassID);
- if (educationMissionClassView != null)
- {
- var schoolYear = schoolYearServices.GetSchoolYear(educationMissionClassView.SchoolyearID);
- List<ListControlItem> lct = new List<ListControlItem>();
- if (schoolYear != null)
- {
- for (int i = 1; i <= schoolYear.WeeksNum; i++)
- {
- ListControlItem lt = new ListControlItem { Text = "第" + i + "周", Value = i, IsSelected = true };
- lct.Add(lt);
- }
- }
- ViewData["lct"] = lct;
- }
- }
- return View(educationMissionClassView);
- }
- /// <summary>
- /// 修改
- /// </summary>
- /// <param name="educationMissionClassView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(EducationMissionClassView educationMissionClassView)
- {
- try
- {
- List<int?> list = new List<int?>();
- var listWeekNum = Request.Form["WeekNum"];
- if (listWeekNum != null)
- {
- for (int i = 0; i < listWeekNum.Split(',').Length; i++)
- {
- if (!string.IsNullOrEmpty(listWeekNum.Split(',')[i]))
- {
- int teachingModeID = Convert.ToInt32(listWeekNum.Split(',')[i]);
- list.Add(teachingModeID);
- }
- }
- }
- var teacherList = DataGrid.GetTableData<EducationMissionClassTeacherListView>("dgTeacherList");
- EducationMissionClassServices.EducationMissionClassUpdate(educationMissionClassView, list, teacherList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="educationMissionClassIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult EducationMissionClassUpdate(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);
- }
- }
- AdulteducationMissionClassServices.EducationMissionClassUpdate(list);
- return Json("成功");
- }
- catch (Exception ex)
- {
- return Json("提交失败,原因:" + ex.Message);
- }
- }
- /// <summary>
- /// 撤销提交
- /// </summary>
- /// <param name="educationMissionClassIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult UnSubmit(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);
- }
- }
- EducationMissionClassServices.UnSubmit(list);
- return Json("撤销成功。");
- }
- catch (Exception ex)
- {
- return Json("撤销失败,原因:" + ex.Message);
- }
- }
- [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);
- }
- }
- EducationMissionClassServices.Delete(list);
- return Json(new ReturnMessage { IsSuccess = true });
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- if (num != null)
- {
- if (num.Number == 547)
- mge = "请先删除所有关联的数据,排课课表,学生成绩,教学评价等";
- }
- return Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + mge });
- }
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["SchoolyearDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
- var gradeYearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
- var approvalStatus = Request.Form["ApprovalStatusDropdownList"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ApprovalStatusDropdownList"].ParseStrTo<int>();
- var teachingMode = Request.Form["DictionaryTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo<int>();
- var learningformID = Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>();
- var education = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
- var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
- var dt = AdulteducationMissionClassServices.GetEducationMissionClassViewList(configuretView, campusID, collegeID, schoolyearID, standardID, coursematerialID, approvalStatus, teachingMode, classmajorID, gradeYearID, learningformID, education, LearnSystem)
- .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.SchedulingClassNum,
- x.ClassNum,
- x.TeacherName,
- x.ApprovalStatusName
- }).ToTable();
- string[] liststring = { "排课序号", "任务班名称","课程代码", "课程名称", "教研室", "教室类型",
- "执行周次", "总学时", "执行学时", "班级人数","授课老师", "状态" };
- neh.Export(dt, liststring, "教学任务班基础信息");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功!"
- });
- }
- /// <summary>
- /// 批量修改课时类别
- /// </summary>
- public ActionResult BatchUpdate(string educationMissionClassStr)
- {
- EducationMissionClassView educationMissionClassView = new EducationMissionClassView();
- if (!educationMissionClassStr.IsEmpty())
- {
- educationMissionClassView.EducationMissionClassStr = educationMissionClassStr;
- }
- return View(educationMissionClassView);
- }
- /// <summary>
- /// 批量修改课时类别
- /// </summary>
- [HttpPost]
- public ActionResult BatchUpdate(EducationMissionClassView educationMissionClassView)
- {
- try
- {
- List<Guid?> educationMissionClassid = educationMissionClassView.EducationMissionClassStr.SplitIDString();
- AdulteducationMissionClassServices.BatchModifyCoursesTime(educationMissionClassid, educationMissionClassView.CourseTimeID, educationMissionClassView.ClassroomTypeID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "修改成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "修改失败,原因:" + ex.Message
- });
- }
- }
- }
- }
|