123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.PaymentManage;
- using EMIS.ViewModel.PaymentManage;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.PaymentManage
- {
- [Authorization]
- public class WorktimeAdjustmentController : Controller
- {
- public IWorktimeAdjustmentServices WorktimeAdjustmentServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- public ActionResult Edit(Guid? WorktimeAdjustmentID)
- {
- WorktimeAdjustmentView worktimeAdjustmentView = new WorktimeAdjustmentView();
- if (WorktimeAdjustmentID.HasValue)
- {
- worktimeAdjustmentView = WorktimeAdjustmentServices.GetWorktimeAdjustmentView(WorktimeAdjustmentID);
- }
- else
- {
- worktimeAdjustmentView.SchoolyearID = BaseExtensions.GetCurrentSchoolYearID();
- }
- return View(worktimeAdjustmentView);
- }
- public ActionResult GenerateChargeAgainst()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
- var coursematerialID = pararms.getExtraGuid("cgbCourse");
- var teacherUserID = pararms.getExtraGuid("cgbUser");
- var worktimeAdjustmentTypeID = pararms.getExtraInt("ddlWorktimeAdjustmentType") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlWorktimeAdjustmentType");
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(WorktimeAdjustmentServices.GetWorktimeAdjustmentViewList(configuretView, schoolyearID, coursematerialID, teacherUserID, worktimeAdjustmentTypeID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult Edit(WorktimeAdjustmentView worktimeAdjustmentView)
- {
- try
- {
- WorktimeAdjustmentServices.Save(worktimeAdjustmentView);
- return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Delete(string worktimeAdjustmentIDs)
- {
- try
- {
- List<Guid?> list = worktimeAdjustmentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- WorktimeAdjustmentServices.Delete(list);
- return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
- }
- catch (Exception ex)
- {
- return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult GetEducationMissionClass(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("SchoolyearID");
- var userID = pararms.getExtraGuid("UserID");
- var adjustDate = pararms.getExtraDateTime("AdjustDate");
- var collegeID = pararms.getExtraGuid("CollegeID");
- var gradeYearID = pararms.getExtraInt("GradeYearID") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("GradeYearID");
- var standardID = pararms.getExtraInt("StandardID") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("StandardID");
- var coursematerialID = pararms.getExtraGuid("CoursematerialID");
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(WorktimeAdjustmentServices.GetEducationMissionClassList(configuretView, schoolyearID, userID,
- adjustDate, collegeID, gradeYearID, standardID, coursematerialID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult GenerateChargeAgainst(Guid schoolyearID)
- {
- try
- {
- WorktimeAdjustmentServices.GenerateChargeAgainst(schoolyearID);
- return base.Json(new ReturnMessage { IsSuccess = true, Message = "生成成功" });
- }
- catch (Exception ex)
- {
- return base.Json(new ReturnMessage { IsSuccess = false, Message = "生成失败:" + ex.Message });
- }
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
- var teacherUserID = Request.Form["cgbUser"].ParseStrTo<Guid>();
- var worktimeAdjustmentTypeID = Request.Form["ddlWorktimeAdjustmentType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlWorktimeAdjustmentType"].ParseStrTo<int>();
- var dt = WorktimeAdjustmentServices.GetWorktimeAdjustmentViewList(configuretView, schoolyearID, coursematerialID, teacherUserID, worktimeAdjustmentTypeID).Select(x => new
- {
- x.AdjustDate,
- x.SchoolyearCode,
- x.EducationMissionClassName,
- x.TeacherName,
- x.CourseCode,
- x.CourseName,
- x.WorktimeAdjustmentTypeDesc,
- x.Worktime,
- }).ToTable();
- string[] liststring = { "记录时间", "学年学期", "任务班级", "教师", "课程编码", "课程名称", "登记类型", "课时数" };
- neh.Export(dt, liststring, "工作量调整");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- }
|