using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.ViewModel;
using EMIS.CommonLogic.SelectCourse.SelectCourseResult;
using EMIS.Web.Controls;
using EMIS.Utility.FormValidate;
using EMIS.CommonLogic.SelectCourse;
using Bowin.Web.Controls.Mvc;
namespace EMIS.Web.Controllers.StudentSystem.SelectCourse
{
[Authorization]
public class StudentSelectCourseController : Controller
{
public IStudentSelectCourseServices StudentSelectCourseServices { get; set; }
public IConditionServices ConditionServices { get; set; }
public IOpenControlSettingServices OpenControlSettingServices { get; set; }
public ITypeSettingServices TypeSettingServices { get; set; }
public ISelectCourseResultServices SelectCourseResultServices { get; set; }
///
/// 学生选课页面
///
///
public ActionResult List()
{
var studentSelectCourseView = StudentSelectCourseServices.GetStudentSelectCourseSummaryView(CustomPrincipal.Current.UserID);
ViewBag.IsHidden = !studentSelectCourseView.isInSchool; //是否在校生
return View(studentSelectCourseView);
}
[HttpPost]
public ActionResult List(QueryParamsModel pararms)
{
return base.Json(StudentSelectCourseServices.GetStudentSelectCourseResultViewList(CustomPrincipal.Current.UserID, pararms.page, pararms.rows));
}
public ActionResult SelectedList()
{
return View();
}
[HttpPost]
public ActionResult SelectedList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("SchoolYear");
var collegeID = pararms.getExtraGuid("CollegeComboGrid");
var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == -1 ? null : pararms.getExtraInt("DictionaryCourseType");
var selectCourseTypeID = pararms.getExtraInt("DictionarySelectCourseType") == -1 ? null : pararms.getExtraInt("DictionarySelectCourseType");
var result = StudentSelectCourseServices.GetSelectedCourseViewList(configuretView, schoolyearID, collegeID, coursematerialID, courseTypeID, selectCourseTypeID, 1, 10);
return base.Json(result);
}
public ActionResult CanceledList()
{
return View();
}
[HttpPost]
public ActionResult CanceledList(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var result = StudentSelectCourseServices.GetCanceledCourseViewList(configuretView, 1, 10);
return base.Json(result);
}
[HttpPost]
public ActionResult SelectCourse(Guid? grademajorID, Guid coursematerialID, int selectCourseTypeID, string teacherIDs, Guid ID)
{
try
{
this.StudentSelectCourseServices.SelectCourse(CustomPrincipal.Current.UserID, grademajorID, coursematerialID, selectCourseTypeID, teacherIDs, ID);
return Json(new ReturnMessage
{
IsSuccess = true,
Message = "选课成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage
{
IsSuccess = false,
Message = "操作失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult CancelSelectCourse(Guid? grademajorID, Guid coursematerialID, int selectCourseTypeID, string teacherIDs, Guid ID)
{
try
{
this.StudentSelectCourseServices.CancelSelectCourse(CustomPrincipal.Current.UserID, grademajorID, coursematerialID, selectCourseTypeID, teacherIDs,ID);
return Json(new ReturnMessage
{
IsSuccess = true,
Message = "退选成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage
{
IsSuccess = false,
Message = "操作失败:" + ex.Message
});
}
}
}
}