using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.CommonLogic.ExaminationManage;
using EMIS.ViewModel;
using EMIS.Web.Controls;
using Bowin.Common.Data;
using Bowin.Common.Utility;
using EMIS.Utility;
namespace EMIS.Web.Controllers.ExaminationManage
{
[Authorization]
public class ExaminationTeacherController : Controller
{
public IExaminationTeacherServices ExaminationTeacherServices { get; set; }
public ActionResult List()
{
return View();
}
///
/// 列表查询
///
///
///
[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");
if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
return base.Json(ExaminationTeacherServices.GetStaffViewList(configuretView, campusID, collegeID, departmentID, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult Excel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
var campusID = Request.Form["CampusDropdown"].ParseStrTo();
var collegeID = Request.Form["CollegeDropdown"].ParseStrTo();
var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo();
if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
var dt = ExaminationTeacherServices.GetStaffViewList(configuretView, campusID, collegeID, departmentID).Select(x => new
{
x.StaffCode,
x.Name,
x.CampusName,
x.CollegeName,
x.DepartmentName,
x.BirthDate,
x.SexName,
x.UsedName,
x.NationName,
x.Place,
//x.EducationCodeName,
x.Telephone,
x.OfficeTelephone,
x.Mobile,
x.Email,
x.QQ,
x.Nationality,
x.HealthStateName,
x.HousePhone,
x.Address,
x.ZIPCode,
x.HomeAddress,
x.NowAddress,
x.Residence,
x.Speciality,
x.WeChatNum,
x.ReligionName,
x.TeacherTypeName,
x.IncumbencyStateName,
x.CertificatesTypeName,
x.CertificatesNum,
x.SituationName,
x.LiteracyLevelName,
//x.DegreeStateName,
x.LearnPositionName,
x.TitleName,
x.WorkDate,
x.ComeSchoolDate,
//x.TeachingDate,
x.Profile,
x.Remark
}).ToTable();
string[] liststring = { "教职工号", "姓名", RSL.Get("Campus"), RSL.Get("College"), "所在教研室", "出生日期", "性别",
"曾用名", "民族", "籍贯", "学历", "家庭电话", "办公室电话", "移动电话", "电子邮箱", "QQ", "国籍",
"健康状况", "住宅电话", "通信地址", "邮政编码", "家庭住址", "现住地址", "户口所在地", "特长", "微信号", "宗教信仰",
"教师类别", "在职状态", "证件类型", "证件号码", "任课状况", "文化程度", "学位状况", "授予学位", "职称", "参加工作年月",
"来校日期", "从教年月", "简介", "备注" };
neh.Export(dt, liststring, "监考员信息");
return RedirectToAction("MsgShow", "Common", new
{
msg = "导出成功!",
url = Url.Content("~/ExaminationTeacher/List").AddMenuParameter()
});
}
///
/// 添加
///
///
///
[HttpPost]
public ActionResult Add(string userIDs)
{
try
{
var userIDList = userIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
ExaminationTeacherServices.Add(userIDList);
return base.Json("添加成功");
}
catch (Exception ex)
{
return base.Json("添加失败,原因:" + ex.Message + "!");
}
}
///
/// 删除
///
///
///
[HttpPost]
public ActionResult Delete(string userIDs)
{
try
{
var userIDList = userIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
ExaminationTeacherServices.Delete(userIDList);
return base.Json("删除成功");
}
catch (Exception ex)
{
return base.Json("删除失败,原因:" + ex.Message + "!");
}
}
public ActionResult ExaminationTeacherSelect(Guid ExaminationPlanID)
{
return View();
}
public ActionResult ExaminationTeacherSelectGdss(Guid schoolyearID, Guid classroomID, DateTime examinationDate,
TimeSpan startTime, TimeSpan endTime)
{
return View();
}
public ActionResult ExaminationAddTeacherSelect()
{
return View();
}
[HttpPost]
public ActionResult AvailableList(QueryParamsModel pararms, Guid examinationPlanID, Guid classroomID)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var campusID = pararms.getExtraGuid("CampusDropdown");
var collegeID = pararms.getExtraGuid("CollegeDropdown");
var departmentID = pararms.getExtraGuid("DepartmentDropdown");
if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
return base.Json(ExaminationTeacherServices.GetAvailableStaffViewList(configuretView, examinationPlanID, classroomID, campusID, collegeID, departmentID, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult AvailableListGdss(QueryParamsModel pararms, Guid schoolyearID, DateTime examinationDate,
TimeSpan startTime, TimeSpan endTime, Guid classroomID)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var campusID = pararms.getExtraGuid("CampusDropdown");
var collegeID = pararms.getExtraGuid("CollegeDropdown");
var departmentID = pararms.getExtraGuid("DepartmentDropdown");
if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
return base.Json(ExaminationTeacherServices.GetAvailableStaffViewGdssList(configuretView, schoolyearID,
examinationDate, startTime, endTime, classroomID, campusID, collegeID, departmentID, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult AddAvailableList(QueryParamsModel pararms, Guid classroomID)
{
ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var campusID = pararms.getExtraGuid("CampusDropdown");
var collegeID = pararms.getExtraGuid("CollegeDropdown");
var departmentID = pararms.getExtraGuid("DepartmentDropdown");
if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
return base.Json(ExaminationTeacherServices.GetAddAvailableStaffViewList(configuretView, classroomID, campusID, collegeID, departmentID, (int)pararms.page, (int)pararms.rows));
}
}
}