WorktimeRateController.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.PaymentManage;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.ViewModel.PaymentManage;
  11. namespace EMIS.Web.Controllers.PaymentManage
  12. {
  13. [Authorization]
  14. public class WorktimeRateController : Controller
  15. {
  16. public IWorktimeRateServices WorktimeRateServices { get; set; }
  17. public ActionResult List()
  18. {
  19. return View();
  20. }
  21. public ActionResult Edit(Guid? WorktimeRateID, Guid? SourceID)
  22. {
  23. WorktimeRateView worktimeRateView = new WorktimeRateView();
  24. if (WorktimeRateID.HasValue)
  25. {
  26. worktimeRateView = WorktimeRateServices.GetWorktimeRateView(WorktimeRateID);
  27. }
  28. else if (SourceID.HasValue)
  29. {
  30. worktimeRateView = WorktimeRateServices.GetWorktimeRateView(SourceID);
  31. worktimeRateView.WorktimeRateID = Guid.Empty;
  32. }
  33. return View(worktimeRateView);
  34. }
  35. [HttpPost]
  36. public ActionResult List(QueryParamsModel pararms)
  37. {
  38. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  39. var collegeID = pararms.getExtraGuid("cgbCollege");
  40. var teachingModeID = pararms.getExtraInt("ddlTeachingMode") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlTeachingMode");
  41. var teachingMethodID = pararms.getExtraInt("ddlTeachingMethod") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlTeachingMethod");
  42. var paymentLevelID = pararms.getExtraInt("ddlPaymentLevel") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlPaymentLevel");
  43. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  44. return base.Json(WorktimeRateServices.GetWorktimeRateViewList(configuretView, collegeID, teachingModeID, teachingMethodID, paymentLevelID, (int)pararms.page, (int)pararms.rows));
  45. }
  46. [HttpPost]
  47. public ActionResult Edit(WorktimeRateView worktimeRateView)
  48. {
  49. try
  50. {
  51. if (worktimeRateView.TeachingMethodID == DropdownList.PLEASE_SELECT)
  52. {
  53. worktimeRateView.TeachingMethodID = null;
  54. }
  55. WorktimeRateServices.Save(worktimeRateView);
  56. return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
  57. }
  58. catch (Exception ex)
  59. {
  60. return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
  61. }
  62. }
  63. [HttpPost]
  64. public ActionResult Delete(string worktimeRateIDs)
  65. {
  66. try
  67. {
  68. List<Guid?> list = worktimeRateIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  69. WorktimeRateServices.Delete(list);
  70. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
  71. }
  72. catch (Exception ex)
  73. {
  74. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message });
  75. }
  76. }
  77. }
  78. }