123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.CommonLogic.EducationSchedule;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.Utility;
- using EMIS.ViewModel.EducationSchedule;
- using Bowin.Common.Linq.Entity;
- using EMIS.CommonLogic.CalendarManage;
- namespace EMIS.Web.Controllers.EducationSchedule
- {
- [Authorization]
- public class ClassroomExcessiveUseController : Controller
- {
- public ISchoolYearServices SchoolYearServices { get; set; }
- public IClassroomExcessiveUseServices ClassroomExcessiveUseServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- public ActionResult Edit(Guid? classroomExecessiveUseID)
- {
- ClassroomExcessiveUseView model;
- if (classroomExecessiveUseID.HasValue)
- {
- model = ClassroomExcessiveUseServices.GetClassroomExcessiveUseView(classroomExecessiveUseID.Value);
- }
- else
- {
- model = new ClassroomExcessiveUseView();
- model.SchoolyearID = BaseExtensions.GetCurrentSchoolYearID();
- }
- return View(model);
- }
- public ActionResult SchedulingEdit(Guid? schoolyearID, Guid? classroom)
- {
- var weekNumList = SchoolYearServices.GetCurrentSchoolyearWeekNumList();
- List<ListControlItem> lctWeekNum = new List<ListControlItem>();
- for (int i = 1; i <= weekNumList.Count; i++)
- {
- ListControlItem lt = new ListControlItem { Text = i.ToString(), Value = i, IsSelected = true };
- lctWeekNum.Add(lt);
- }
- ViewBag.WeekList = lctWeekNum;
- ViewBag.SchoolyearID = schoolyearID;
- ViewBag.ClassroomID = classroom;
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
- var weekNum = pararms.getExtraInt("ddlWeekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlWeekNum");
- var weekday = pararms.getExtraInt("ddlWeekday") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlWeekday");
- var courseTimeID = pararms.getExtraGuid("cbgCoursesTime");
- var collegeID= pararms.getExtraGuid("CollegeComboGrid");
- var buildingID = pararms.getExtraGuid("cbgBuilding");
- var classroomID = pararms.getExtraGuid("cbgClassroom");
- var result = ClassroomExcessiveUseServices.GetClassroomExcessiveUseViewList(configuretView, schoolyearID, weekNum, weekday,
- courseTimeID, buildingID, classroomID, collegeID, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
- var weekNum = Request.Form["ddlWeekNum"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlWeekNum"].ParseStrTo<int>();
- var weekday = Request.Form["ddlWeekday"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlWeekday"].ParseStrTo<int>();
- var courseTimeID = Request.Form["cbgCoursesTime"].ParseStrTo<Guid>();
- var buildingID = Request.Form["cbgBuilding"].ParseStrTo<Guid>();
- var classroomID = Request.Form["cbgClassroom"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeComboGrid"].ParseStrTo<Guid>();
- var dt = ClassroomExcessiveUseServices.GetClassroomExcessiveUseViewList(configuretView, schoolyearID, weekNum, weekday,
- courseTimeID, buildingID, classroomID, collegeID)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.ClassroomName,
- x.CollegeName,
- x.UserName,
- x.Content,
- x.Scheduling
- }).ToTable();
- string[] liststring = { "学年学期", "教室", RSL.Get("UsingCollege"), "使用人", "活动内容", "时间安排" };
- neh.Export(dt, liststring, "课外教室使用登记表");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/Students/List").AddMenuParameter()
- });
- }
- [HttpPost]
- public ActionResult Delete(string classroomExcessiveUseIDs)
- {
- try
- {
- List<Guid> idList = classroomExcessiveUseIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- ClassroomExcessiveUseServices.Delete(idList);
- return Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult SchedulingList(Guid? classroomExcessiveUseID)
- {
- if (!classroomExcessiveUseID.HasValue)
- {
- return Json(new GridResultSet<ClassroomExcessiveUseSchedulingView> { rows = new List<ClassroomExcessiveUseSchedulingView>(), total = 0 });
- }
- else
- {
- var schedulingList = ClassroomExcessiveUseServices.GetClassroomExcessiveUseSchedulingViewList(classroomExcessiveUseID.Value);
- return Json(new GridResultSet<ClassroomExcessiveUseSchedulingView> { rows = schedulingList, total = schedulingList.Count });
- }
- }
- [HttpPost]
- public ActionResult Edit(ClassroomExcessiveUseView model)
- {
- var schedulingList = DataGrid.GetTableData<ClassroomExcessiveUseSchedulingView>("dgSchedulingList");
- try
- {
- if (schedulingList.Count <= 0)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:时间安排不能为空。"
- });
- }
- else
- {
- ClassroomExcessiveUseServices.Save(model, schedulingList);
- return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
- }
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult GetCourseTimeOnlyUsable(QueryParamsModel pararms)
- //, Guid schoolYearID,IList<int?> schedulingWeekList, int weekday, Guid classroomID)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolYearID = pararms.getExtraGuid("schoolyearID");
- var weekNumList = pararms.getExtraString("weekNumList");
- var schedulingWeekList = weekNumList.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x.ParseStrTo<int>()).ToList();
- var weekday = pararms.getExtraInt("weekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekDay");
- var classroomID = pararms.getExtraGuid("classroomID");
- var result = ClassroomExcessiveUseServices.GetCoursesTimeViewGrid(configuretView, schoolYearID.Value, schedulingWeekList, weekday.Value, classroomID.Value, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- }
- }
|