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; }
///
/// 考试计划(普教)
///
///
public ActionResult List()
{
return View();
}
///
/// 考试计划(松山)
///
///
public ActionResult GdssList()
{
return View();
}
///
/// 考试计划(成教)
///
///
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);
}
///
/// 新增考室
///
///
[HttpPost]
public ActionResult AddClassroomLayout(ExaminationRoomLayoutView examinationRoomLayoutView)
{
return View(examinationRoomLayoutView);
}
public ActionResult AddStudentSelect()
{
return View();
}
///
/// 复制新增
///
///
///
public ActionResult CopyAdd(Guid examinationPlanID)
{
ExaminationPlanView examinationPlanView = new ExaminationPlanView();
examinationPlanView = ExaminationPlanServices.GetExaminationPlanView(examinationPlanID);
return View("Add", examinationPlanView);
}
///
/// 复制新增
///
///
///
[HttpPost]
public ActionResult CopyAdd(ExaminationPlanView examinationPlanView)
{
examinationPlanView.ExaminationPlanID = Guid.Empty;
return this.Add(examinationPlanView);
}
///
/// 新增考试安排
///
///
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
});
}
}
///
/// 考试安排学生
///
///
///
[HttpPost]
public ActionResult FinalExaminationStudentList()
{
var finalExaminationID = Request["finalExaminationID"].ParseStrTo();
//return Json(finalExaminationServices.Value.GetFinalExaminationStudent(finalExaminationID));
return null;
}
///
/// 增加学生
///
///
///
public ActionResult StudentEdit(Guid? examinationPlanID)
{
ExaminationPlanView finalExaminationView = new ExaminationPlanView();
var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
if (examinationPlanID.HasValue)
{
finalExaminationView = ExaminationPlanServices.GetExaminationPlanView(examinationPlanID);
}
return View(finalExaminationView);
}
///
/// 增加学生
///
///
///
[HttpPost]
public ActionResult StudentEdit(ExaminationPlanView finalExaminationView)
{
try
{
//finalExaminationView.ExaminationType = (int)EMIS.ViewModel.CF_ExaminationType.FinalExamination;
var studentList = DataGrid.GetTableData("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 + "!");
}
}
/////
///// 添加学生
/////
/////
/////
//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);
//}
/////
///// 添加学生
/////
/////
/////
//[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
// });
// }
//}
///
/// 列表查询
///
///
///
[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));
}
///
/// 列表查询
///
///
///
[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));
}
///
/// 列表查询
///
///
///
[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();
return base.Json(ExaminationPlanServices.GetGdssStudentListForSelect(configuretView, examinationPlanID,collegeID, grademajorID,classmajorID,(int)pararms.page, (int)pararms.rows));
}
///
/// 列表查询
///
///
///
[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();
var collegeID = Request.Form["ddlCollege"].ParseStrTo();
var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo();
var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo();
var coursematerialID = Request.Form["cbgCoursematerial"].ParseStrTo();
var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo();
var examinationModeID = Request.Form["ddlExaminationMode"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationMode"].ParseStrTo();
var statusID = Request.Form["ddlStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo();
var courseEndWeek = Request.Form["CourseEndWeek"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["CourseEndWeek"].ParseStrTo();
var starWeek = Request.Form["StarWeek"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StarWeek"].ParseStrTo();
var endWeek = Request.Form["EndWeek"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["EndWeek"].ParseStrTo();
var examinationStyleID = Request.Form["ddlExaminationStyle"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationStyle"].ParseStrTo();
if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
List selectIDlist = new List();
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();
var collegeID = Request.Form["ddlCollege"].ParseStrTo();
var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo();
var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo();
var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo();
var coursematerialID = Request.Form["cbgCoursematerial"].ParseStrTo();
var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo();
var examinationModeID = Request.Form["ddlExaminationMode"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationMode"].ParseStrTo();
var statusID = Request.Form["ddlStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo();
var courseEndWeek = Request.Form["CourseEndWeek"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["CourseEndWeek"].ParseStrTo();
var starWeek = Request.Form["StarWeek"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StarWeek"].ParseStrTo();
var endWeek = Request.Form["EndWeek"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["EndWeek"].ParseStrTo();
var examinationStyleID = Request.Form["ddlExaminationStyle"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationStyle"].ParseStrTo();
if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
List selectIDlist = new List();
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 selectIDlist = new List();
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 selectIDlist = new List();
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();
var collegeID = Request.Form["ddlCollege"].ParseStrTo();
var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo();
var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo();
var coursematerialID = Request.Form["cbgCoursematerial"].ParseStrTo();
var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo();
var examinationModeID = Request.Form["ddlExaminationMode"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationMode"].ParseStrTo();
var statusID = Request.Form["ddlStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo();
var courseEndWeek = Request.Form["CourseEndWeek"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["CourseEndWeek"].ParseStrTo();
var starWeek = Request.Form["StarWeek"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StarWeek"].ParseStrTo();
var endWeek = Request.Form["EndWeek"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["EndWeek"].ParseStrTo();
var examinationStyleID = Request.Form["ddlExaminationStyle"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationStyle"].ParseStrTo();
if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
string examinationPlanIDs = Request.Form["SelectedID"];
List 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();
var collegeID = Request.Form["CollegeDropdown"].ParseStrTo();
var gradeID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo();
var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo();
//var isGenerateNotSubmit = Request.Form["IsGenerateNotSubmit"].ParseStrTo();
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();
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();
var collegeID = Request.Form["CollegeDropdown"].ParseStrTo();
var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo();
//var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo();
var learnSystem = Request.Form["DictionaryLearnSystem"].ParseStrTo();
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
});
}
}
///
/// 保存考试计划
///
///
[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
});
}
}
///
/// 保存考试计划
///
///
[HttpPost]
public ActionResult ClassroomGdss(ExaminationPlanGdssView examinationPlanView)
{
try
{
var staffList = DataGrid.GetTableData("dgRoomTeacher");
var studentList = DataGrid.GetTableData("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 cellheader = new Dictionary
{
{ "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("dgRoomTeacher");
var studentList = DataGrid.GetTableData("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
});
}
}
///
///
///
///
///
///
[HttpGet]
public ActionResult ClassroomGdssFalse(ExaminationPlanGdssView examinationPlanView, List studentList)
{
#region 表单头
Dictionary cellheader = new Dictionary
{
{ "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("dgRoomTeacher");
var studentList = DataGrid.GetTableData("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
});
}
}
///
/// 保存考试计划(成教版)
///
///
[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
});
}
}
///
/// 保存考试计划
///
///
[HttpPost]
public ActionResult ClassroomLayout(ExaminationRoomLayoutView examinationRoomLayoutView)
{
try
{
var teacherList = DataGrid.GetTableData("dgRoomTeacher");
var studentList = DataGrid.GetTableData("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 list = new List();
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
});
}
}
///
/// 提交
///
///
///
[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
});
}
}
///
/// 提交
///
///
///
[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
});
}
}
///
/// 删除
///
///
///
[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 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()
});
}
}
}
}