using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Bowin.Web.Controls.Mvc;
using Bowin.Common.Utility;
using Bowin.Common.Data;
using EMIS.Web.Controls;
using EMIS.Utility;
using EMIS.ViewModel;
using EMIS.ViewModel.EducationManage.EducationArrange;
using EMIS.CommonLogic.EducationManage.EducationArrange;
namespace EMIS.Web.Controllers.EducationManage.EducationArrange
{
[Authorization]
public class EducationMissionClassStudentController : Controller
{
public IEducationMissionClassStudentServices EducationMissionClassStudentServices { get; set; }
///
/// 任务名单(教学任务班)页面
///
///
public ActionResult List()
{
return View();
}
///
/// 任务名单(教学任务班)列表查询
///
///
///
[HttpPost]
public ActionResult List(QueryParamsModel pararms)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
var campusID = pararms.getExtraGuid("CampusDropdown");
var collegeID = pararms.getExtraGuid("CollegeDropdown");
var yearID = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
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("ClassmajorComboGrid");
var coursematerialID = pararms.getExtraGuid("CourseComboGrid");
var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
return base.Json(EducationMissionClassStudentServices.GetEducationMissionClassStudentViewGrid(configuretView, schoolyearID, campusID, collegeID,
yearID, standardID, educationID, learningformID, learnSystem, classmajorID, coursematerialID, inSchoolStatus, approvalStatus, (int)pararms.page, (int)pararms.rows));
}
///
/// 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 campusID = Request.Form["CampusDropdown"].ParseStrTo();
var collegeID = Request.Form["CollegeDropdown"].ParseStrTo();
var yearID = Request.Form["DictionarySchoolyear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySchoolyear"].ParseStrTo();
var standardID = Request.Form["DictionaryStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].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["ClassmajorComboGrid"].ParseStrTo();
var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo();
var inschoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo();
var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo();
var dt = EducationMissionClassStudentServices.GetEducationMissionClassStudentViewList(configuretView, schoolyearID, campusID, collegeID, yearID,
standardID, educationID, learningformID, learnSystem, classmajorID, coursematerialID, inschoolStatus, approvalStatus)
.Select(x => new
{
x.StudentNo,
x.Name,
x.SexName,
x.InSchoolStatusName,
x.StudentStatusName,
x.StandardID,
x.StandardCode,
x.StandardName,
x.EducationName,
x.LearningformName,
x.LearnSystem,
x.ClassmajorNo,
x.ClassmajorName,
x.ClassNum,
x.GradeID,
x.GrademajorCode,
x.GrademajorName,
x.CollegeCode,
x.CollegeName,
x.CampusNo,
x.CampusName,
x.SchoolyearCode,
x.MissionName,
x.MissionClassName,
x.SchedulingClassName,
x.MainScheduleClassNo,
x.MainScheduleClassName,
x.MissionSourceName,
x.MissionTypeName,
x.OrderNo,
x.CourseCode,
x.CourseName,
x.DepartmentName,
x.CourseCollegeName,
x.CourseStructureName,
x.CourseCategoryName,
x.CourseTypeName,
x.CourseQualityName,
Credit = x.Credit.HasValue ? x.Credit.Value.ToString("#.#") : null,
x.TheoryCourse,
x.Practicehours,
x.Trialhours,
x.Totalhours,
x.ExecHours,
x.TheoryWeeklyNum,
x.PracticeWeeklyNum,
x.TrialWeeklyNum,
x.SchoolweeksNum,
x.WeeklyHours,
x.WeeklyNum,
x.StartWeeklyNum,
x.EndWeeklyNum,
x.StartEndWeeklyNum,
x.ExecWeeklyNum,
x.ClassroomTypeName,
x.ClassroomCode,
x.ClassroomName,
x.IsNeedMaterialName,
x.TeachinglanguageName,
x.ExaminationModeName,
x.ResultTypeName,
x.HandleModeName,
x.TeachingModeName,
x.ApprovalStatusName,
x.Remark
}).ToTable();
string[] liststring = {
"学号", "姓名", "性别", "在校状态", "学籍状态", "专业ID(Value)", "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式",
"学制", "班级编号", "班级名称", "班序", "年级", "年级专业编号", "年级专业名称", RSL.Get("CollegeCode"), RSL.Get("CollegeName"),
RSL.Get("CampusCode"), RSL.Get("Campus"), "学年学期", "任务名称", "任务班名称", "排课班名称", "主排课班级编号", "主排课班级名称",
"任务来源", "任务类型", "任务班序", "课程代码", "课程名称", "开课教研室", "开课院系", "课程结构", "课程属性", "课程类型",
"课程性质", "课程学分", "理论学时", "实践学时", "实验学时", "总学时", "执行学时", "理论周次", "实践周次", "实验周次", "总周次",
"周学时", "每周次数", "开始周次", "结束周次", "起止周次", "执行周次", "教室类型", "教室编号", "教室名称", "是否需要教材",
"授课语言", "考试方式", "成绩类型", "处理方式", "授课方式", "状态", "备注"
};
neh.Export(dt, liststring, "任务名单信息" + DateTime.Now.ToString("yyyyMMdd"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
}
}