Aucune description

WorkOffDaysController.cs 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using CallCenter.Utility;
  2. using CallCenterApi.Interface.Controllers.Base;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. namespace CallCenterApi.Interface.Controllers.SystemManage
  10. {
  11. public class WorkOffDaysController : BaseController
  12. {
  13. BLL.T_Sys_WorkOFFDays dBLL = new BLL.T_Sys_WorkOFFDays();
  14. //获取休息日列表
  15. public ActionResult GetList()
  16. {
  17. List<Model.T_Sys_WorkOFFDays> wodlist = dBLL.GetModelList(" F_OffState=0 order by F_OffDate desc");
  18. var obj = wodlist.Select(wol => new
  19. {
  20. start = wol.F_OffDate,
  21. });
  22. return Success("", obj);
  23. }
  24. /// <summary>
  25. /// 设置或取消休息日
  26. /// </summary>
  27. /// <param name="offdate">日期</param>
  28. /// <param name="type">0,设为休息日;1,取消休息日</param>
  29. /// <returns></returns>
  30. public ActionResult setOfforOn(string offdate, int type)
  31. {
  32. if (!string.IsNullOrWhiteSpace(offdate))
  33. {
  34. int userId = CurrentUser.UserData.F_UserId;
  35. if (type == 0)
  36. {//设为休息日
  37. Model.T_Sys_WorkOFFDays dModel = new Model.T_Sys_WorkOFFDays();
  38. dModel.F_OffDate = Convert.ToDateTime(offdate);
  39. dModel.F_OffState = 0;
  40. dModel.F_CreateBy = userId.ToString();
  41. dModel.F_CreateOn = DateTime.Now;
  42. int n = dBLL.Add(dModel);
  43. if (n > 0)
  44. {
  45. return Success("添加成功", n);
  46. }
  47. else
  48. {
  49. return Error("添加失败");
  50. }
  51. }
  52. else
  53. {//取消休息日
  54. if (dBLL.DeleteByDate(offdate))
  55. {
  56. return Success("删除成功");
  57. }
  58. else
  59. return Error("删除失败");
  60. }
  61. }
  62. else
  63. {
  64. return Error("请选择要删除的记录");
  65. }
  66. }
  67. }
  68. }