123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.CommonLogic.DQPSystem;
- using Bowin.Common.Utility;
- using EMIS.ViewModel.DQPSystem;
- using EMIS.Utility;
- using EMIS.CommonLogic.SystemServices;
- namespace EMIS.Web.Controllers.DQPSystem
- {
- [Authorization]
- public partial class SOCController : Controller
- {
- //
- // GET: /SOC/
- public ISOCServices SOCServices { get; set; }
- public IRoleServices RoleServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
- var coursematerialID = pararms.getExtraGuid("CoursematerialIDDropdownGridBo");
- var collegeID = pararms.getExtraGuid("CollegeComboGrid");
- //var educationMissionID = pararms.getExtraGuid("EducationMissionGrid");
- var result = SOCServices.GetSOCViewGrid(configuretView, schoolyearID, coursematerialID, collegeID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- [HttpGet]
- public ActionResult SOCDetail(Guid? SOCID)
- {
- ViewBag.SOCID = SOCID;
- return View();
- }
- [HttpPost]
- public ActionResult SOCDetail()
- {
- var SOCID = Request["SOCID"].ParseStrTo<Guid>();
- return Json(SOCServices.GetSOCDetailViewGridByID(SOCID));
- }
- public ActionResult Edit(string SOCIDList)
- {
- ViewBag.SOCIDList = SOCIDList;
- var socIDs = SOCIDList.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var socView = SOCServices.GetSOCViewByID(socIDs.FirstOrDefault());
- return View(socView);
- }
- [HttpPost]
- public ActionResult Edit(SOCView SOCView)
- {
- try
- {
- List<FileUploadView> filelist = new List<FileUploadView>();
- var socID = Request.Form["socIDList"] ?? "";
- var socIDs = socID.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var TDList = DataGrid.GetTableData<SOCDetailView>("dgSOCDetailList");//获取底部列表项数据
- if (TDList.Count <= 0)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:SOC不能为空。"
- });
- }
- else
- {
- var detailIDList = TDList.Select(x => x.SOCDetailID).ToList();
- foreach (var id in detailIDList)
- {
- var sessionName = FileUploadHelper.GetFileUploadSessionName(id);
- var sessionfileList = (List<FileUploadView>)Session[sessionName];
- if (sessionfileList != null)
- {
- foreach (var file in sessionfileList)
- {
- filelist.Add(file);
- }
- }
- }
- SOCServices.SOCEdit(SOCView, TDList, filelist, socIDs);
- }
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- [HttpGet]
- public ActionResult SOCDetailEdit(Guid? detailID)
- {
- //ViewBag.DetailID = detailID;
- //var detailView = Request["detailView"];
- //var SOCDetailView = SOCServices.GetSOCDetailViewByID(detailID);
- //if (SOCDetailView == null)
- //{
- // SOCDetailView = new SOCDetailView();
- // SOCDetailView.SOCDetailID = detailID.Value;
- //}
- SOCDetailView SOCDetailView = new SOCDetailView();
- SOCDetailView.SOCDetailID = detailID.Value;
- return View(SOCDetailView);
- }
- [HttpPost]
- public ActionResult SOCDetailEdit(SOCDetailView SOCDetailView)
- {
- var SOCID = Request["SOCID"].ParseStrTo<Guid>();
- ViewBag.SOCDetailView = SOCDetailView;
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "成功",
- });
- }
- [HttpPost]
- public ActionResult Generate(QueryParamsModel pararms)
- {
- try
- {
- //var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- //var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- //var facultymajorID = Request.Form["FacultymajorDropDown"].ParseStrTo<Guid>();
- //var coursematerialID = Request.Form["CoursematerialDropDown"].ParseStrTo<Guid>();
- SOCServices.GenerateSOC();
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "生成成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成失败:" + ex.Message
- });
- }
- }
- [HttpGet]
- public ActionResult Upload(Guid? detailID)
- {
- SOCDetailView SOCDetailView = new SOCDetailView();
- SOCDetailView.SOCDetailID = detailID.Value;
- return View(SOCDetailView);
- }
- [HttpPost]
- public ActionResult Upload()
- {
- return Json("上传成功");
- }
- [HttpPost]
- public ActionResult GetFileListByDetailID(string DetailID)
- {
- var detailID = DetailID.ParseStrTo<Guid>();
- var sessionName = FileUploadHelper.GetFileUploadSessionName(detailID ?? Guid.Empty);
- var fileList = (List<FileUploadView>)Session[sessionName];
- //var count = Session.Count;
- //List<FileUploadView> filelist = new List<FileUploadView>();
- //for (int i = 0; i < count; i++)
- //{
- // var file = Session[i];
- // if (file.GetType() == typeof(List<FileUploadView>))
- // {
- // filelist = (List<FileUploadView>)file;
- // }
- //}
- //ViewBag.FileList = filelist;
- //foreach (var file in filelist)
- //{
- //}
- return Json(fileList);
- }
- /// <summary>
- /// 学生名单
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult SOCStudentList()
- {
- return View();
- }
- /// <summary>
- /// 学生名单
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult SOCStudentList(QueryParamsModel pararms)
- {
- var SOCID = pararms.getExtraGuid("hidSOCID"); ;
- return Json(SOCServices.GetSOCStudent(SOCID, (int)pararms.page, (int)pararms.rows));
- }
- public ActionResult AttachmentList(Guid? detailID)
- {
- return View();
- }
- public ActionResult DeleteDetailCheck(string detailIDs)
- {
- var detailIDList = detailIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var isOK = SOCServices.CheckDetailIsHaveMessage(detailIDList);
- if (isOK)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "选中的soc明细存在关联数据(SOC分组、SOC学生成果、SOC学生成绩等),不能删除!"
- });
- }
- else {
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除"
- });
- }
- }
- public ActionResult SOCCheck(string SOCIDs)
- {
- var socIDList = SOCIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var isOK = SOCServices.CheckSOCIsHaveMessage(socIDList);
- if (isOK)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "选中的soc存在已经设置过明细的数据,是否重新设置?"
- });
- }
- else
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除"
- });
- }
- }
- public ActionResult CheckCanSetting()
- {
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- var role = RoleServices.GetEnabledTeacherRoleViewList();
- var teacherRole = role.Where(x => x.RoleName == "教师");
- if (curUser.RoleID != teacherRole.FirstOrDefault().RoleID)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "只有教师角色才能进行设置"
- });
- }
- else {
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = ""
- });
- }
- }
- [HttpPost]
- public ActionResult EducationMissionList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var result = SOCServices.GetEducationMissionViewGrid(configuretView, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- /// <summary>
- /// 根据登录教师获取对应院系所
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- public ActionResult TeacherCollegeList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
- var result = SOCServices.GetTeacherCollegeViewGrid(configuretView, schoolyearID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- /// <summary>
- /// 根据登录教师获取对应班级
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- public ActionResult TeacherClassmajorList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
- var collegeID = pararms.getExtraGuid("cgbCollege");
- var year = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
- var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
- var result = SOCServices.GetTeacherClassmajorViewGrid(configuretView, schoolyearID, collegeID, year, standardID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- }
- }
|