123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Linq.Entity;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using Bowin.Common.Exceptions;
- using Bowin.Common.JSON;
- using EMIS.Web.Controls;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EducationManage;
- using EMIS.ViewModel.EducationManagement;
- using EMIS.ViewModel.UniversityManage.TeacherManage;
- using EMIS.CommonLogic.EducationManagement;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.Utility;
- using System.IO;
- namespace EMIS.Web.Controllers.TeachingManagement
- {
- [Authorization]
- public class EducationMissionClassController : Controller
- {
- public IEducationMissionClassServices educationMissionClassServices { get; set; }
- public Lazy<IEducationMissionClassServices> staffServices { get; set; }
- public ISchoolYearServices schoolYearServices { get; set; }
- public IParameterServices parameterServices { 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 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 result = educationMissionClassServices.GetEducationMissionClassViewGrid(configuretView, campusID, collegeID, schoolyearID, standardID, coursematerialID, approvalStatus, teachingMode, classmajorID, gradeYearID, CoursesTimeID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- /// <summary>
- /// 教学安排
- /// </summary>
- /// <param name="educationMissionClassView"></param>
- /// <returns></returns>
- public ActionResult Edit(Guid? educationMissionClassID)
- {
- EducationMissionClassView educationMissionClassView = new EducationMissionClassView();
- if (educationMissionClassID != null && educationMissionClassID != Guid.Empty)
- {
- educationMissionClassView = educationMissionClassServices.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>
- /// <returns></returns>
- public ActionResult EducationMissionClassConjunctionList()
- {
- return View();
- }
- /// <summary>
- /// 合班
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult EducationMissionClassConjunctionList(QueryParamsModel pararms)
- {
- var educationMissionClassIDs = pararms.getExtraString("hidEducationMissionClassIDs");
- var educationMissionClassIDList = educationMissionClassIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- var educationMissionClassList = educationMissionClassServices.GetEducationMissionClassViewList(educationMissionClassIDList);
- return Json(new GridResultSet<EducationMissionClassView> { rows = educationMissionClassList, total = educationMissionClassList.Count });
- }
- /// <summary>
- /// 排课分班
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- public ActionResult DivideIntoClassesEdit(Guid? educationMissionClassID)
- {
- DivideIntoClassesView divideIntoClassesView = new DivideIntoClassesView();
- if (educationMissionClassID != null && educationMissionClassID != Guid.Empty)
- divideIntoClassesView = educationMissionClassServices.GetDivideIntoClassesView(educationMissionClassID);
- divideIntoClassesView.OrderType = false;
- divideIntoClassesView.IsNotBuildEducationMission = true;
- return View(divideIntoClassesView);
- }
- /// <summary>
- /// 排课分班
- /// </summary>
- /// <param name="divideIntoClassesView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DivideIntoClassesEdit(DivideIntoClassesView divideIntoClassesView)
- {
- try
- {
- divideIntoClassesView.GroupNum = Convert.ToInt32(Request.Form["hid_GroupNum"]);
- divideIntoClassesView.StudentNum = Convert.ToInt32(Request.Form["hid_StudentNum"]);
- educationMissionClassServices.DivideIntoClassesAdd(divideIntoClassesView);
- 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>
- /// <param name="orderNos"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult TeachingScheduleEdit(string educationMissionClassIDs, string orderNos)
- {
- try
- {
- List<Guid?> listID = new List<Guid?>();
- List<int?> listNo = new List<int?>();
- for (int i = 0; i < educationMissionClassIDs.Split(',').Length; i++)
- {
- if (!string.IsNullOrEmpty(educationMissionClassIDs.Split(',')[i]))
- {
- Guid educationMissionClassID = new Guid(educationMissionClassIDs.Split(',')[i]);
- int orderNo = Convert.ToInt32(orderNos.Split(',')[i]);
- listID.Add(educationMissionClassID);
- listNo.Add(orderNo);
- }
- }
- educationMissionClassServices.UpdateEducationMissionClassOrderNo(listID, listNo);
- return Json("成功");
- }
- catch (Exception ex)
- {
- return Json("失败,原因:" + ex.Message);
- }
- }
- public ActionResult CourseProcessSummary()
- {
- var schoolYearView = schoolYearServices.GetSchoolYearIsCurrent(true);
- var schoolyear = schoolYearServices.GetSchoolYearViewListAfterCurrent().OrderBy(x => x.Value).Where(x => x.Value > schoolYearView.Value).FirstOrDefault();
- var ClassScheduleWeekTimeCount = parameterServices.GetParameterValue<int>(ViewModel.CF_ParameterType.ClassScheduleWeekTimeCount);
- ViewBag.SchoolYearID = schoolyear.SchoolYearID;
- ViewBag.ClassScheduleWeekTimeCount = ClassScheduleWeekTimeCount;
- return View();
- }
- [HttpPost]
- public ActionResult GetEducationMissionClassStatus()
- {
- //List<string> list = new List<string>();
- //list = educationMissionClassServices.GetEducationMissionClassStatus().Select(x => x.ToString()).ToList();
- var list = educationMissionClassServices.GetEducationMissionClassStatus();
- return base.Json(list);
- }
- public ActionResult CourseProcessClassroomList()
- {
- return View();
- }
- [HttpGet]
- public ActionResult EductionMissionClassStudentAdd()
- {
- return View();
- }
- [HttpPost]
- public ActionResult EductionMissionClassStudentDelete(Guid? educationMissionClassID, string userIDs)
- {
- try
- {
- List<Guid> list = new List<Guid>();
- for (int i = 0; i < userIDs.Split(',').Length; i++)
- {
- if (!string.IsNullOrEmpty(userIDs.Split(',')[i]))
- {
- Guid userID = new Guid(userIDs.Split(',')[i]);
- list.Add(userID);
- }
- }
- educationMissionClassServices.DeleteStudentbyEducationMissionClassID(educationMissionClassID, list);
- return Json("成功");
- }
- catch (Exception ex)
- {
- return Json("删除学生失败,原因:" + ex.Message);
- }
- }
- /// <summary>
- /// 添加学生
- /// </summary>
- /// <param name="finalExaminationID"></param>
- /// <param name="userIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult EductionMissionClassStudentAdd(Guid? educationMissionClassID, string userIDs)
- {
- try
- {
- List<Guid> list = new List<Guid>();
- for (int i = 0; i < userIDs.Split(',').Length; i++)
- {
- if (!string.IsNullOrEmpty(userIDs.Split(',')[i]))
- {
- Guid userID = new Guid(userIDs.Split(',')[i]);
- list.Add(userID);
- }
- }
- educationMissionClassServices.AddStudentbyEducationMissionClassID(educationMissionClassID, list);
- return Json("成功");
- }
- catch (Exception ex)
- {
- return Json("增加学生失败,原因:" + ex.Message);
- }
- }
-
-
- [HttpGet]
- public ActionResult TeacherSelect()
- {
- return View();
- }
- /// <summary>
- /// 教师列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ALLTeacherList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var userID = pararms.getExtraGuid("SaffDropdown");
- var campusID = pararms.getExtraGuid("CampusDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var departmentID = pararms.getExtraGuid("DepartmentDropdown");
- var isphotoUrl = pararms.getExtraInt("PhotoUrltmentDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("PhotoUrltmentDropdown");
- return base.Json(staffServices.Value.GetStaffViewGrid(configuretView, campusID, collegeID, departmentID, isphotoUrl, userID, (int)pararms.page, (int)pararms.rows));
- }
-
- //设置教师
- public ActionResult SetTeacher(Guid? educationMissionClassID)
- {
- EducationMissionClassView educationMissionClassView = new EducationMissionClassView();
- if (educationMissionClassID != null && educationMissionClassID != Guid.Empty)
- {
- educationMissionClassView = educationMissionClassServices.GetEducationMissionClassView(educationMissionClassID);
- }
- return View(educationMissionClassView);
- }
- [HttpPost]
- public ActionResult SetTeacher(EducationMissionClassView educationMissionClassView)
- {
- try
- {
- string teacherJson = Request.Form["hid_TeacherJsonStr"];
- var teacherList = DataGrid.GetTableData<EducationMissionClassTeacherListView>("dgTeacherList");
- // List<StaffView> teacherList = teacherJson.JsonToObject<List<StaffView>>();//Json数据转换
- educationMissionClassServices.EducationMissionClassUpdateTeacher(educationMissionClassView, teacherList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "!"
- });
- }
- }
- public ActionResult CourseProcess(Guid? educationMissionClassID)
- {
- EducationMissionClassView educationMissionClassView = new EducationMissionClassView();
- if (educationMissionClassID != null && educationMissionClassID != Guid.Empty)
- {
- educationMissionClassView = educationMissionClassServices.GetEducationMissionClassView(educationMissionClassID);
- }
- return View(educationMissionClassView);
- }
- public ActionResult CourseProcessTeacherEdit(Guid? courseProcessID)
- {
- return View();
- }
- [HttpPost]
- public ActionResult CourseProcessTeacherList(Guid courseProcessID)
- {
- var courseProcessTeacherList = educationMissionClassServices.GetCourseProcessTeacherView(courseProcessID);
- return Json(new GridResultSet<CourseProcessTeacherView>{ rows = courseProcessTeacherList, total = courseProcessTeacherList.Count });
- }
- /// <summary>
- /// 周次设置
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CheckEducationMissionClassSettingsList(Guid? educationMissionClassID)
- {
- List<string> list = new List<string>();
- if (educationMissionClassID != null && educationMissionClassID != Guid.Empty)
- list = educationMissionClassServices.GetEducationMissionClassSettings(educationMissionClassID);
- return Json(list);
- }
- /// <summary>
- /// 获取任务班授课老师
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult TeacherList(Guid? educationMissionClassID)
- {
- var teacherList = educationMissionClassServices.GetEducationMissionClassTeacherListViewList(educationMissionClassID);
- return Json(new GridResultSet<EducationMissionClassTeacherListView>() { rows = teacherList, total = teacherList.Count });
- }
- /// <summary>
- /// 查看排课班信息
- /// </summary>
- /// <returns></returns>
- public ActionResult EducationSchedulingClassList()
- {
- return View();
- }
- /// <summary>
- /// 查看排课班信息
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult EducationSchedulingClassList(QueryParamsModel pararms)
- {
- Guid? educationMissionClassID = Request["educationMissionClassID"].ParseStrTo<Guid>();
- return Json(educationMissionClassServices.GetEducationSchedulingClassViewGrid(educationMissionClassID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 查看排课班学生信息
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- public ActionResult EducationSchedulingClassStudentList()
- {
- return View();
- }
- /// <summary>
- /// 查看排课班学生信息
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult EducationSchedulingClassStudentList(QueryParamsModel pararms)
- {
- Guid? educationSchedulingClassID = Request["educationSchedulingClassID"].ParseStrTo<Guid>();
- return Json(educationMissionClassServices.GetEducationMissionClassStudentViewGrid(educationSchedulingClassID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 统计任务班对应排课班学生总人数
- /// </summary>
- /// <returns></returns>
- public ActionResult EducationSchedulingClassCountStudentList()
- {
- string approvalStatusName = Request["ApprovalStatusName"];
- string mnu = Request["mnu"];
- Guid? educationMissionClassID = Request["educationMissionClassID"].ParseStrTo<Guid>();
- ViewBag.approvalStatusName = approvalStatusName;
- ViewBag.mnu = mnu;
- ViewBag.educationMissionClassID = educationMissionClassID;
- return View();
- }
- /// <summary>
- /// 统计任务班对应排课班学生总人数
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult EducationSchedulingClassCountStudentList(QueryParamsModel pararms)
- {
- Guid? educationMissionClassID = Request["educationMissionClassID"].ParseStrTo<Guid>();
- //string approvalStatusName = Request["ApprovalStatusName"];
- //string mnu = Request["mnu"];
- //ViewBag.approvalStatusName = approvalStatusName;
- //ViewBag.mnu = mnu;
- return Json(educationMissionClassServices.GetEducationMissionClassSchedulingStudentViewGrid(educationMissionClassID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 主任务班列表
- /// </summary>
- /// <returns></returns>
- public ActionResult EducationMissionConjunctionList()
- {
- return View();
- }
- /// <summary>
- /// 合班提交
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult EducationMissionClassConjunctionEdit()
- {
- try
- {
- var educationMissionClassList = DataGrid.GetTableData<EducationMissionClassView>("dgEducationMissionClassConjunctionList");
- Guid? EducationMissionClassID = new Guid(Request.Form["EducationMissionClassID"]);
- string Name = Request.Form["Name"];
- if (educationMissionClassList.Count > 0)
- {
- List<Guid?> list = new List<Guid?>();
- foreach (var educationMissionClass in educationMissionClassList)
- {
- list.Add(educationMissionClass.EducationMissionClassID);
- }
- EducationMissionClassView educationMissionClassView = new EducationMissionClassView();
- educationMissionClassView.EducationMissionClassID = EducationMissionClassID;
- educationMissionClassView.Name = Name;
- educationMissionClassServices.EducationMissionClassConjunctionAdd(educationMissionClassView, list);
- }
- else
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,请选择您要合班的教学任务!"
- });
- }
- 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);
- }
- }
- educationMissionClassServices.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 educationMissionClassIDs = Request.Form["EducationMissionClassIDs"];
- 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>();
- List<Guid?> EducationMissionClassIDList = new List<Guid?>();
- if (educationMissionClassIDs != "")
- {
- EducationMissionClassIDList = educationMissionClassIDs.SplitIDString();
- }
- else
- {
- EducationMissionClassIDList = null;
- }
- var dt = educationMissionClassServices.GetEducationMissionClassViewList(configuretView, campusID, collegeID, schoolyearID, standardID, coursematerialID, approvalStatus, teachingMode, classmajorID, gradeYearID, null, null, null, EducationMissionClassIDList)
- .Select(x => new
- {
- x.OrderNo,
- x.Name,
- // x.SchoolyearCode,
- x.CourseCode,
- x.CourseName,
- x.DepartmentName,
- // x.CollegeName,
- x.ClassroomTypeName,
- x.ClassroomName,
- 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 = "导出成功!"
- });
- }
- [HttpPost]
- public ActionResult GetCourseProcessViewList(Guid educationMissionClassID)
- {
- var courseProcessList = this.educationMissionClassServices.GetCourseProcessView(educationMissionClassID);
- return Json(new GridResultSet<CourseProcessView> { rows = courseProcessList, total = courseProcessList.Count });
- }
- [HttpPost]
- public ActionResult CourseProcess(EducationMissionClassView educationMissionClassView)
- {
- try
- {
- var courseProcessList = DataGrid.GetTableData<CourseProcessView>("dgCourseProcessList");
- educationMissionClassServices.SaveCourseProcessView(educationMissionClassView, courseProcessList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult GetStudentCount(Guid educationMissionClassID)
- {
- return Json(educationMissionClassServices.GetStudentCount(educationMissionClassID));
- }
- /// <summary>
- /// 列出课程进度中的可选教室
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetCourseProcessClassroomList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- int? classroomType = pararms.getExtraString("ClassroomType").ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : pararms.getExtraString("ClassroomType").ParseStrTo<int>();
- int? minSeatCount = pararms.getExtraString("MinSeatCount").ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : pararms.getExtraString("MinSeatCount").ParseStrTo<int>();
- var collegeID = pararms.getExtraGuid("CollegeDropdown") ?? Guid.Empty;
- var buildingsID = pararms.getExtraInt("BuildingsDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraGuid("BuildingsDropdown");
- return base.Json(educationMissionClassServices.GetAvailableClassroom(configuretView, collegeID, buildingsID, classroomType, minSeatCount, (int)pararms.page, (int)pararms.rows));
- }
- public ActionResult StudentExport(Guid educationMissionClassID)
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var dt = educationMissionClassServices.GetEducationMissionClassSchedulingStudentViewList(educationMissionClassID)
- .Select(x => new
- {
- x.LoginID,
- x.Name,
- x.ClassName,
- x.StudentStatusName
- }).ToTable();
- string[] liststring = { "学号", "姓名","班级", "学籍状态" };
- neh.Export(dt, liststring, "教学任务班学生信息");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功!"
- });
- }
- public ActionResult ClassRoomEdit(Guid educationMissionClassID)
- {
- EducationMissionClassView educationMissionClassView = new EducationMissionClassView();
- if (educationMissionClassID != null && educationMissionClassID != Guid.Empty)
- {
- educationMissionClassView = educationMissionClassServices.GetEducationMissionClassView(educationMissionClassID);
- }
- return View(educationMissionClassView);
- }
- [HttpPost]
- public ActionResult ClassRoomEdit(EducationMissionClassView educationMissionClassView)
- {
- try
- {
- educationMissionClassServices.EducationMissionClassUpdateClassRoom(educationMissionClassView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "!"
- });
- }
- }
- /// <summary>
- /// 操作前验证
- /// </summary>
- /// <param name="universityID"></param>
- /// <param name="code"></param>
- /// <returns></returns>
- [HttpPost]
- [Obsolete]
- public ActionResult Verification(string collegeIDs, string SchoolyearIDs)
- {
- List<Guid?> collegeIDlist = collegeIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- List<Guid?> schoolyearIDlist = SchoolyearIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- var isOK = true;
- if (collegeIDlist.Count > 0 && schoolyearIDlist.Count>0)
- {
- isOK = educationMissionClassServices.Verification(collegeIDlist, schoolyearIDlist);
- }
- if (isOK)
- {
- return Json("成功");
- }
- else
- {
- return Json("教学任务的提交有时间限制,当前时间不在提交时间范围内,不能进行提交。");
- }
- }
- /// <summary>
- /// 操作前验证
- /// </summary>
- /// <param name="universityID"></param>
- /// <param name="code"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CheckEducationMissionClassOpenControl(string educationMissionClassIDs)
- {
- List<Guid> educationMissionClassIDList = educationMissionClassIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => new Guid(x)).ToList();
- if (educationMissionClassIDList.Count > 0)
- {
- try
- {
- return Json(new ReturnMessage
- {
- IsSuccess = educationMissionClassServices.CheckEducationMissionClassOpenControl(educationMissionClassIDList)
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage
- {
- IsSuccess = false,
- Message = ex.Message
- });
- }
- }
- return Json(new ReturnMessage { IsSuccess = true });
- }
- [HttpPost]
- public ActionResult GZMSStudentListReport(List<Guid?> educationMissionClassIDList)
- {
- //ExcelForPDF.Worksheet
- AsposeExcelHelper excel = new AsposeExcelHelper();
- var pageList = new List<PageItem>();
- List<CellItem> cellItems = new List<CellItem>();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- List<EducationMissionClassView> educationMissionClassViewList = educationMissionClassServices.GetEducationMissionClassViewList(configuretView, null, null, null, null, null, null, null, null, null, null, null, null, educationMissionClassIDList);
- var educationMissionClass = educationMissionClassViewList.FirstOrDefault();
- List<EducationMissionClassStudentView> studentList = educationMissionClassServices.GetEducationMissionClassSchedulingStudentViewList(educationMissionClassIDList.FirstOrDefault());
- CellItem cell = new CellItem();
- cell.Row = 2;
- cell.Col = 2;
- cell.Value = educationMissionClass.Name;
- cellItems.Add(cell);
- CellItem cell1 = new CellItem();
- cell1.Row = 3;
- cell1.Col = 2;
- cell1.Value = educationMissionClass.SpecialtyName;
- cellItems.Add(cell1);
- string [][] vs = studentList.Select((data, i) => new string[]{
- (i+1).ToString(),
- data.Name
- }).ToArray();
- var count = vs.Length;
- var vslist = vs.ToList();
- if (count % 48 != 0) {
- do
- {
- var number = count + 1;
- vslist.Add(new string[]{
- number.ToString(),
- ""
- });
- count++;
- } while (count < 48 || (count > 48 && (count-48) % 55 != 0 ));
- }
-
- pageList.Add(new PageItem
- {
- CellItemList = cellItems,
- ListItemList = new List<ListItem>{
- new ListItem { StartRow = 5, StartColumn = 0, EndColumn = 2, Values = vslist.ToArray() }
- },
- });
- var newExcelName = Guid.NewGuid().ToString() + DateTime.Now.Ticks.ToString() + ".xlsx";
- FileInfo file = new FileInfo(Server.MapPath("~/Content/TemplateFile" + Path.DirectorySeparatorChar + "studentListReport.xlsx"));
- file.CopyTo(Server.MapPath("~/Content/TemplateFile" + Path.DirectorySeparatorChar + newExcelName));
- FileInfo newfile = new FileInfo(Server.MapPath("~/Content/TemplateFile" + Path.DirectorySeparatorChar + newExcelName));
- var stream = new FileStream(Server.MapPath("~/Content/TemplateFile" + Path.DirectorySeparatorChar + newExcelName), FileMode.Open);
- var excelNewStream = excel.ExportToTemplate(stream, pageList);
- var fileName = ExcelToPDF.ExportToFile(excelNewStream, Const.LOCAL_SETTING_UPLOAD_FILEPATH);
- var url = HttpContext.Request.Url.Scheme + "://" + HttpContext.Request.Url.Host + ":" + HttpContext.Request.Url.Port + Url.Content("~/").TrimEnd('/');
- //var host = HttpContext.Request.Url;
- var fileUrl = url + fileName.Substring(1, fileName.Length - 1);
- stream.Close();
- newfile.Delete();
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = fileUrl,
- });
- //File(Server.MapPath(fileName), "application/x-pdf", "测试" + DateTime.Now.ToString("yyyyMMdd") + ".pdf");
- }
- }
- }
|