using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.ViewModel;
using EMIS.Web.Controls;
using Bowin.Web.Controls.Mvc;
using EMIS.CommonLogic.RetakeManage;
using Bowin.Common.Utility;
using Bowin.Common.Data;
using EMIS.CommonLogic.RetakeManage.General;
using EMIS.ViewModel.RetakeManage;
using EMIS.Utility.FormValidate;
using Bowin.Common.Linq.Entity;
using Bowin.Common.JSON;
using EMIS.Utility;
namespace EMIS.Web.Controllers.RetakeManage.General
{
[Authorization]
public class RetakePlanResultController : Controller
{
public IRetakePlanResultServices RetakePlanResultServices { get; set; }
///
/// 重修名单页面
///
///
public ActionResult List()
{
return View();
}
///
/// 重修名单列表查询
///
///
///
[HttpPost]
public ActionResult List(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("SchoolYearDropdown").ToString() == DropdownList.SELECT_ALL.ToString() ? null : pararms.getExtraGuid("SchoolYearDropdown");
var collegeID = pararms.getExtraGuid("CollegeDropdown");
var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
//在校状态
var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
//重修任务状态
var retakePlanStatusID = pararms.getExtraInt("DictionaryRetakePlanStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryRetakePlanStatus");
//报名状态
var generalPurposeID = pararms.getExtraInt("DictionaryGeneralPurpose") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGeneralPurpose");
return Json(RetakePlanResultServices.GetRetakePlanResultStudentView(configuretView, schoolyearID, collegeID, yearID, standardID,
educationID, learningformID, learnSystem, classmajorID, coursematerialID, inSchoolStatus, retakePlanStatusID,
generalPurposeID, (int)pararms.page, (int)pararms.rows));
}
///
/// 取消报名(删除)
///
///
///
[HttpPost]
public ActionResult Delete(string RetakePlanStudentIDs)
{
try
{
RetakePlanResultServices.RetakePlanResultDelete(RetakePlanStudentIDs);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "取消报名成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "取消报名失败,原因:" + ex.Message
});
}
}
///
/// Excel导出
///
///
[HttpPost]
public ActionResult Excel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolyearID = Request.Form["SchoolYearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo();
var collegeID = Request.Form["CollegeDropdown"].ParseStrTo();
var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo();
var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo();
var educationID = Request.Form["DictionaryEducation"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo();
var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo();
var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo();
var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo();
//在校状态
var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo();
//重修任务状态
var retakePlanStatusID = Request.Form["DictionaryRetakePlanStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryRetakePlanStatus"].ParseStrTo();
//报名状态
var generalPurposeID = Request.Form["DictionaryGeneralPurpose"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGeneralPurpose"].ParseStrTo();
var dt = RetakePlanResultServices.GetRetakePlanResultStudentViewList(configuretView, schoolyearID, collegeID, yearID, standardID,
educationID, learningformID, learnSystem, classmajorID, coursematerialID, inSchoolStatus,
retakePlanStatusID, generalPurposeID)
.Select(x => new
{
x.SchoolyearCode,
x.ClassName,
x.RetakeTypeName,
x.LoginID,
x.UserName,
x.SexName,
x.Gradeyear,
x.StandardID,
x.StandardCode,
x.StandardDesc,
x.EducationName,
x.LearningformName,
x.LearnSystem,
x.ClassmajorCode,
x.ClassmajorName,
x.GrademajorCode,
x.GrademajorName,
x.CollegeNo,
x.CollegeName,
x.CourseCode,
x.CourseName,
x.CourseTypeDesc,
x.CourseCredit,
x.SchoolyearNumDesc,
x.StarttermDesc,
x.DepartmentCode,
x.DepartmentName,
x.InSchoolStatusName,
x.StudentStatusName,
x.RecordStatusName,
x.ApplyStatusName
}).ToTable();
string[] liststring = {
"重修学年学期", "重修班级名称", "重修类型", "学号", "姓名", "性别", "年级", "专业ID(Value)",
"专业代码", "专业名称", RSL.Get("EducationID"), "学习形式", "学制", "班级编号", "班级名称",
"年级专业编号", "年级专业名称", RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "课程代码",
"课程名称", "课程类型", "课程学分", "开课学年", "开课学期", "开课教研室代码", "开课教研室",
"在校状态", "学籍状态", "重修任务状态", "报名状态"
};
neh.Export(dt, liststring, "重修班级名单信息" + DateTime.Now.ToString("yyyyMMddhhmmss"));
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出成功。",
url = Url.Content("~/RetakePlanResult/List").AddMenuParameter()
});
}
}
}