123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- 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.DQPSystem;
- using Bowin.Common.Utility;
- using EMIS.ViewModel.DQPSystem;
- using EMIS.ViewModel.Students;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.SystemView;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.DQPSystem
- {
- [Authorization]
- public class SOCDetailGroupController : Controller
- {
- //
- // GET: /SOCDetailGroup/
- public ISOCDetailGroupServices SOCDetailGroupServices { get; set; }
- public ISOCDetailScoreServices SOCDetialScoreServices { 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 result = SOCDetailGroupServices.GetSOCDetailViewGrid(configuretView, schoolyearID, null, null, null, coursematerialID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- [HttpGet]
- public ActionResult Detail(Guid? SOCDetailID)
- {
- ViewBag.SOCDetailID = SOCDetailID;
- return View();
- }
- [HttpPost]
- public ActionResult Detail()
- {
- var SOCID = Request["SOCID"].ParseStrTo<Guid>();
- return Json("");
- }
- [HttpGet]
- public ActionResult Group(Guid? SOCDetailID)
- {
- ViewBag.SOCDetailID = SOCDetailID;
- return View();
- }
- [HttpPost]
- public ActionResult Group(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var SOCDetailID = Request["SOCDetailID"].ParseStrTo<Guid>();
- var result = SOCDetailGroupServices.GetSOCDetailGroupViewGrid(configuretView, SOCDetailID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- [HttpGet]
- public ActionResult AddGroup(Guid? SOCDetailID)
- {
- var groupSOCDetail = SOCDetailGroupServices.GetGroupSOCDetailViewGrid(SOCDetailID);
- return View(groupSOCDetail);
- }
- [HttpPost]
- public ActionResult AddGroup(GroupSOCDetailView groupSOCDetailView)
- {
- try
- {
- SOCDetailGroupServices.GroupSOCDetailSave(groupSOCDetailView);
- return base.Json(
- new ReturnMessage {
- IsSuccess = true,
- Message = "添加成功"
- });
- }
- catch (Exception ex)
- {
- return base.Json(
- new ReturnMessage {
- IsSuccess = false,
- Message = "添加失败,原因:" + ex.Message + "!"
- });
- }
- }
- /// <summary>
- /// 修改学生
- /// </summary>
- /// <param name="finalExaminationID"></param>
- /// <returns></returns>
- public ActionResult StudentEdit(Guid? SOCDetailGroupID)
- {
- SOCDetailGroupView SOCDetailGroupView = new SOCDetailGroupView();
- if (SOCDetailGroupID.HasValue)
- {
- SOCDetailGroupView = SOCDetailGroupServices.GetSOCDetailGroupView(SOCDetailGroupID);
- }
- else
- {
- SOCDetailGroupView.SOCDetailGroupID = Guid.NewGuid();
- }
- return View(SOCDetailGroupView);
- }
- /// <summary>
- /// 修改学生
- /// </summary>
- /// <param name="finalExaminationView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentEdit(SOCDetailGroupView SOCDetailGroupView)
- {
- try
- {
- var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudentList");
- SOCDetailGroupServices.SOCDetailGroupStudentAdd(SOCDetailGroupView.SOCDetailGroupID, studentList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 添加学生
- /// </summary>
- /// <param name="finalExaminationID"></param>
- /// <returns></returns>
- public ActionResult StudentAdd(Guid? SOCDetailGroupID)
- {
- ViewBag.SOCDetailGroupID = SOCDetailGroupID;
- return View();
- }
- ///// <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 SOCDetailGroupStudentList()
- {
- var SOCDetailGroupID = Request["SOCDetailGroupID"].ParseStrTo<Guid>();
- return Json(SOCDetailGroupServices.GetSOCDetailGroupStudent(SOCDetailGroupID));
- }
- [HttpPost]
- public ActionResult SOCDetailGroupStudentNotGroupList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var SOCDetailGroupID = Request["SOCDetailGroupID"].ParseStrTo<Guid>();
- return Json(SOCDetailGroupServices.GetNotGroupStudent(configuretView, SOCDetailGroupID));
- }
- public ActionResult SOCDetailGroupDelete(string SOCDetailGroupIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < SOCDetailGroupIDs.Split(',').Length; i++)
- {
- if (!string.IsNullOrEmpty(SOCDetailGroupIDs.Split(',')[i]))
- {
- Guid SOCDetailGroupID = new Guid(SOCDetailGroupIDs.Split(',')[i]);
- list.Add(SOCDetailGroupID);
- }
- }
- SOCDetailGroupServices.SOCDetailGroupDelete(list);
- return this.Json("删除成功!");
- }
- catch (Exception ex)
- {
- return this.Json("删除失败,原因:" + ex.Message);
- }
- }
- [HttpGet]
- public ActionResult SendMessage(string socDetailGroupIDs)
- {
- var groupIDList = socDetailGroupIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- var userIDList = SOCDetailGroupServices.GetUserIDByGroupID(groupIDList);
- var studentUserIDLists = "";
- foreach (var userID in userIDList)
- {
- studentUserIDLists = studentUserIDLists + "," + userID.ToString();
- }
- studentUserIDLists = studentUserIDLists.Substring(1);
- ViewBag.UserIDLists = studentUserIDLists;
- return View();
- }
- public ActionResult SendMessage(AnnouncementView announcementView)
- {
- announcementView.Content = HttpContext.Server.HtmlDecode(announcementView.Content);
- var userIDs = Request.Form["idList"];
- //var message = Request.Form["Message"];
- 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();
- }
- public ActionResult GroupExcel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var SOCDetailID = Request["SOCDetailID"].ParseStrTo<Guid>();
- var dt = SOCDetailGroupServices.GetSOCDetailGroupViewList(configuretView, SOCDetailID)
- .Select(x => new
- {
- x.CourseName,
- x.Name,
- x.No,
- x.StudentName,
- }).ToTable();
- string[] liststring = {
- "课程名称", "成果名称", "组别", "学生"
- };
- neh.Export(dt, liststring, "学生分组信息");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|