using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Bowin.Web.Controls.Mvc; using Bowin.Common.Data; using Bowin.Common.Utility; using EMIS.Utility; using EMIS.Web.Controls; using EMIS.ViewModel; using EMIS.CommonLogic.GraduationManage.GraduateCardManage; namespace EMIS.Web.Controllers.GraduationManage.GraduateCardManage { [Authorization] public class GraduateCardListController : Controller { public IGraduateCardListServices GraduateCardListServices { get; set; } /// /// 去向名单页面 /// /// public ActionResult List() { return View(); } /// /// 去向名单列表查询 /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown"); 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 graduationTypeID = pararms.getExtraInt("DictionaryGraduationType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGraduationType"); //在校状态 var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus"); //去向结论 var needCardResult = pararms.getExtraInt("DictionaryNeedCardResult") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryNeedCardResult"); return base.Json(GraduateCardListServices.GetGraduateCardListViewGrid(configuretView, gradSchoolyearID, campusID, collegeID, yearID, standardID, educationID, learningformID, learnSystem, graduationTypeID, inSchoolStatus, needCardResult, (int)pararms.page, (int)pararms.rows)); } /// /// 删除 /// /// /// [HttpPost] public ActionResult Delete(string graduateCardApplyIDs) { try { List list = graduateCardApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)) .Select(x => (Guid?)new Guid(x)).ToList(); GraduateCardListServices.GraduateCardListDelete(list); return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" }); } catch (Exception ex) { return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + ex.Message }); } } /// /// Excel导出 /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].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 graduationTypeID = Request.Form["DictionaryGraduationType"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGraduationType"].ParseStrTo(); //在校状态 var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo(); //去向结论 var needCardResult = Request.Form["DictionaryNeedCardResult"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryNeedCardResult"].ParseStrTo(); var dt = GraduateCardListServices.GetGraduateCardListViewList(configuretView, gradSchoolyearID, campusID, collegeID, yearID, standardID, educationID, learningformID, learnSystem, graduationTypeID, inSchoolStatus, needCardResult) .Select(x => new { x.GraduatingSemesterCode, x.StudentNo, x.UserName, x.SexName, x.GraduationTypeName, BirthDate = x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : "", x.StandardID, x.StandardCode, x.StandardName, x.SchoolyearID, x.CampusName, x.CollegeNo, x.CollegeName, x.GrademajorCode, x.GrademajorName, x.ClassNo, x.ClassName, x.EducationName, x.LearningformName, LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : null, x.ExamineeNum, x.NationName, x.PoliticsName, x.IDNumber, EntranceDate = x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : "", x.ZIPCode, x.Telephone, x.Address, x.InSchoolStatusName, x.StudentStatusName, x.FinallyScoreCount, x.NeedCardResultName, x.ApprovalStatusName, x.Remark }).ToTable(); string[] liststring = { "毕业学期", "学号", "姓名", "性别", "毕业类型", "出生日期", "专业ID(Value)", "专业代码", "专业名称", "年级", RSL.Get("CampusName"), RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "年级专业编号", "年级专业名称", "班级编号", "班级名称", RSL.Get("EducationID"), "学习形式", "学制", "考生号", "民族", "政治面貌", "身份证号", "入学日期", "邮政编码", "联系电话", "通讯地址", "在校状态", "学籍状态", "已修门数", "去向结论", "审核状态", "备注" }; neh.Export(dt, liststring, "去向名单信息" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }