123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.DQPSystem;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.DQPSystem;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using Bowin.Common.JSON;
- using EMIS.Utility;
- using EMIS.Utility.FormValidate;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.ViewModel.SystemView;
- namespace EMIS.Web.Controllers.DQPSystem
- {
- [Authorization]
- public class SOCDetailScoreController : Controller
- {
- public ISOCDetailScoreServices SOCDetialScoreServices { get; set; }
- public ISOCDetailServices SOCDetailServices { get; set; }
- public IParameterServices ParameterServices { get; set; }
- public ISOCServices SOCServices { get; set; }
- /// <summary>
- /// 评分管理页面(最初的,直接显示每个学生课程soc,可以直接评分的页面)
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
- ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
- return View();
- }
- [HttpGet]
- public ActionResult SOCList()
- {
- return View();
- }
- [HttpPost]
- public ActionResult SOCList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
- var user = CustomPrincipal.Current;
- //var coursematerialID = pararms.getExtraGuid("CoursematerialIDDropdownGridBo");
- //var collegeID = pararms.getExtraGuid("CollegeComboGrid");
- //var educationMissionID = pararms.getExtraGuid("EducationMissionGrid");
- var result = SOCServices.GetSOCViewByTeacherIDGrid(configuretView, schoolyearID, user.UserID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- public ActionResult SOCDetailList(Guid? socID)
- {
- ViewBag.SOCID = socID;
- return View();
- }
- [HttpPost]
- public ActionResult SOCDetailList(QueryParamsModel pararms, Guid? socID)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
- var user = CustomPrincipal.Current;
- //var socID = pararms.getExtraGuid("SOCID");
- //var coursematerialID = pararms.getExtraGuid("CoursematerialIDDropdownGridBo");
- //var collegeID = pararms.getExtraGuid("CollegeComboGrid");
- //var educationMissionID = pararms.getExtraGuid("EducationMissionGrid");
- var result = SOCDetailServices.GetSOCDetailViewByIDGrid(configuretView, schoolyearID, socID, user.UserID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- public ActionResult StudentDetail(Guid? socDetailID)
- {
- ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
- ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
- ViewBag.SOCDetailID = socDetailID;
- return View();
- }
- [HttpPost]
- public ActionResult StudentDetail(QueryParamsModel pararms, Guid? SOCDetailID)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var user = CustomPrincipal.Current;
- return base.Json(SOCDetialScoreServices.GetSOCDetailStudentScoreViewByIDList(configuretView, SOCDetailID, user.UserID, (int)pararms.page, (int)pararms.rows));
- }
- public ActionResult GroupScoreList(Guid? socDetailID)
- {
- ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
- ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
- ViewBag.SOCDetailID = socDetailID;
- return View();
- }
- [HttpPost]
- public ActionResult GroupScoreList(QueryParamsModel pararms, Guid? SOCDetailID)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var user = CustomPrincipal.Current;
- return base.Json(SOCDetialScoreServices.GetSOCDetailGroupScoreViewByIDList(configuretView, SOCDetailID, user.UserID, (int)pararms.page, (int)pararms.rows));
- }
- public ActionResult AttachmentList(Guid? detailID, Guid? userID)
- {
- return View();
- }
- public ActionResult GroupList()
- {
- ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
- ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
- return View();
- }
- public ActionResult GroupScore(Guid? socDetailGroupID)
- {
- return View();
- }
- public ActionResult GroupAttachmentList(Guid? detailID, Guid? socDetailGroupID)
- {
- return View();
- }
- public ActionResult GroupStudentList(Guid socDetailGroupID)
- {
- return View();
- }
- public ActionResult RawScoreList()
- {
- return View();
- }
- [HttpPost]
- public ActionResult StudentList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
- var collegeID = pararms.getExtraGuid("cgbCollege");
- var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
- var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
- var classmajorID = pararms.getExtraGuid("cbgClassmajor");
- var coursematerialID = pararms.getExtraGuid("cgbCourse");
- var recordStatus = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
- return base.Json(SOCDetialScoreServices.GetSOCDetailStudentScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
- coursematerialID, recordStatus, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult AttachmentList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var socDetailID = pararms.getExtraGuid("hidSOCDetailID");
- var userID = pararms.getExtraGuid("hidUserID");
- return base.Json(SOCDetialScoreServices.GetSOCDetailStudentAttachmentViewList(configuretView, socDetailID, userID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult StudentSave()
- {
- var studentScoreViewList = DataGrid.GetTableData<SOCDetailStudentScoreView>("dgSOCDetailStudentScoreList");
- try
- {
- SOCDetialScoreServices.StudentSave(studentScoreViewList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- [HttpGet]
- public ActionResult StudentCancel(string socDetailStudentIDs)
- {
- ViewBag.DetailStudentList = socDetailStudentIDs;
- return View();
- }
- [HttpPost]
- public ActionResult StudentCancel()
- {
- //string socDetailStudentIDs = "";
- var socDetailStudentIDs = Request.Form["idList"];
- var remark = Request.Form["Remark"];
- var socDetailStudentIDList = socDetailStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- try
- {
- SOCDetialScoreServices.StudentCancel(socDetailStudentIDList, remark);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "退回成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "退回失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult StudentExcel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var user = CustomPrincipal.Current;
- var socDetailID = Request.Form["SOCDetailID"].ParseStrTo<Guid>();
- var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
- var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
- var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
- var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
- var recordStatus = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
- var dt = SOCDetialScoreServices.GetSOCDetailStudentScoreViewList(configuretView, socDetailID, user.UserID)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.EducationMissionNameStr,
- x.CourseCode,
- x.CourseName,
- x.Name,
- x.LoginID,
- x.SOCDetailName,
- //SOCDetailCredit = x.SOCDetailCredit.HasValue ? x.SOCDetailCredit.Value.ToString("#.##") : null,
- x.SOCDetailCredit,
- Weight = x.Weight.HasValue ? x.Weight.Value.ToString("#.##") : null,
- Score = x.Score.HasValue ? x.Score.Value.ToString("#.##") : null
- }).ToTable();
- string[] liststring = {
- "学年学期", "任务班名", "课程代码", "课程名称", "姓名", "学号",
- "成果名称", "成果学分", "成果权重", "成果得分"
- };
- neh.Export(dt, liststring, "学生成果评分表" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- [HttpPost]
- public ActionResult GroupList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
- var collegeID = pararms.getExtraGuid("cgbCollege");
- var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
- var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
- var classmajorID = pararms.getExtraGuid("cbgClassmajor");
- var coursematerialID = pararms.getExtraGuid("cgbCourse");
- var recordStatus = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
- return base.Json(SOCDetialScoreServices.GetSOCDetailGroupScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
- coursematerialID, recordStatus, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult GroupScore(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var socDetailGroupID = Request.QueryString["SOCDetailGroupID"].ParseStrTo<Guid>();
- return base.Json(SOCDetialScoreServices.GetSOCDetailGroupRawScoreViewList(configuretView, socDetailGroupID.Value, pararms.page, pararms.rows));
- }
- [HttpPost]
- public ActionResult GroupScoreSave(Guid socDetailGroupID)
- {
- var studentRawScoreList = DataGrid.GetTableData<SOCDetailRawScoreView>("dgStudentScoreList");
- try
- {
- SOCDetialScoreServices.GroupScoreSave(socDetailGroupID, studentRawScoreList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult GroupAttachmentList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var socDetailID = pararms.getExtraGuid("hidSOCDetailID");
- var socDetailGroupID = pararms.getExtraGuid("hidSOCDetailGroupID");
- return base.Json(SOCDetialScoreServices.GetSOCDetailGroupAttachmentViewList(configuretView, socDetailID, socDetailGroupID, (int)pararms.page, (int)pararms.rows));
- }
- [Obsolete]
- [HttpPost]
- public ActionResult GroupSave()
- {
- var groupScoreViewList = DataGrid.GetTableData<SOCDetailGroupScoreView>("dgSOCDetailGroupScoreList");
- try
- {
- SOCDetialScoreServices.GroupSave(groupScoreViewList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- [HttpGet]
- public ActionResult GroupCancel(string socDetailGroupIDs)
- {
- ViewBag.DetailGroupList = socDetailGroupIDs;
- return View();
- }
- [HttpPost]
- public ActionResult GroupCancel()
- {
- var socDetailGroupIDs = Request.Form["idList"];
- var remark = Request.Form["Remark"];
- var socDetailGroupIDList = socDetailGroupIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- try
- {
- SOCDetialScoreServices.GroupCancel(socDetailGroupIDList, remark);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "退回成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "退回失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult GroupExcel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var user = CustomPrincipal.Current;
- var socDetailID = Request.Form["SOCDetailID"].ParseStrTo<Guid>();
- var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
- var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
- var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
- var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
- var recordStatus = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
- var dt = SOCDetialScoreServices.GetSOCDetailGroupScoreViewByIDList(configuretView, socDetailID, user.UserID)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.CourseCode,
- x.CourseName,
- x.SOCDetailName,
- //SOCDetailCredit = x.SOCDetailCredit.HasValue ? x.SOCDetailCredit.Value.ToString("#.#") : null,
- x.SOCDetailCredit,
- Weight = x.Weight.HasValue ? x.Weight.Value.ToString("#.#") : null,
- x.ClassmajorName,
- x.Name,
- Score = x.Score.HasValue ? x.Score.Value.ToString("#.#") : null
- }).ToTable();
- string[] liststring = {
- "学年学期", "课程代码", "课程名称", "成果名称", "成果学分", "成果权重",
- "所在班级", "组名", "成果得分"
- };
- neh.Export(dt, liststring, "学生分组成果评分表" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- [HttpPost]
- public ActionResult RawList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
- var collegeID = pararms.getExtraGuid("cgbCollege");
- var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
- var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
- var classmajorID = pararms.getExtraGuid("cbgClassmajor");
- var coursematerialID = pararms.getExtraGuid("cgbCourse");
- return base.Json(SOCDetialScoreServices.GetSOCDetailRawScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
- coursematerialID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult RawExcel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
- var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
- var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
- var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
- var dt = SOCDetialScoreServices.GetSOCDetailRawScoreViewList(configuretView, schoolyearID, collegeID, yearID,
- standardID, classmajorID, coursematerialID)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.CourseCode,
- x.CourseName,
- TotalCredit = x.TotalCredit.HasValue ? x.TotalCredit.Value.ToString("#.#") : null,
- x.Gradeyear,
- x.StandardDesc,
- x.ClassmajorName,
- x.LoginID,
- x.Name,
- x.SOCDetailName,
- SOCDetailCredit = x.SOCDetailCredit.HasValue ? x.SOCDetailCredit.Value.ToString("#.#") : null,
- Weight = x.Weight.HasValue ? x.Weight.Value.ToString("#.#") : null,
- Score = x.Score.HasValue ? x.Score.Value.ToString("#.#") : null,
- ActualScore = x.ActualScore.HasValue ? x.ActualScore.Value.ToString("#.#") : null
- }).ToTable();
- string[] liststring = {
- "学年学期", "课程代码", "课程名称", "课程学分", "年级", "专业",
- "班级", "学号", "姓名", "成果名称", "成果学分", "成果权重", "成果得分", "实际得分"
- };
- neh.Export(dt, liststring, "学生SOC原始成绩表" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- [HttpPost]
- public ActionResult StudentSubmit(string socDetailSubmitViews)
- {
- var userID = CustomPrincipal.Current.UserID;
- try
- {
- var socDetailSubmitViewList = socDetailSubmitViews.JsonToObject<List<SOCDetailStudentKeyView>>();
- this.SOCDetialScoreServices.StudentSubmit(userID, socDetailSubmitViewList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "提交成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "提交失败:" + ex.Message
- });
- }
- }
- public ActionResult StudentAttachmentList(Guid? socDetailID, Guid? socDetailGroupID)
- {
- var userID = CustomPrincipal.Current.UserID;
- var socDetailStudentKeyView = new SOCDetailStudentKeyView { SOCDetailID = socDetailID, SOCDetailGroupID = socDetailGroupID };
- ViewBag.IsStudentCanUpload = this.SOCDetialScoreServices.IsStudentCanUpload(userID, socDetailStudentKeyView);
- return View(socDetailStudentKeyView);
- }
- [HttpPost]
- public ActionResult StudentAttachmentList(SOCDetailStudentKeyView socDetailStudentKeyView)
- {
- var userID = CustomPrincipal.Current.UserID;
- try
- {
- var sessionName = FileUploadHelper.GetFileUploadSessionName((socDetailStudentKeyView.SOCDetailGroupID ?? socDetailStudentKeyView.SOCDetailID) ?? Guid.Empty);
- var fileList = (List<FileUploadView>)Session[sessionName];
- this.SOCDetialScoreServices.SaveFile(userID, socDetailStudentKeyView, fileList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- public ActionResult StudentScoreList()
- {
- ViewBag.ScoreDigitCount = ParameterServices.GetParameterValue<int>(CF_ParameterType.ScoreDigitCount) ?? 1;
- return View();
- }
- [HttpPost]
- public ActionResult StudentCoursematerialList()
- {
- var userID = CustomPrincipal.Current.UserID;
- List<SOCStudentScoreTotalView> socStudentScoreTotalViewList = new List<SOCStudentScoreTotalView>();
- //课程成绩
- var socStudentScoreItemViewList = this.SOCDetialScoreServices.GetStudentScoreItemViewList(userID);
- if (socStudentScoreItemViewList.Count > 0)
- {
- SOCStudentScoreTotalView socStudentScoreTotalView = this.SOCDetialScoreServices.GetStudentScoreTotalView(userID);
- if (socStudentScoreTotalView == null)
- {
- socStudentScoreTotalView = new SOCStudentScoreTotalView();
- }
- try
- {
- socStudentScoreTotalView.ListStarttermID = socStudentScoreItemViewList.Select(x => (int)x.StarttermID).Distinct().ToList();
- }
- catch (Exception ex)
- {
- throw ex;
- }
- socStudentScoreTotalView.SOCStudentScoreItemViewList = socStudentScoreItemViewList.ToList();
- socStudentScoreTotalViewList.Add(socStudentScoreTotalView);
- }
- return Json(socStudentScoreTotalViewList);
- }
- [HttpPost]
- public ActionResult StudentDetailScoreList(Guid? coursematerialID, int? startTermID)
- {
- var userID = CustomPrincipal.Current.UserID;
- return base.Json(this.SOCDetialScoreServices.GetSOCDetailRawScoreViewList(coursematerialID, startTermID, userID));
- }
- [HttpPost]
- public ActionResult GroupStudentList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var socDetailGroupID = pararms.getExtraGuid("hidSOCDetailGroupID");
- return base.Json(SOCDetialScoreServices.GetSOCDetailGroupStudentViewList(configuretView, socDetailGroupID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult DetailStudentGroupList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var socDetailID = pararms.getExtraGuid("hidSOCDetailID");
- var userID = CustomPrincipal.Current.UserID;
- return base.Json(SOCDetialScoreServices.GetSOCDetailGroupStudentViewList(configuretView, socDetailID.Value, userID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpGet]
- public ActionResult SendMessage(string studentUserIDLists)
- {
- ViewBag.UserIDLists = studentUserIDLists;
- return View();
- }
- public ActionResult SendMessage(AnnouncementView announcementView)
- {
- var userIDs = Request.Form["idList"];
- //var message = Request.Form["Message"];
- announcementView.Content = HttpContext.Server.HtmlDecode(announcementView.Content);
- var userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- try
- {
- SOCDetialScoreServices.SendMessage(userIDList, announcementView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "发送成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "发送失败:" + ex.Message
- });
- }
- //return View();
- }
- [HttpGet]
- public ActionResult Remark()
- {
- return View();
- }
- public ActionResult UploaderSave(FormCollection form)
- {
- Response.Cache.SetNoStore();
- try
- {
- FileUploadView upfile = new FileUploadView();
- var files = Request.Files;
- var formID = (!string.IsNullOrEmpty(Request["v"])) ? new Guid(Request["v"]) : (Guid?)null;
- string sessionName = FileUploadHelper.GetFileUploadSessionName(formID.Value);
- var socDetial = SOCDetialScoreServices.GetSOCDetialView(formID.Value);
- var savePath = "SOC";
- if(socDetial!=null)
- {
- savePath = "SOC/" + socDetial.SchoolyearCode + "/" + socDetial.YearID + "级/" + socDetial.EducationMissionNameStr + "-" + socDetial.CourseName + "-" + socDetial.SOCDetailName + "/" + socDetial.LoginID + socDetial.Name;
- }
- //检查文件扩展名字
- var postedFile = files["Filedata"]; //得到要上传文件
- //if (postedFile != null)
- //{
- // if (postedFile.ContentLength > (1024 * 1024 * 10))
- // {
- // throw new Exception("上传的文件不能大于10M");
- // }
- //}
- if (postedFile.FileName == null)
- {
- return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
- }
- upfile.FileID = Function.NewPKGuid();
- string fileUrl = FileUploadHelper.UploadFile(postedFile, savePath);
- upfile.FileUrl = fileUrl;
- upfile.FileName = postedFile.FileName;
- upfile.FormID = formID;
- if (Session[sessionName] == null)
- {
- Session[sessionName] = new List<FileUploadView>();
- }
- ((List<FileUploadView>)Session[sessionName]).Add(upfile);
- return Json(upfile, JsonRequestBehavior.AllowGet);
- }
- catch
- //(Exception ex)
- {
- //return Json(new ReturnMessage()
- //{
- // IsSuccess = false,
- // Message = "发送失败:" + ex.Message
- //});
- }
- return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
- }
- [HttpPost]
- public ActionResult Download()
- {
- try
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- string WindowStr = Request.UrlReferrer.ToString();
- int IndexofID = WindowStr.LastIndexOf("=");
- WindowStr = WindowStr.Remove(0, IndexofID + 1);
- var IDs = Request.Form["IDs"];
- var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
- var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
- var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
- var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
- var recordStatus = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
- var isGroupList = Request.Form["isGroupList"].ParseStrTo<int>();
- List<Guid?> IDList = new List<Guid?>();
- if (IDs != "")
- {
- IDList = IDs.SplitIDString();
- }
- else
- {
- IDList = null;
- }
- var socDetailList = SOCDetialScoreServices.Download(configuretView, schoolyearID, collegeID, yearID,
- standardID, classmajorID, coursematerialID, recordStatus, IDList);
- if (isGroupList== 1)
- {
- socDetailList = SOCDetialScoreServices.GroupListDownload(configuretView, schoolyearID, collegeID, yearID,
- standardID, classmajorID, coursematerialID, recordStatus, IDList);
- }
- List<FileUploadHelper.RemoteFileInfo> fileInfoList = new List<FileUploadHelper.RemoteFileInfo>();
- foreach (var soc in socDetailList)
- {
- FileUploadHelper.RemoteFileInfo fileInfo = new FileUploadHelper.RemoteFileInfo();
- fileInfo.FileName = soc.EducationMissionNameStr + "-" + soc.CourseName + "-" + soc.SOCDetailName+ "/" + soc.LoginID + soc.Name+"/"+soc.FileName;
- fileInfo.RemotePath = (soc.SOCDetailUrl.Trim().StartsWith("http://") ? soc.SOCDetailUrl.Trim() : Url.Content(soc.SOCDetailUrl.Trim()));
- fileInfoList.Add(fileInfo);
- }
- if (fileInfoList.Count > 0)
- {
- var zipFileStream = FileUploadHelper.DownLoadFiles("SOC成果","学生成果下载"+ DateTime.Now.Year+"-"+DateTime.Now.Month+"-"+DateTime.Now.Day, fileInfoList);
- return File(zipFileStream, System.Net.Mime.MediaTypeNames.Application.Zip,"学生成果下载"+ DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + ".zip");
- }
- else
- {
- return RedirectToAction("MsgShowAndOpen", "Common", new
- {
- WindowID = WindowStr,
- msg = "没有成果可下载!",
- });
- }
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return base.Json("下载失败,原因:" + mge + "!");
- }
- }
- }
- }
|