using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.CommonLogic.SchedulingManage.SchedulingSettings;
using EMIS.ViewModel;
using EMIS.CommonLogic.UniversityManage.SpecialtyClassManage;
using EMIS.Entities;
using EMIS.ViewModel.CalendarManage;
using Bowin.Web.Controls.Mvc;
namespace EMIS.Web.Controllers.SchedulingManage.SchedulingSettings
{
[Authorization]
public class ClassmajorScheduleSettingController : Controller
{
public IClassmajorScheduleSettingServices classmajorScheduleSettingServices { get; set; }
public IClassmajorServices classmajorServices { get; set; }
//
// GET: /ClassmajorScheduleSetting/
public ActionResult List()
{
return View();
}
[HttpPost]
public ActionResult List(QueryParamsModel pararms)
{
var collegeID = pararms.getExtraGuid("CollegeComboGrid");
var StandardID = pararms.getExtraInt("DictionaryStandard");
var gradeYearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
return Json(classmajorScheduleSettingServices.GetClassmajorScheduleSettingViewGrid(classmajorID, StandardID, collegeID, gradeYearID, (int)pararms.page, (int)pararms.rows));
}
public ActionResult Edit(Guid? classmajorID)
{
CF_Classmajor classmajor = classmajorServices.GetClassmajorInfo(classmajorID);
return View(classmajor);
}
///
/// 保存
///
///
[HttpPost]
public ActionResult Edit()
{
try
{
Guid? classmajorID = new Guid(Request.Form["ClassmajorID"]);
var arrangementsList = DataGrid.GetTableData("dgArrangementsList");
classmajorScheduleSettingServices.ClassmajorScheduleSettingAdd(arrangementsList, classmajorID);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存成功!"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存失败,原因:" + ex.Message + "!"
});
}
}
///
/// 删除
///
///
///
[HttpPost]
public ActionResult Delete(string classmajorIDs)
{
try
{
List list = new List();
for (int i = 0; i < classmajorIDs.Split(',').Length; i++)
{
if (!string.IsNullOrEmpty(classmajorIDs.Split(',')[i]))
{
Guid classmajorID = new Guid(classmajorIDs.Split(',')[i]);
list.Add(classmajorID);
}
}
classmajorScheduleSettingServices.ClassmajorScheduleSettingDelete(list);
return Json("删除成功");
}
catch (Exception ex)
{
return Json("删除失败,原因:" + ex.Message);
}
}
///
/// 查看是否设置的排课时间
///
///
///
[HttpPost]
public ActionResult ArrangementsList(Guid? classmajorID)
{
return Json(classmajorScheduleSettingServices.GetArrangementViewGrid(classmajorID));
}
}
}