12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.ExaminationManage;
- using Bowin.Common.Utility;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Data;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.ViewModel.ExaminationManage;
- using EMIS.ViewModel.UniversityManage.TeacherManage;
- using EMIS.ViewModel.Students;
- using Bowin.Common.Exceptions;
- using Bowin.Common.JSON;
- using EMIS.Utility;
- using NPOI.SS.UserModel;
- namespace EMIS.Web.Controllers.ExaminationManage
- {
- [Authorization]
- public class ExaminationPlanController : Controller
- {
- public ISchoolYearServices SchoolYearServices { get; set; }
- public IExaminationPlanServices ExaminationPlanServices { get; set; }
- /// <summary>
- /// 考试计划(普教)
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 考试计划(松山)
- /// </summary>
- /// <returns></returns>
- public ActionResult GdssList()
- {
- return View();
- }
- /// <summary>
- /// 考试计划(成教)
- /// </summary>
- /// <returns></returns>
- public ActionResult ListDGLG()
- {
- return View();
- }
- public ActionResult StudentSelect()
- {
- return View();
- }
- public ActionResult GdssStudentSelect(Guid? examinationPlanID)
- {
- ViewBag.examinationPlanID = examinationPlanID;
- return View();
- }
- public ActionResult ExaminationScheduleList()
- {
- return View();
- }
- public ActionResult AdultExaminationScheduleList()
- {
- return View();
- }
- public ActionResult StudentExaminationSchedule()
- {
- return View();
- }
- public ActionResult TeacherExaminationSchedule()
- {
- return View();
- }
- public ActionResult TeacherExaminationTimes()
- {
- return View();
- }
- public ActionResult SetTime()
- {
- return View();
- }
- public ActionResult Import(string errorFile, string operationTips, string selectedIDs)
- {
- ViewBag.ErrorFile = errorFile;
- if (string.IsNullOrEmpty(operationTips))
- {
- operationTips = "错误数据下载";
- }
- ViewBag.operationTips = operationTips;
- ViewBag.selectedIDs = selectedIDs;
- return View();
- }
- public ActionResult Classroom(Guid ExaminationPlanID)
- {
- ExaminationPlanView examinationPlanView = new ExaminationPlanView();
- if (ExaminationPlanID != null && ExaminationPlanID != Guid.Empty)
- {
- examinationPlanView = ExaminationPlanServices.GetExaminationPlanViewInfo(ExaminationPlanID);
- }
- return View(examinationPlanView);
- }
- public ActionResult ClassroomGdss(Guid ExaminationPlanID)
- {
- ExaminationPlanGdssView examinationPlanView = new ExaminationPlanGdssView();
- if (ExaminationPlanID != null && ExaminationPlanID != Guid.Empty)
- {
- examinationPlanView = ExaminationPlanServices.GetExaminationPlanGdssViewInfo(ExaminationPlanID);
- }
- if (!examinationPlanView.StudentOrderType.HasValue)
- {
- examinationPlanView.StudentOrderType = (int)CF_StudentOrderType.StudentNo;
- }
- return View(examinationPlanView);
- }
- public ActionResult ClassroomLayout(Guid? ExaminationPlanID, Guid? ExaminationRoomLayoutID)//暂时将ExaminationPlanID变为可空
- {
- ExaminationRoomLayoutView examinationRoomLayoutView = new ExaminationRoomLayoutView();
- if (ExaminationRoomLayoutID != null && ExaminationRoomLayoutID != Guid.Empty)
- {
- examinationRoomLayoutView = ExaminationPlanServices.GetExaminationRoomLayoutViewInfo(ExaminationRoomLayoutID);
- }
- //屏蔽间隔功能
- examinationRoomLayoutView.ColumnSpacing = 0;
- examinationRoomLayoutView.RowSpacing = 0;
- return View(examinationRoomLayoutView);
- }
- public ActionResult ClassroomAdult(Guid ExaminationPlanID)
- {
- ExaminationPlanView examinationPlanView = new ExaminationPlanView();
- if (ExaminationPlanID != null && ExaminationPlanID != Guid.Empty)
- {
- examinationPlanView = ExaminationPlanServices.GetExaminationPlanViewInfo(ExaminationPlanID);
- }
- return View(examinationPlanView);
- }
- public ActionResult GenerateResit(Guid? schoolYearID)
- {
- var schoolYear = SchoolYearServices.GetSchoolYearViewBeforeCurrent();
- ViewBag.SchoolYearID = schoolYear == null ? DropdownList.PLEASE_SELECT.ToString() : schoolYear.SchoolYearID.ToString();
- return View();
- }
- public ActionResult GenerateGraduateExam(Guid? schoolYearID)
- {
- return View();
- }
- public ActionResult ExaminationPlanStudentList(Guid ExaminationPlanID)
- {
- return View();
- }
- public ActionResult AddClassroomLayout(Guid? ExaminationPlanID, Guid? ExaminationRoomLayoutID)//暂时将ExaminationPlanID变为可空
- {
- ExaminationRoomLayoutView examinationRoomLayoutView = new ExaminationRoomLayoutView();
- if (ExaminationRoomLayoutID != null && ExaminationRoomLayoutID != Guid.Empty)
- {
- examinationRoomLayoutView = ExaminationPlanServices.GetExaminationRoomLayoutViewInfo(ExaminationRoomLayoutID);
- }
- //屏蔽间隔功能
- examinationRoomLayoutView.ColumnSpacing = 0;
- examinationRoomLayoutView.RowSpacing = 0;
- return View(examinationRoomLayoutView);
- }
- /// <summary>
- /// 新增考室
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult AddClassroomLayout(ExaminationRoomLayoutView examinationRoomLayoutView)
- {
- return View(examinationRoomLayoutView);
- }
- public ActionResult AddStudentSelect()
- {
- return View();
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="degreeApplyID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid examinationPlanID)
- {
- ExaminationPlanView examinationPlanView = new ExaminationPlanView();
- examinationPlanView = ExaminationPlanServices.GetExaminationPlanView(examinationPlanID);
- return View("Add", examinationPlanView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="degreeApplyView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(ExaminationPlanView examinationPlanView)
- {
- examinationPlanView.ExaminationPlanID = Guid.Empty;
- return this.Add(examinationPlanView);
- }
- /// <summary>
- /// 新增考试安排
- /// </summary>
- /// <returns></returns>
- public ActionResult Add()
- {
- return View();
- }
- [HttpPost]
- public ActionResult Add(ExaminationPlanView examinationPlanView)
- {
- try
- {
-
- ExaminationPlanServices.AddExaminationPlan(examinationPlanView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 考试安排学生
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult FinalExaminationStudentList()
- {
- var finalExaminationID = Request["finalExaminationID"].ParseStrTo<Guid>();
- //return Json(finalExaminationServices.Value.GetFinalExaminationStudent(finalExaminationID));
- return null;
- }
- /// <summary>
- /// 增加学生
- /// </summary>
- /// <param name="finalExaminationID"></param>
- /// <returns></returns>
- public ActionResult StudentEdit(Guid? examinationPlanID)
- {
- ExaminationPlanView finalExaminationView = new ExaminationPlanView();
- var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
- if (examinationPlanID.HasValue)
- {
- finalExaminationView = ExaminationPlanServices.GetExaminationPlanView(examinationPlanID);
- }
- return View(finalExaminationView);
- }
- /// <summary>
- /// 增加学生
- /// </summary>
- /// <param name="finalExaminationView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentEdit(ExaminationPlanView finalExaminationView)
- {
- try
- {
- //finalExaminationView.ExaminationType = (int)EMIS.ViewModel.CF_ExaminationType.FinalExamination;
- var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudentList");
- //ExaminationPlanServices.FinalExaminationStudentAdd(finalExaminationView.FinalExaminationID, studentList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- public ActionResult Resetting(string examinationPlanIDs)
- {
- try
- {
- var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
- ExaminationPlanServices.ResettingExaminationPlans(examinationPlanIDList);
- return base.Json("重置成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- // System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- return base.Json("重置失败,原因:" + mge + "!");
- }
- }
- public ActionResult Cancel(string examinationPlanIDs)
- {
- try
- {
- var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
- ExaminationPlanServices.CancelExaminationPlans(examinationPlanIDList);
- return base.Json("撤销成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- // System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- return base.Json("撤销失败,原因:" + mge + "!");
- }
- }
- ///// <summary>
- ///// 添加学生
- ///// </summary>
- ///// <param name="finalExaminationID"></param>
- ///// <returns></returns>
- //public ActionResult StudentAdd(Guid? finalExamination, Guid? UserID)
- //{
- // FinalExaminationView finalExaminationView = new FinalExaminationView();
- // finalExaminationView = finalExaminationServices.Value.GetFinalExaminationView(finalExamination);
- // finalExaminationView.isAutoAdd = true;
- // if (UserID != Guid.Empty && UserID != null)
- // {
- // var student = StudentfileServices.Value.GetStudentfileView((Guid)UserID);
- // var StarttermID = finalExaminationServices.Value.GetFinalExaminationStudentForStudentAdd(finalExamination, UserID);
- // var f = finalExaminationServices.Value.GetStarttermID(finalExamination, UserID);
- // finalExaminationView.UserID = UserID;
- // finalExaminationView.UserName = student.UserName;
- // finalExaminationView.StarttermID = StarttermID.StarttermID;
- // //如果是修改变成false
- // finalExaminationView.isAutoAdd = false;
- // }
- // return View(finalExaminationView);
- //}
- ///// <summary>
- ///// 添加学生
- ///// </summary>
- ///// <param name="finalExaminationID"></param>
- ///// <returns></returns>
- //[HttpPost]
- //public ActionResult StudentAdd(FinalExaminationView finalExaminationView)
- //{
- // try
- // {
- // finalExaminationServices.Value.StudentAdd(finalExaminationView);
- // return Json(new ReturnMessage()
- // {
- // IsSuccess = true,
- // Message = "保存成功。"
- // });
- // }
- // catch (Exception ex)
- // {
- // return Json(new ReturnMessage()
- // {
- // IsSuccess = false,
- // Message = "保存失败:" + ex.Message
- // });
- // }
- //}
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
- var starWeek = pararms.getExtraInt("StarWeek");
- var endWeek = pararms.getExtraInt("EndWeek");
- var collegeID = pararms.getExtraGuid("ddlCollege");
- var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
- var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- var coursematerialID = pararms.getExtraGuid("cbgCoursematerial");
- var examsCategoryID = pararms.getExtraInt("ddlExamsCategory") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExamsCategory");
- var examinationModeID = pararms.getExtraInt("ddlExaminationMode") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationMode");
- var examinationStyleID = pararms.getExtraInt("ddlExaminationStyle") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationStyle");
- var courseEndWeek = pararms.getExtraInt("CourseEndWeek");
- var statusID = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(ExaminationPlanServices.GetExaminationPlanViewList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, starWeek, endWeek, courseEndWeek, statusID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GdssList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
- var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
- var collegeID = pararms.getExtraGuid("ddlCollege");
- var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
- var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- var coursematerialID = pararms.getExtraGuid("cbgCoursematerial");
- var examsCategoryID = pararms.getExtraInt("ddlExamsCategory") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExamsCategory");
- var examinationModeID = pararms.getExtraInt("ddlExaminationMode") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationMode");
- var examinationStyleID = pararms.getExtraInt("ddlExaminationStyle") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationStyle");
- var courseEndWeek = pararms.getExtraInt("CourseEndWeek");
- var statusID = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(ExaminationPlanServices.GetGdssExaminationPlanViewList(configuretView, schoolyearID, collegeID,classmajorID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, courseEndWeek, statusID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult GetExaminationRoomLayoutViewList(Guid examinationPlanID)
- {
- return base.Json(ExaminationPlanServices.GetExaminationRoomLayoutViewList(examinationPlanID));
- }
- [HttpPost]
- public ActionResult GetExaminationTeachers(Guid? examinationRoomLayoutID)
- {
- return base.Json(ExaminationPlanServices.GetExaminationTeacherViewInfo(examinationRoomLayoutID));
- }
- [HttpPost]
- public ActionResult GetExaminationTeachersGdss(Guid? examinationPlanID)
- {
- return base.Json(ExaminationPlanServices.GetExaminationTeacherViewInfoGdss(examinationPlanID));
- }
- [HttpPost]
- public ActionResult GetExaminationStudents(Guid? examinationRoomLayoutID)
- {
- return base.Json(ExaminationPlanServices.GetExaminationStudentViewInfo(examinationRoomLayoutID));
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentList(QueryParamsModel pararms, Guid examinationPlanID, int studentOrderTypeID)
- {
- var collegeID = pararms.getExtraGuid("CollegeComboGrid");
- var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
- var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
- var studentOrderType = (CF_StudentOrderType)studentOrderTypeID;
- return base.Json(ExaminationPlanServices.GetAvailableStudentViewList(examinationPlanID, collegeID, grademajorID, classmajorID, studentOrderType, pararms.page, pararms.rows));
- }
- [HttpPost]
- public ActionResult GdssStudentList(QueryParamsModel pararms, Guid? examinationPlanID)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var collegeID = pararms.getExtraGuid("CollegeComboGrid");
- var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
- var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
- //examinationPlanID = Request.Form["examinationPlanID"].ParseStrTo<Guid>();
- return base.Json(ExaminationPlanServices.GetGdssStudentListForSelect(configuretView, examinationPlanID,collegeID, grademajorID,classmajorID,(int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult AddStudentList(QueryParamsModel pararms, int studentOrderTypeID)
- {
- var collegeID = pararms.getExtraGuid("CollegeComboGrid");
- var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
- var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
- var studentOrderType = (CF_StudentOrderType)studentOrderTypeID;
- return base.Json(ExaminationPlanServices.GetAddAvailableStudentViewList(collegeID, grademajorID, classmajorID, studentOrderType, pararms.page, pararms.rows));
- }
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["ddlCollege"].ParseStrTo<Guid>();
- var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- var coursematerialID = Request.Form["cbgCoursematerial"].ParseStrTo<Guid>();
- var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo<int>();
- var examinationModeID = Request.Form["ddlExaminationMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationMode"].ParseStrTo<int>();
- var statusID = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
- var courseEndWeek = Request.Form["CourseEndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CourseEndWeek"].ParseStrTo<int>();
- var starWeek = Request.Form["StarWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StarWeek"].ParseStrTo<int>();
- var endWeek = Request.Form["EndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EndWeek"].ParseStrTo<int>();
- var examinationStyleID = Request.Form["ddlExaminationStyle"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationStyle"].ParseStrTo<int>();
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- List<Guid?> selectIDlist = new List<Guid?>();
- var dt = ExaminationPlanServices.GetExaminationPlanViewList(configuretView, schoolyearID, collegeID,gradeYearID,standardID, coursematerialID, examsCategoryID, examinationModeID,examinationStyleID,starWeek,endWeek,courseEndWeek, statusID, selectIDlist).Select(x => new
- {
- x.SchoolyearCode,
- x.CoursematerialName,
- x.ClassName,
- x.MissionStudentCount,
- x.StudentCount,
- x.ExaminationModeName,
- ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
- x.ExaminationTime,
- x.ClassroomNum,
- x.RecordStatusDesc
- }).ToTable();
- string[] liststring = { "学年学期", "考试科目", "班级名称", "学生数", "排考人数", "考试方式", "考试日期", "考试时间", "考室数", "状态" };
- neh.Export(dt, liststring, "考试计划信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功。",
- url = Url.Content("~/ExaminationPlan/List").AddMenuParameter()
- });
- }
- [HttpPost]
- public ActionResult GdssExcel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var examinationPlanIDs = Request.Form["ExaminationPlanIDs"];
- var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["ddlCollege"].ParseStrTo<Guid>();
- var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
- var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- var coursematerialID = Request.Form["cbgCoursematerial"].ParseStrTo<Guid>();
- var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo<int>();
- var examinationModeID = Request.Form["ddlExaminationMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationMode"].ParseStrTo<int>();
- var statusID = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
- var courseEndWeek = Request.Form["CourseEndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CourseEndWeek"].ParseStrTo<int>();
- var starWeek = Request.Form["StarWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StarWeek"].ParseStrTo<int>();
- var endWeek = Request.Form["EndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EndWeek"].ParseStrTo<int>();
- var examinationStyleID = Request.Form["ddlExaminationStyle"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationStyle"].ParseStrTo<int>();
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- List<Guid?> selectIDlist = new List<Guid?>();
- if (examinationPlanIDs != "")
- {
- selectIDlist = examinationPlanIDs.SplitIDString();
- }
- else
- {
- selectIDlist = null;
- }
- var dt = ExaminationPlanServices.GetGdssExaminationPlanViewList(configuretView, schoolyearID, collegeID,classmajorID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, courseEndWeek, statusID, selectIDlist).Select(x => new
- {
- x.SchoolyearCode,
- x.CoursematerialName,
- x.ClassName,
- x.MissionStudentCount,
- x.StudentCount,
- x.ExaminationModeName,
- ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
- x.ExaminationTime,
- x.ClassroomNum,
- x.RecordStatusDesc
- }).ToTable();
- string[] liststring = { "学年学期", "考试科目", "班级名称", "学生数", "排考人数", "考试方式", "考试日期", "考试时间", "考室数", "状态" };
- neh.Export(dt, liststring, "考试计划信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功。",
- url = Url.Content("~/ExaminationPlan/GdssList").AddMenuParameter()
- });
- }
- [HttpPost]
- public ActionResult AdultImportExcel(QueryParamsModel pararms, string selectedIDs)
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- string WindowStr = Request.UrlReferrer.ToString();
- int IndexofID = WindowStr.LastIndexOf("=");
- WindowStr = WindowStr.Remove(0, IndexofID + 1);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
- var starWeek = pararms.getExtraInt("StarWeek");
- var endWeek = pararms.getExtraInt("EndWeek");
- var collegeID = pararms.getExtraGuid("ddlCollege");
- var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
- var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- var coursematerialID = pararms.getExtraGuid("cbgCoursematerial");
- var examsCategoryID = pararms.getExtraInt("ddlExamsCategory") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExamsCategory");
- var examinationModeID = pararms.getExtraInt("ddlExaminationMode") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationMode");
- var examinationStyleID = pararms.getExtraInt("ddlExaminationStyle") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationStyle");
- var courseEndWeek = pararms.getExtraInt("CourseEndWeek");
- var statusID = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- List<Guid?> selectIDlist = new List<Guid?>();
- for (int i = 0; i < selectedIDs.Split(',').Length; i++)
- {
- string id = selectedIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- selectIDlist.Add(new Guid(id));
- }
- }
- var dt = ExaminationPlanServices.GetAdultExaminationPlanViewList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, starWeek, endWeek, courseEndWeek, statusID, selectIDlist).Select(x => new
- {
- x.CoursematerialName,
- x.ClassName,
- x.MissionStudentCount,
- x.StudentCount,
- x.ExamsCategoryName,
- x.ExaminationModeName,
- x.WeekNumString,
- ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
- x.StartTimeStr,
- x.EndTimeStr,
- x.ClassroomNames,
- x.staffNames
- }).ToTable();
- string[] liststring = { "考试科目", "考试班级名称", "学生数", "排考人数", "考试性质", "考试方式", "考试周次", "考试日期", "考试时间起", "考试时间止", "考室", "监考老师" };
- neh.Export(dt, liststring, "考试信息模板");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功。",
- url = Url.Content("~/ExaminationPlan/Import").AddMenuParameter()
- });
- }
- [HttpPost]
- public ActionResult GdssImportExcel(QueryParamsModel pararms, string selectedIDs)
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- string WindowStr = Request.UrlReferrer.ToString();
- int IndexofID = WindowStr.LastIndexOf("=");
- WindowStr = WindowStr.Remove(0, IndexofID + 1);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
- var collegeID = pararms.getExtraGuid("ddlCollege");
- var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
- var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
- var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- var coursematerialID = pararms.getExtraGuid("cbgCoursematerial");
- var examsCategoryID = pararms.getExtraInt("ddlExamsCategory") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExamsCategory");
- var examinationModeID = pararms.getExtraInt("ddlExaminationMode") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationMode");
- var examinationStyleID = pararms.getExtraInt("ddlExaminationStyle") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationStyle");
- var courseEndWeek = pararms.getExtraInt("CourseEndWeek");
- var statusID = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- List<Guid?> selectIDlist = new List<Guid?>();
- for (int i = 0; i < selectedIDs.Split(',').Length; i++)
- {
- string id = selectedIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- selectIDlist.Add(new Guid(id));
- }
- }
- var dt = ExaminationPlanServices.GetGdssExaminationPlanViewList(configuretView, schoolyearID, collegeID,classmajorID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, courseEndWeek, statusID, selectIDlist).Select(x => new
- {
- x.CoursematerialName,
- x.ClassName,
- x.MissionStudentCount,
- x.StudentCount,
- x.ExamsCategoryName,
- x.ExaminationModeName,
- x.WeekNumString,
- ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
- x.StartTimeStr,
- x.EndTimeStr,
- x.ClassroomNames,
- x.staffNames
- }).ToTable();
- string[] liststring = { "考试科目", "考试班级名称", "学生数", "排考人数", "考试性质", "考试方式", "考试周次", "考试日期", "考试时间起", "考试时间止", "考室", "监考老师" };
- neh.Export(dt, liststring, "考试信息模板");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功。",
- url = Url.Content("~/ExaminationPlan/GdssImport").AddMenuParameter()
- });
- }
- [HttpPost]
- public ActionResult AdultExcel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["ddlCollege"].ParseStrTo<Guid>();
- var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- var coursematerialID = Request.Form["cbgCoursematerial"].ParseStrTo<Guid>();
- var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo<int>();
- var examinationModeID = Request.Form["ddlExaminationMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationMode"].ParseStrTo<int>();
- var statusID = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
- var courseEndWeek = Request.Form["CourseEndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CourseEndWeek"].ParseStrTo<int>();
- var starWeek = Request.Form["StarWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StarWeek"].ParseStrTo<int>();
- var endWeek = Request.Form["EndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EndWeek"].ParseStrTo<int>();
- var examinationStyleID = Request.Form["ddlExaminationStyle"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationStyle"].ParseStrTo<int>();
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- string examinationPlanIDs = Request.Form["SelectedID"];
- List<Guid?> examinationPlanIDList = examinationPlanIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var dt = ExaminationPlanServices.GetAdultExaminationPlanExportViewList(configuretView, examinationPlanIDList, schoolyearID, collegeID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, starWeek, endWeek, courseEndWeek, statusID).Select(x => new
- {
- x.CoursematerialName,
- x.ClassName,
- x.MissionStudentCount,
- x.StudentCount,
- x.ExamsCategoryName,
- x.ExaminationModeName,
- x.ExaminationWeekNumString,
- ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
- x.StartTimeStr,
- x.EndTimeStr,
- x.ClassroomName,
- x.TeacherNames
- }).ToTable();
- string[] liststring = { "考试科目", "考试班级名称", "学生数", "排考人数", "考试性质", "考试方式", "考试周次", "考试日期", "考试时间起",
- "考试时间止", "考室", "监考老师" };
- neh.Export(dt, liststring, "考试计划信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功。",
- url = Url.Content("~/ExaminationPlan/List").AddMenuParameter()
- });
- }
- public ActionResult Generate(Guid? schoolYearID)
- {
- var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
- ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();
- return View();
- }
- [HttpPost]
- public ActionResult Generate()
- {
- try
- {
- //var schoolYear = SchoolYearServices.GetCurrentSchoolYear();
- var schoolYearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var gradeID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- //var isGenerateNotSubmit = Request.Form["IsGenerateNotSubmit"].ParseStrTo<bool>();
- this.ExaminationPlanServices.GenerateExaminationPlan(schoolYearID, collegeID, gradeID, standardID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "生成成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult GenerateResit()
- {
- try
- {
- var schoolyearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
- this.ExaminationPlanServices.GenerateResitPlan(schoolyearID.Value);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "生成成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult GenerateGraduateExam()
- {
- try
- {
- var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- //var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
- var learnSystem = Request.Form["DictionaryLearnSystem"].ParseStrTo<decimal>();
- this.ExaminationPlanServices.GenerateGraduateExamPlan(yearID.Value, collegeID, standardID, learnSystem);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "生成成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult AutoSchedule(string examinationPlanIDs)
- {
- try
- {
- var examinationPlanIDList = examinationPlanIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- this.ExaminationPlanServices.AutoGenerateExaminationRoomLayout(examinationPlanIDList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "自动排考成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = ex.Message
- });
- }
- }
- /// <summary>
- /// 保存考试计划
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Classroom(ExaminationPlanView examinationPlanView)
- {
- try
- {
- ExaminationPlanServices.Save(examinationPlanView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = ex.Message
- });
- }
- }
- /// <summary>
- /// 保存考试计划
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ClassroomGdss(ExaminationPlanGdssView examinationPlanView)
- {
- try
- {
- var staffList = DataGrid.GetTableData<StaffView>("dgRoomTeacher");
- var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudent");
- var staffIDList = staffList.Select(x => (Guid?)x.UserID).ToList();
- var studentIDList = studentList.Select(x => (Guid?)x.UserID).ToList();
- ExaminationPlanServices.SaveGdss(examinationPlanView, staffIDList, studentIDList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult CheckBeforeSave(Guid? examinationPlanID, Guid? buildingsInfoID, Guid? classroomID, DateTime? date, TimeSpan? starttime, TimeSpan? endtime, string teacherIDs, string studentIDs)
- {
- var staffIDList = teacherIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
- var studentIDList = studentIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
- ExaminationPlanGdssView examinationPlanView = new ExaminationPlanGdssView();
- examinationPlanView.ExaminationPlanID = examinationPlanID.Value;
- examinationPlanView.BuildingsInfoID = buildingsInfoID;
- examinationPlanView.ClassroomID = classroomID;
- examinationPlanView.ExaminationDate = date;
- examinationPlanView.StartTime = starttime;
- examinationPlanView.EndTime = endtime;
- var clashingStudentList = ExaminationPlanServices.CheckBeforeGdssSave(examinationPlanView, staffIDList, studentIDList);
- if (clashingStudentList.Count > 0)
- {
- #region 表单头
- Dictionary<string, string> cellheader = new Dictionary<string, string>
- {
- { "CollegeName", "院系" },
- { "ClassmajorName", "班级" },
- { "LoginID", "学号" },
- { "UserName", "姓名" },
- { "CourseName", "课程" },
- };
- #endregion
- var sourcePhysicalPath = Server.MapPath("/Content/DownFile/冲突学生数据.xls");
- string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, clashingStudentList, "学生报名名单失败文件", sourcePhysicalPath));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = errorWebPath
- });
- }
- else {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存成功。"
- });
- }
- }
- [HttpPost]
- public ActionResult GdssSaveNotStudent(ExaminationPlanGdssView examinationPlanView)
- {
- try
- {
- var staffList = DataGrid.GetTableData<StaffView>("dgRoomTeacher");
- var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudent");
- var staffIDList = staffList.Select(x => (Guid?)x.UserID).ToList();
- var studentIDList = studentList.Select(x => (Guid?)x.UserID).ToList();
- ExaminationPlanServices.SaveGdssNotClashingStudent(examinationPlanView, staffIDList, studentIDList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = ex.Message
- });
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="examinationPlanView"></param>
- /// <param name="staffIDList"></param>
- /// <param name="studentIDList"></param>
- [HttpGet]
- public ActionResult ClassroomGdssFalse(ExaminationPlanGdssView examinationPlanView, List<StudentsView> studentList)
- {
- #region 表单头
- Dictionary<string, string> cellheader = new Dictionary<string, string>
- {
- { "CollegeName", "院系" },
- { "ClassmajorName", "班级" },
- { "LoginID", "学号" },
- { "UserName", "姓名" },
- { "CourseName", "课程" },
- };
- #endregion
- var sourcePhysicalPath = Server.MapPath("/Content/DownFile/冲突学生数据.xls");
- string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, studentList, "学生报名名单失败文件", sourcePhysicalPath));
- ViewBag.ErrorFile = errorWebPath;
- ViewBag.operationTips = errorWebPath;
- return View(examinationPlanView);
- }
- [HttpPost]
- public ActionResult ClassroomGdssFalse(ExaminationPlanGdssView examinationPlanView)
- {
- try
- {
- var staffList = DataGrid.GetTableData<StaffView>("dgRoomTeacher");
- var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudent");
- var staffIDList = staffList.Select(x => (Guid?)x.UserID).ToList();
- var studentIDList = studentList.Select(x => (Guid?)x.UserID).ToList();
- ExaminationPlanServices.SaveGdssNotClashingStudent(examinationPlanView, staffIDList, studentIDList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = ex.Message
- });
- }
- }
- /// <summary>
- /// 保存考试计划(成教版)
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ClassroomAdult(ExaminationPlanView examinationPlanView)
- {
- try
- {
- ExaminationPlanServices.Save(examinationPlanView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = ex.Message
- });
- }
- }
- /// <summary>
- /// 保存考试计划
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ClassroomLayout(ExaminationRoomLayoutView examinationRoomLayoutView)
- {
- try
- {
- var teacherList = DataGrid.GetTableData<StaffView>("dgRoomTeacher");
- var studentList = DataGrid.GetTableData<ExaminationRoomStudentView>("dgStudent");
- ExaminationPlanServices.SaveClassroomLayout(examinationRoomLayoutView,
- teacherList.Select(x => (Guid?)x.UserID).ToList(),
- studentList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult ExaminationClassroomLayoutDelete(string examinationRoomLayoutIDs)
- {
- try
- {
- List<Guid> list = new List<Guid>();
- for (int i = 0; i < examinationRoomLayoutIDs.Split(',').Length; i++)
- {
- string id = examinationRoomLayoutIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid examinationRoomLayoutID = new Guid(id);
- list.Add(examinationRoomLayoutID);
- }
- }
- ExaminationPlanServices.DeleteExaminationClassroomLayout(list);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="roleID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Submit(string examinationPlanIDs)
- {
- try
- {
- var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
- ExaminationPlanServices.Submit(examinationPlanIDList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "提交成功。"
- });
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "提交失败," + mge
- });
- }
- }
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="roleID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult UnSubmit(string examinationPlanIDs)
- {
- try
- {
- var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
- ExaminationPlanServices.UnSubmit(examinationPlanIDList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "撤回成功。"
- });
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "撤回失败," + mge
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="roleID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string examinationPlanIDs)
- {
- try
- {
- var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
- ExaminationPlanServices.Delete(examinationPlanIDList);
- return base.Json("删除成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- // System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- return base.Json("删除失败,原因:" + mge + "!");
- }
- }
- [HttpPost]
- public ActionResult SetTime(string ids, DateTime? examinationDate, TimeSpan? startTime, TimeSpan? endTime)
- {
- try
- {
- List<Guid?> list = ids.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- ExaminationPlanServices.SetTime(list, examinationDate, startTime, endTime);
- return base.Json(new ReturnMessage { IsSuccess = true, Message = "设置时间成功" });
- }
- catch (Exception ex)
- {
- return base.Json(new ReturnMessage { IsSuccess = false, Message = "设置时间失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Import(HttpPostedFileBase file)
- {
- try
- {
- if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
- {
- throw new Exception("只允许上传xls和xlsx格式的Excel文件!");
- }
- string returnMessage = "";
- string sourceWebPath = FileUploadHelper.UploadFile(file);
- var sourcePhysicalPath = Server.MapPath(sourceWebPath);
- var errFileWebPath = ExaminationPlanServices.AdultImport(sourcePhysicalPath, out returnMessage);
- if (errFileWebPath != "")
- {
- ViewBag.ErrorFile = errFileWebPath;
- ViewBag.operationTips = returnMessage;
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = "none",
- msg = "导入失败!",
- url = Url.Action("Import").AddMenuParameter() + "&errorFile=" + errFileWebPath + "&operationTips=" + returnMessage + "&WindowID=" + Request["WindowID"]
- });
- }
- else
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "导入成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- catch (Exception ex)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "导入失败,原因:" + ex.Message + "!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- [HttpPost]
- public ActionResult GetExaminationPlanStudentList(Guid examinationPlanID)
- {
- return Json(ExaminationPlanServices.GetExaminationPlanStudentList(examinationPlanID));
- }
- public ActionResult CheckStudentSchedule(Guid examinationPlanID, string studentUserIDs)
- {
- var studentUserIDList = studentUserIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid)new Guid(x)).ToList();
- try
- {
- ExaminationPlanServices.CheckStudentSchedule(examinationPlanID, studentUserIDList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "提交失败," + ex.Message
- });
- }
- }
- public ActionResult GdssImport(string errorFile, string operationTips, string selectedIDs)
- {
- ViewBag.ErrorFile = errorFile;
- if (string.IsNullOrEmpty(operationTips))
- {
- operationTips = "错误数据下载";
- }
- ViewBag.operationTips = operationTips;
- ViewBag.selectedIDs = selectedIDs;
- return View();
- }
- [HttpPost]
- public ActionResult GdssImport(HttpPostedFileBase file)
- {
- try
- {
- if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
- {
- throw new Exception("只允许上传xls和xlsx格式的Excel文件!");
- }
- string returnMessage = "";
- string sourceWebPath = FileUploadHelper.UploadFile(file);
- var sourcePhysicalPath = Server.MapPath(sourceWebPath);
- var errFileWebPath = ExaminationPlanServices.AdultImport(sourcePhysicalPath, out returnMessage);
- if (errFileWebPath != "")
- {
- ViewBag.ErrorFile = errFileWebPath;
- ViewBag.operationTips = returnMessage;
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = "none",
- msg = "导入失败!",
- url = Url.Action("Import").AddMenuParameter() + "&errorFile=" + errFileWebPath + "&operationTips=" + returnMessage + "&WindowID=" + Request["WindowID"]
- });
- }
- else
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "导入成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- catch (Exception ex)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "导入失败,原因:" + ex.Message + "!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- }
- }
|