123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- 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.Web.Controls;
- using EMIS.ViewModel;
- using Bowin.Common.Data;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Utility;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.PaymentManage
- {
- [Authorization]
- public class WorktimeAdditionController : Controller
- {
- public IWorktimeAdditionServices WorktimeAdditionServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- public ActionResult Edit(Guid? WorktimeAdditionID)
- {
- WorktimeAdditionView worktimeAdditionView = new WorktimeAdditionView();
- if (WorktimeAdditionID.HasValue)
- {
- worktimeAdditionView = WorktimeAdditionServices.GetWorktimeAdditionView(WorktimeAdditionID);
- }
- else
- {
- worktimeAdditionView.SchoolyearID = BaseExtensions.GetCurrentSchoolYearID();
- }
- return View(worktimeAdditionView);
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
- var collegeID = pararms.getExtraGuid("cgbCollege");
- var teacherUserID = pararms.getExtraGuid("cgbTeacherUser");
- var studentCollegeID = pararms.getExtraGuid("cgbStudentCollege");
- var courseCollegeID = pararms.getExtraGuid("cgbCourseCollege");
- var year = pararms.getExtraInt("ddlYear") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlYear");
- var standardID = pararms.getExtraInt("cgbStandard") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("cgbStandard");
- var teachingModeID = pararms.getExtraInt("ddlTeachingMode") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlTeachingMode");
- var month = pararms.getExtraInt("ddlMonth") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlMonth");
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(WorktimeAdditionServices.GetWorktimeAdditionViewList(configuretView, schoolyearID, collegeID, teacherUserID, studentCollegeID, courseCollegeID, year, standardID, teachingModeID,month, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult Edit(WorktimeAdditionView worktimeAdditionView)
- {
- try
- {
- WorktimeAdditionServices.Save(worktimeAdditionView);
- return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Delete(string worktimeAdditionIDs)
- {
- try
- {
- List<Guid?> list = worktimeAdditionIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- WorktimeAdditionServices.Delete(list);
- 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 collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
- var teacherUserID = Request.Form["cgbTeacherUser"].ParseStrTo<Guid>();
- var studentCollegeID = Request.Form["cgbStudentCollege"].ParseStrTo<Guid>();
- var courseCollegeID = Request.Form["cgbCourseCollege"].ParseStrTo<Guid>();
- var year = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
- var standardID = Request.Form["cgbStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cgbStandard"].ParseStrTo<int>();
- var teachingModeID = Request.Form["ddlTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlTeachingMode"].ParseStrTo<int>();
- var month = Request.Form["ddlMonth"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlMonth"].ParseStrTo<int>();
- var dt = WorktimeAdditionServices.GetWorktimeAdditionViewList(configuretView, schoolyearID, collegeID, teacherUserID, studentCollegeID, courseCollegeID, year, standardID, teachingModeID, month).Select(x => new
- {
- x.SchoolyearCode,
- x.CollegeName,
- x.TeacherName,
- x.GradeYearID,
- x.StandardDesc,
- x.CourseCode,
- x.CourseName,
- x.CourseCollegeName,
- x.EducationMissionClassName,
- x.TeachingModeDesc,
- x.TeachTypeDesc,
- x.StudentCount,
- x.CourseTime,
- x.Remark
- }).ToTable();
- string[] liststring = { "学年学期", "教师单位", "教师姓名", "年级", "专业", "课程代码", "课程名称", RSL.Get("CourseCollege"), "任务班名", "授课方式", "任课方式", "学生人数", "课时数", "备注" };
- neh.Export(dt, liststring, "课时补登");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- }
|