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.Common.Utility;
using EMIS.CommonLogic.RetakeManage;
using Bowin.Web.Controls.Mvc;
using Bowin.Common.Data;
using EMIS.ViewModel.RetakeManage;
using EMIS.CommonLogic.RetakeManage.General;
using EMIS.Utility;
namespace EMIS.Web.Controllers.RetakeManage.General
{
[Authorization]
public class RetakePlanPrescanGeneralController : Controller
{
public IRetakePlanTaskServices RetakePlanServices { get; set; }
///
/// 学生预查页面(网上报名版本)
///
///
public ActionResult List()
{
return View();
}
///
/// 学生预查(网上报名版本)列表查询
///
///
///
[HttpPost]
public ActionResult List(QueryParamsModel pararms)
{
try
{
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 departmentID = pararms.getExtraGuid("DepartmentDropdown");
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 inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
//考试性质
var examsCategoryID = pararms.getExtraInt("DictionaryExamsCategory") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryExamsCategory");
var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
//课程类型List
var courseTypeIDs = pararms.getExtraString("CourseTypeID");
return Json(RetakePlanServices.GetRetakePreStudentView(configuretView, schoolyearID, collegeID, departmentID, yearID,
standardID, educationID, learningformID, learnSystem, classmajorID, inSchoolStatus, examsCategoryID,
coursematerialID, courseTypeIDs, (int)pararms.page, (int)pararms.rows));
}
catch (Exception ex)
{
//页面弹出消息框
return base.Json("查询失败,原因:" + ex.Message);
}
}
///
/// 重修任务生成页面
///
///
public ActionResult Generate()
{
RetakeStudentListView retakeStudentListView = new RetakeStudentListView();
retakeStudentListView.RetakeTypeID = (int)ER_RetakeType.Retake; //重修类型默认为正常重修
return View(retakeStudentListView);
}
///
/// 重修任务生成确定
///
///
///
///
[HttpPost]
public ActionResult Generate(string finallyScoreIDs, RetakeStudentListView retakeStudentListView)
{
try
{
//最终成绩信息IDList
var finallyScoreIDList = finallyScoreIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
.Select(x => (Guid?)new Guid(x)).ToList();
string result = RetakePlanServices.Generate(finallyScoreIDList, retakeStudentListView.RetakeTypeID);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "生成成功" + result + "。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "生成失败,原因:" + ex.Message + "。"
});
}
}
///
/// Excel导出
///
///
[HttpPost]
public ActionResult Excel()
{
try
{
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 departmentID = Request.Form["DepartmentDropdown"].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 inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo();
var examsCategoryID = Request.Form["DictionaryExamsCategory"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryExamsCategory"].ParseStrTo();
var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo();
var courseTypeIDs = Request.Form["CourseTypeID"].ToString();
var dt = RetakePlanServices.GetRetakePreStudentViewList(configuretView, schoolyearID, collegeID, departmentID, yearID,
standardID, educationID, learningformID, learnSystem, classmajorID, inSchoolStatus, examsCategoryID,
coursematerialID, courseTypeIDs)
.Select(x => new
{
x.LoginID,
x.UserName,
x.SexName,
x.ClassmajorCode,
x.ClassmajorName,
x.GrademajorCode,
x.GrademajorName,
x.CollegeNo,
x.CollegeName,
x.Gradeyear,
x.StandardID,
x.StandardCode,
x.StandardDesc,
x.EducationName,
x.LearningformName,
x.LearnSystem,
x.SchoolyearCode,
x.CourseCode,
x.CourseName,
x.CourseTypeDesc,
x.CourseCredit,
x.ExamsCategoryDesc,
x.ExamsStateDesc,
x.SchoolyearNumDesc,
x.StarttermDesc,
x.TotalScore,
x.DepartmentCode,
x.DepartmentName,
x.InSchoolStatusName,
x.StudentStatusName
}).ToTable();
string[] liststring = {
"学号", "姓名", "性别", "班级编号", "班级名称", "年级专业编号", "年级专业名称",
RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "年级", "专业ID(Value)", "专业代码",
"专业名称", RSL.Get("EducationID"), "学习形式", "学制", "学年学期", "课程代码",
"课程名称", "课程类型", "课程学分", "考试性质", "考试状态", "开课学年", "开课学期",
"总成绩", "开课教研室代码", "开课教研室", "在校状态", "学籍状态"
};
neh.Export(dt, liststring, "学生预查信息" + DateTime.Now.ToString("yyyyMMddhhmmss"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
catch (Exception ex)
{
//页面弹出消息框
return base.Json("导出失败,原因:" + ex.Message);
}
}
}
}