using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.SchedulingManage.ScheduleApproval; using EMIS.ViewModel; using Bowin.Web.Controls.Mvc; using EMIS.CommonLogic.CalendarManage; namespace EMIS.Web.Controllers.SchedulingManage.ScheduleApproval { [Authorization] public class CollegeScheduleApprovalController : Controller { public ICollegeScheduleApprovalServices collegeScheduleApprovalServices { get; set; } public ISchoolYearServices SchoolYearServices { get; set; } // // GET: /CollegeScheduleApproval/ public ActionResult List() { var schoolYearView = SchoolYearServices.GetSchoolYearIsCurrent(true); var schoolyear = SchoolYearServices.GetSchoolYearViewListAfterCurrent().OrderBy(x => x.Code).Where(x => x.Value > schoolYearView.Value).FirstOrDefault(); ViewBag.SchoolYearID = schoolyear.SchoolYearID; ViewBag.StartStatus = collegeScheduleApprovalServices.GetStartStatus(); return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { //ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var SchoolyearID = pararms.getExtraGuid("SchoolyearDropdownList"); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus"); return base.Json(collegeScheduleApprovalServices.GetCollegeScheduleApprovalViewGrid(SchoolyearID, collegeID, approvalStatus, (int)pararms.page, (int)pararms.rows)); } [HttpPost] public ActionResult Submit(string collegeScheduleStatusIDs, string collegeIDs, Guid schoolYearID) { try { List list = new List(); for (int i = 0; i < collegeScheduleStatusIDs.Split(',').Length; i++) { string id = collegeScheduleStatusIDs.Split(',')[i]; if (!string.IsNullOrEmpty(id)) { list.Add(new Guid(id)); } } List collegelist = new List(); for (int i = 0; i < collegeIDs.Split(',').Length; i++) { string id = collegeIDs.Split(',')[i]; if (!string.IsNullOrEmpty(id)) { collegelist.Add(new Guid(id)); } } collegeScheduleApprovalServices.Submit(list, collegelist, schoolYearID); return base.Json("提交成功"); } catch (Exception ex) { string mge = ex.Message; return base.Json("提交失败,原因:" + mge); } } [HttpPost] public ActionResult Approve(string collegeScheduleStatusIDs) { try { List list = new List(); for (int i = 0; i < collegeScheduleStatusIDs.Split(',').Length; i++) { string id = collegeScheduleStatusIDs.Split(',')[i]; if (!string.IsNullOrEmpty(id)) { list.Add(new Guid(id)); } } collegeScheduleApprovalServices.Approve(list); return base.Json("审核成功"); } catch (Exception ex) { string mge = ex.Message; return base.Json("审核失败,原因:" + mge); } } [HttpPost] public ActionResult ReturnBack(string collegeScheduleStatusIDs) { try { List list = new List(); for (int i = 0; i < collegeScheduleStatusIDs.Split(',').Length; i++) { string id = collegeScheduleStatusIDs.Split(',')[i]; if (!string.IsNullOrEmpty(id)) { list.Add(new Guid(id)); } } collegeScheduleApprovalServices.ReturnBack(list); return base.Json("撤回成功"); } catch (Exception ex) { string mge = ex.Message; return base.Json("撤回失败,原因:" + mge); } } // // GET: /CollegeScheduleApproval/Details/5 public ActionResult Details(int id) { return View(); } // // GET: /CollegeScheduleApproval/Create public ActionResult Create() { return View(); } // // POST: /CollegeScheduleApproval/Create [HttpPost] public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here return RedirectToAction("Index"); } catch { return View(); } } // // GET: /CollegeScheduleApproval/Edit/5 public ActionResult Edit(int id) { return View(); } // // POST: /CollegeScheduleApproval/Edit/5 [HttpPost] public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here return RedirectToAction("Index"); } catch { return View(); } } // // GET: /CollegeScheduleApproval/Delete/5 public ActionResult Delete(int id) { return View(); } // // POST: /CollegeScheduleApproval/Delete/5 [HttpPost] public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here return RedirectToAction("Index"); } catch { return View(); } } [HttpPost] public ActionResult GetStatusList(DropdownListBindType? bindType) { List list = this.collegeScheduleApprovalServices.GetStatusViewList() .Select(x => new DropdownListItem { Text = x.Name, Value = x.ID }).ToList(); DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value; DropdownList.FormatDropdownItemList(dbt, list); return base.Json(list); } } }