123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Common.Data;
- using Bowin.Common.Exceptions;
- using Bowin.Common.Utility;
- using Bowin.Web.Controls.Mvc;
- using EMIS.Utility;
- using EMIS.Web.Controls;
- using EMIS.ViewModel;
- using EMIS.ViewModel.UniversityManage.TeacherManage;
- using EMIS.CommonLogic.UniversityManage.TeacherManage;
- namespace EMIS.Web.Controllers.UniversityManage.TeacherManage
- {
- [Authorization]
- public class StaffController : Controller
- {
- public Lazy<IStaffServices> staffServices { get; set; }
- /// <summary>
- /// 教师信息页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 教师信息页面列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var campusID = pararms.getExtraGuid("CampusDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var departmentID = pararms.getExtraGuid("DepartmentDropdown");
- var isPhotoUrl = pararms.getExtraInt("IsPhotoUrlDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoUrlDropdown");
- var teacherTypeID = pararms.getExtraInt("DictionaryTeacherType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeacherType");
- var incumbencyState = pararms.getExtraInt("DictionaryIncumbencyState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIncumbencyState");
- var titleID = pararms.getExtraInt("DictionaryTitle") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTitle");
- var isDualTeacher = pararms.getExtraInt("IsDualTeacherDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsDualTeacherDropdown");
- return base.Json(staffServices.Value.GetStaffViewGrid(configuretView, campusID, collegeID, departmentID, isPhotoUrl, teacherTypeID,
- incumbencyState, titleID, isDualTeacher, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 教师信息页面列表查询(无数据范围)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ListWithNoDataRange(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var campusID = pararms.getExtraGuid("CampusDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var departmentID = pararms.getExtraGuid("DepartmentDropdown");
- var isPhotoUrl = pararms.getExtraInt("IsPhotoUrlDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoUrlDropdown");
- var teacherTypeID = pararms.getExtraInt("DictionaryTeacherType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeacherType");
- var incumbencyState = pararms.getExtraInt("DictionaryIncumbencyState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIncumbencyState");
- var titleID = pararms.getExtraInt("DictionaryTitle") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTitle");
- var isDualTeacher = pararms.getExtraInt("IsDualTeacherDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsDualTeacherDropdown");
- return base.Json(staffServices.Value.GetStaffViewGridWithNoDataRange(configuretView, campusID, collegeID, departmentID, isPhotoUrl,
- teacherTypeID, incumbencyState, titleID, isDualTeacher, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 教师信息列表
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ListForTeacherEdit(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var campusID = pararms.getExtraGuid("CampusDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var loginID = pararms.getExtraString("LoginID");
- var name = pararms.getExtraString("Name");
- return base.Json(staffServices.Value.GetStaffViewGrid(configuretView, campusID, collegeID, loginID, name, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 教师信息查询
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="userID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetStaffDataBind(DropdownListBindType? bindType, Guid? userID)
- {
- List<DropdownListItem> list = new List<DropdownListItem>();
- list = staffServices.Value.GetListStaffView(userID).Select(x => new DropdownListItem
- {
- Text = x.Name,
- Value = x.UserID.ToString()
- }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, list);
- return base.Json(list);
- }
- /// <summary>
- /// 教师信息查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetAllStaffDataBind(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- return base.Json(staffServices.Value.GetAllStaffView(configuretView, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 教师信息查询
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="departmentID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetDepartmentStaffDataBind(DropdownListBindType? bindType, Guid? departmentID)
- {
- List<DropdownListItem> list = new List<DropdownListItem>();
- list = staffServices.Value.GetStaffViewList(new ConfiguretView(), null, null, departmentID, null, null, null, null, null)
- .Select(x => new DropdownListItem
- {
- Text = x.Name,
- Value = x.UserID.ToString()
- }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, list);
- return base.Json(list);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid userID)
- {
- StaffView staffView = new StaffView();
- staffView = staffServices.Value.GetStaffView(userID);
- return View("Edit", staffView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="staffView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(StaffView staffView)
- {
- staffView.UserID = Guid.Empty;
- return this.Edit(staffView);
- }
- /// <summary>
- /// 编辑、复制新增(新增、修改,业务主键:教职工号或证件号码)
- /// </summary>
- /// <param name="newUserID"></param>
- /// <param name="type"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? newUserID, string type)
- {
- StaffView staffView = new StaffView();
- if (newUserID.HasValue && newUserID != Guid.Empty)
- {
- staffView = staffServices.Value.GetStaffView(newUserID);
- if (type == "copyAdd")
- {
- staffView.UserID = Guid.Empty;
- staffView.StaffCode = null;
- staffView.Name = null;
- staffView.CertificatesType = (int)CF_CertificatesType.IdCrad;
- staffView.CertificatesNum = null;
- staffView.CollegeID = null;
- staffView.DepartmentID = null;
- staffView.PhotoUrl = null;
- }
- }
- else
- {
- staffView.NationID = (int)CF_Nation.Han;
- staffView.PoliticsID = (int)CF_Politics.YouthLeague;
- staffView.CertificatesType = (int)CF_CertificatesType.IdCrad;
- staffView.TeacherTypeID = (int)CF_TeacherType.Internal;
- staffView.IncumbencyState = (int)CF_IncumbencyState.Incumbency;
- staffView.HealthStateID = (int)CF_HealthState.Healthy;
- }
- return View(staffView);
- }
- /// <summary>
- /// 编辑、复制新增(新增、修改,业务主键:教职工号或证件号码)
- /// </summary>
- /// <param name="staffView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(StaffView staffView)
- {
- try
- {
- var accepts = new List<string> { ".jpg", ".jpeg", ".png", ".bmp" };
- var postedFile = Request.Files["PhotoUrl"];
- if (postedFile != null && !string.IsNullOrEmpty(postedFile.FileName) && !accepts.Contains(Path.GetExtension(postedFile.FileName).ToLower()))
- {
- throw new Exception("只允许上传.jpg、.jpeg、.png、.bmp格式的文件。");
- }
- string photoUrl = FileUploadHelper.UploadFile(postedFile);
- staffServices.Value.StaffEdit(staffView, photoUrl);
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "保存成功。",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- catch (Exception ex)
- {
- return RedirectToAction("MsgShowAndOpen", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="userIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string userIDs)
- {
- try
- {
- List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- staffServices.Value.StaffDelete(list);
- return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- if (num != null)
- {
- if (num.Number == 547)
- {
- mge = "请先删除与其关联的数据,如:期末设定、补考设定、教学任务、教师课表等。";
- }
- }
- return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + mge });
- }
- }
- /// <summary>
- /// 验证
- /// </summary>
- /// <param name="collegeID"></param>
- /// <param name="departmentID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Verification(Guid? collegeID, Guid? departmentID)
- {
- return Json(staffServices.Value.GetVerification(collegeID, departmentID));
- }
- /// <summary>
- /// 删除照片(单个删除)
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DeletePhoto(Guid? userID)
- {
- try
- {
- this.staffServices.Value.DeletePhoto(userID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除照片成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除照片失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除照片(批量删除)
- /// </summary>
- /// <param name="userIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PicDelete(string userIDs)
- {
- try
- {
- List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- staffServices.Value.PicDelete(list);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除照片成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除照片失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 导入照片
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult PicImport()
- {
- return View();
- }
- /// <summary>
- /// 导入照片
- /// </summary>
- /// <param name="file"></param>
- /// <param name="importPicType"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PicImport(HttpPostedFileBase file, string importPicType)
- {
- try
- {
- if (file.ContentLength <= 0)
- {
- throw new Exception("请选择你要上传的照片(注:格式为zip或rar的压缩包文件)。");
- }
- var acceptFileExtensions = new[] { ".zip", ".rar" };
- var p = Path.GetExtension(file.FileName);
- if (!acceptFileExtensions.Contains(p))
- {
- throw new Exception("格式错误,只允许上传zip或rar格式的压缩包文件。");
- }
- var photoPaths = FileUploadHelper.UploadFileAndExtractFile(file);
- if (photoPaths.Count <= 0)
- {
- throw new Exception("压缩包中没有相关格式的文件。");
- }
- List<string> listphotoPaths = new List<string>();
- var acceptPicExtensions = new[] { ".jpg", ".jpeg", ".png", ".bmp" };
- foreach (var path in photoPaths)
- {
- string pathName = Path.GetExtension(path).ToLower();
- if (acceptPicExtensions.Contains(pathName))
- {
- listphotoPaths.Add(path);
- }
- //{
- // throw new Exception("压缩包中含有不支持的照片格式。");
- //}
- //if (!acceptPicExtensions.Contains(Path.GetExtension(path)))
- //{
- // throw new Exception("压缩包中含有不支持的照片格式。");
- //}
- }
- staffServices.Value.StaffPicImport(listphotoPaths, importPicType);
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "导入照片成功。",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- catch (Exception ex)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = "none",
- msg = "导入照片失败,原因:" + ex.Message,
- url = Url.Action("PicImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"]
- });
- }
- }
- /// <summary>
- /// Excel导入
- /// </summary>
- /// <param name="errorFile"></param>
- /// <param name="operationTips"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Import(string errorFile, string operationTips)
- {
- ViewBag.ErrorFile = errorFile;
- if (string.IsNullOrEmpty(operationTips))
- {
- operationTips = "点击查看失败原因...";
- }
- ViewBag.operationTips = operationTips;
- return View();
- }
- /// <summary>
- /// Excel导入
- /// </summary>
- /// <param name="file"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Import(HttpPostedFileBase file)
- {
- try
- {
- if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
- {
- throw new Exception("格式错误,只允许导入xls或xlsx格式的Excel文件。");
- }
- Dictionary<string, string> cellheader = new Dictionary<string, string>
- {
- { "StaffCode", "教职工号" },
- { "Name", "姓名" },
- { "UsedName", "曾用名" },
- { "SexStr", "性别" },
- { "BirthDateStr", "出生日期" },
- { "NationStr", "民族" },
- { "PoliticsStr", "政治面貌" },
- { "CollegeName", RSL.Get("College") },
- { "DepartmentName", "所属教研室" },
- { "CertificatesTypeStr", "证件类型" },
- { "CertificatesNum", "证件号码" },
- { "TeacherTypeStr", "教师类型" },
- { "IncumbencyStateStr", "在职状态" },
- { "SituationStr", "任课状况" },
- { "TitleStr", "职称" },
- { "LiteracyLevelStr", "文化程度" },
- { "LearnPositionStr", "学位" },
- { "IsDualTeacherStr", "是否双师型" },
- { "PaymentLevelStr", "课酬级别" },
- { "Nationality", "国籍" },
- { "Place", "籍贯" },
- { "WorkDateStr", "参加工作年月" },
- { "ComeSchoolDateStr", "来校年月" },
- { "Email", "电子邮箱" },
- { "ZIPCode", "邮政编码" },
- { "WeChatNum", "微信号" },
- { "QQ", "QQ" },
- { "Telephone", "家庭电话" },
- { "OfficeTelephone", "办公电话" },
- { "HousePhone", "住宅电话" },
- { "Mobile", "移动电话" },
- { "HealthStateStr", "健康状况" },
- { "ReligionStr", "宗教信仰" },
- { "Speciality", "特长" },
- { "Account", "银行卡号" },
- { "Residence", "户口所在地" },
- { "HomeAddress", "家庭住址" },
- { "Address", "通信地址" },
- { "NowAddress", "现住地址" },
- { "Profile", "简介" },
- { "Remark", "备注" },
- { "ErrorMessage", "未导入原因" }
- };
- StringBuilder errorMsg = new StringBuilder(); // 错误信息
- string sourceWebPath = FileUploadHelper.UploadFile(file);
- var sourcePhysicalPath = Server.MapPath(sourceWebPath);
- List<StaffView> errList = new List<StaffView>();
- List<StaffView> dataList = new List<StaffView>();
- int? inCount = 0; //导入个数
- int? upCount = 0; //更新个数
- int? errCount = 0; //失败个数
- //导入
- staffServices.Value.StaffImport(cellheader, out inCount, out upCount, out errList, out errCount, sourcePhysicalPath);
- System.IO.File.Delete(sourcePhysicalPath);//删除本地缓存文件
- if (errList.Count() > 0)
- {
- //获取错误数据文件路径
- string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, errList, "教师信息导入失败文件", sourcePhysicalPath));
- ViewBag.ErrorFile = errorWebPath;
- string Errinfo = string.Format("提示:{0}条教师信息导入成功,{1}条教师信息更新成功,{2}条教师信息导入失败,点击查看。", inCount, upCount, errCount);
- ViewBag.operationTips = Errinfo;
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = "none",
- msg = Errinfo,
- url = Url.Action("Import").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"]
- });
- }
- else
- {
- string successInfo = string.Format("提示:{0}条教师信息导入成功,{1}条教师信息更新成功。", inCount, upCount);
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = successInfo,
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- catch (Exception ex)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = "none",
- msg = "导入失败,原因:" + ex.Message,
- url = Url.Action("Import").AddMenuParameter() + "&WindowID=" + Request["WindowID"]
- });
- }
- }
- /// <summary>
- /// 教师对应的角色信息
- /// </summary>
- /// <returns></returns>
- public ActionResult RoleList()
- {
- return View();
- }
- /// <summary>
- /// 教师对应的角色信息
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult RoleList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var userID = Request["userID"].ParseStrTo<Guid>();
- var roleID = pararms.getExtraGuid("RoleDropdown");
- var dataRange = pararms.getExtraInt("DictionaryDataRange") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryDataRange");
- var roleStatus = pararms.getExtraInt("DictionaryRoleStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryRoleStatus");
- return base.Json(staffServices.Value.GetRoleListViewGrid(configuretView, userID, roleID, dataRange, roleStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 教师对应的角色信息Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult RoleListExcel()
- {
- return null;
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
- var isPhotoUrl = Request.Form["IsPhotoUrlDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsPhotoUrlDropdown"].ParseStrTo<int>();
- var teacherTypeID = Request.Form["DictionaryTeacherType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeacherType"].ParseStrTo<int>();
- var incumbencyState = Request.Form["DictionaryIncumbencyState"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIncumbencyState"].ParseStrTo<int>();
- var titleID = Request.Form["DictionaryTitle"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTitle"].ParseStrTo<int>();
- var isDualTeacher = Request.Form["IsDualTeacherDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsDualTeacherDropdown"].ParseStrTo<int>();
- var dt = staffServices.Value.GetStaffViewList(configuretView, campusID, collegeID, departmentID, isPhotoUrl, teacherTypeID, incumbencyState, titleID, isDualTeacher)
- .Select(x => new
- {
- x.StaffCode,
- x.Name,
- x.UsedName,
- x.SexName,
- BirthDate = x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyy-MM-dd") : "",
- x.NationName,
- x.PoliticsName,
- x.CampusCode,
- x.CampusName,
- x.CollegeNo,
- x.CollegeName,
- x.DepartmentCode,
- x.DepartmentName,
- x.CertificatesTypeName,
- x.CertificatesNum,
- x.TeacherTypeName,
- x.IncumbencyStateName,
- x.SituationName,
- x.TitleName,
- x.LiteracyLevelName,
- x.LearnPositionName,
- x.IsDualTeacherName,
- x.PaymentLevelName,
- x.Nationality,
- x.Place,
- WorkDate = x.WorkDate.HasValue ? x.WorkDate.Value.ToString("yyyy-MM") : "",
- ComeSchoolDate = x.ComeSchoolDate.HasValue ? x.ComeSchoolDate.Value.ToString("yyyy-MM") : "",
- x.Email,
- x.ZIPCode,
- x.WeChatNum,
- x.QQ,
- x.Telephone,
- x.OfficeTelephone,
- x.HousePhone,
- x.Mobile,
- x.HealthStateName,
- x.ReligionName,
- x.Speciality,
- x.Account,
- x.Residence,
- x.HomeAddress,
- x.Address,
- x.NowAddress,
- x.PhotoUrl,
- x.Profile,
- x.RoleCount,
- x.AccountStatusName,
- x.Remark
- }).ToTable();
- string[] liststring = {
- "教职工号", "姓名", "曾用名", "性别", "出生日期", "民族", "政治面貌", RSL.Get("CampusCode"),
- RSL.Get("Campus"), RSL.Get("CollegeCode"), RSL.Get("College"), "所属教研室代码", "所属教研室",
- "证件类型", "证件号码", "教师类型", "在职状态", "任课状况", "职称", "文化程度", "学位", "是否双师型",
- "课酬级别", "国籍", "籍贯", "参加工作年月", "来校年月", "电子邮箱", "邮政编码", "微信号", "QQ",
- "家庭电话", "办公电话", "住宅电话", "移动电话", "健康状况", "宗教信仰", "特长", "银行卡号",
- "户口所在地", "家庭住址", "通信地址", "现住地址", "照片地址", "简介", "角色数", "帐号状态", "备注"
- };
- neh.Export(dt, liststring, "教职工信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|