123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using Bowin.Common.Data;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.CommonLogic.SupervisionManage;
- using EMIS.ViewModel.SupervisionManage;
- using EMIS.Utility;
- using Bowin.Common.Utility;
- using EMIS.CommonLogic.SystemServices;
- namespace EMIS.Web.Controllers.SupervisionManage
- {
- [Authorization]
- public class ProjectRecordController : Controller
- {
- public IProjectRecordServices projectRecordServices { get; set; }
- public IRoleServices IRoleServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var ddCcollegeID = pararms.getExtraGuid("DDCollegeDropdown");
- var supervisionType = pararms.getExtraInt("SupervisionType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SupervisionType");
- var startDate = pararms.getExtraDateTime("StartDate");
- var endDate = pararms.getExtraDateTime("EndDate");
- var dataRange = IRoleServices.GetDataRange();
- return base.Json(projectRecordServices.GetProjectRecordViewGrid(configuretView, schoolyearID, collegeID, supervisionType, ddCcollegeID, startDate, endDate,dataRange, (int)pararms.page, (int)pararms.rows));
- }
- [HttpGet]
- public ActionResult Edit(Guid? projectRecordID, int? isShow)
- {
- ProjectRecordView projectRecordView = new ProjectRecordView();
- var evaluation = (int)SUP_SupervisionType.Evaluation;
- if (projectRecordID.HasValue && projectRecordID != Guid.Empty)
- {
- projectRecordView = projectRecordServices.GetProjectRecordView(projectRecordID);
- }
- ViewBag.Evaluation = evaluation;
- return View(projectRecordView);
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="graduationConditionView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(ProjectRecordView projectRecordView)
- {
- try
- {
- var teacherList = DataGrid.GetTableData<ProjectRecordTeacherView>("dgTeacherList");
- if (teacherList.Count <= 0)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:督导组成员不能为空。"
- });
- }
- List<FileUploadView> filelist = new List<FileUploadView>();
- var sessionName = FileUploadHelper.GetFileUploadSessionName(projectRecordView.ProjectRecordID);
- var sessionfileList = (List<FileUploadView>)Session[sessionName];
- if (sessionfileList != null)
- {
- foreach (var file in sessionfileList)
- {
- filelist.Add(file);
- }
- }
- projectRecordServices.Save(projectRecordView, teacherList, filelist);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- [HttpPost]
- public ActionResult Delete(string projectRecordIDs)
- {
- try
- {
- var projectRecordIDList = projectRecordIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- projectRecordServices.Delete(projectRecordIDList);
- return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
- }
- catch (Exception ex)
- {
- return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["Schoolyear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["College"].ParseStrTo<Guid>();
- var supervisionType = Request.Form["SupervisionType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SupervisionType"].ParseStrTo<int>();
- var supervisionCollegeID = Request.Form["SupervisionCollege"].ParseStrTo<Guid>();
- var startDate = Request.Form["StartDate"].ParseStrTo<DateTime>();
- var endDate = Request.Form["EndDate"].ParseStrTo<DateTime>();
- var projectRecordIDString = Request.Form["SelectedID"];
- var projectRecordIDList = projectRecordIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var dataRange = IRoleServices.GetDataRange();
- List<ProjectRecordView> result;
- result = projectRecordServices.GetProjectRecordViewList(conditionView, schoolyearID, collegeID, supervisionType, supervisionCollegeID,
- startDate, endDate, projectRecordIDList, dataRange);
- var dt = result.Select(x => new
- {
- x.SchoolyearCode,
- x.SupervisionTypeDesc,
- x.CollegeName,
- x.SupervisionCollegeName,
- x.SupervisionTarget,
- x.DateWeekTimeDesc,
- x.Location,
- x.staffListDesc,
- x.CreateUserName,
- CreateTime = x.CreateTime.Value.ToShortDateString(),
- }).ToTable();
- string[] liststring = { "学年学期", "督导类型", "院系所", "督导院系", "督导对象", "督导时间","督导地点",
- "督导组成员", "创建人", "创建时间" };
- neh.Export(dt, liststring, "督导项目记录");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- [HttpGet]
- public ActionResult TeacherSelect()
- {
- return View();
- }
- [HttpPost]
- public ActionResult TeacherList(QueryParamsModel pararms, Guid? projectRecordID)
- {
- if (projectRecordID.HasValue && projectRecordID != Guid.Empty)
- {
- return base.Json(projectRecordServices.GetProjectRecordTeacherViewGridByID(projectRecordID, (int)pararms.page, (int)pararms.rows));
- }
- else
- {
- return base.Json(projectRecordServices.GetDefaultTeacherViewGrid((int)pararms.page, (int)pararms.rows)); ;
- }
- }
- [HttpGet]
- public ActionResult Upload(Guid? projectRecordID)
- {
- ProjectRecordView projectRecordView = new ProjectRecordView();
- projectRecordView.ProjectRecordID = projectRecordID.Value;
- return View(projectRecordView);
- }
- [HttpPost]
- public ActionResult Upload()
- {
- return Json("上传成功");
- }
- [HttpPost]
- public ActionResult GetFileListByProjectRecordID(Guid? projectRecordID)
- {
- //var convertByApplyID = scoreConvertByApplyID.ParseStrTo<Guid>();
- var sessionName = FileUploadHelper.GetFileUploadSessionName(projectRecordID ?? Guid.Empty);
- var fileList = (List<FileUploadView>)Session[sessionName];
- return Json(fileList);
- }
- [HttpGet]
- public ActionResult SelectAdvise()
- {
- return View();
- }
- ///// <summary>
- ///// 教师列表查询
- ///// </summary>
- ///// <param name="pararms"></param>
- ///// <returns></returns>
- //[HttpPost]
- //public ActionResult ALLTeacherList(QueryParamsModel pararms)
- //{
- // ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- // var userID = pararms.getExtraGuid("SaffDropdown");
- // var campusID = pararms.getExtraGuid("CampusDropdown");
- // var collegeID = pararms.getExtraGuid("CollegeDropdown");
- // var departmentID = pararms.getExtraGuid("DepartmentDropdown");
- // var isphotoUrl = pararms.getExtraInt("PhotoUrltmentDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("PhotoUrltmentDropdown");
- // return base.Json(staffServices.Value.GetStaffViewGrid(configuretView, campusID, collegeID, departmentID, isphotoUrl, userID, (int)pararms.page, (int)pararms.rows));
- //}
- //public ActionResult GetLoginUser()
- //{
- // var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
-
- // return View(curUser);
- //}
- }
- }
|