frmRequestLeaveView.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using LYFZ.BLL;
  2. using LYFZ.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. namespace LYFZ.Software.MainBusiness.OAShopManagement
  8. {
  9. public class frmRequestLeaveView : LYFZ.Software.UI.OAShopManagement.frmRequestLeaveView
  10. {
  11. public frmRequestLeaveView() {
  12. this.btnClose.Click += btnClose_Click;
  13. this.btnSave.Click += btnSave_Click;
  14. this.Load += frmTeskView_Load;
  15. if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.RequestLeave, CustomAttributes.OperatingAuthority.Audit))
  16. { this.btnSave.Enabled = true; }
  17. else
  18. { this.btnSave.Enabled = false; }
  19. }
  20. BLL_ErpShopEvententry Bll = new BLL_ErpShopEvententry();
  21. string _id = "";
  22. /// <summary>
  23. /// ID
  24. /// </summary>
  25. public string ID { get { return this._id; } set { this._id = value; } }
  26. Model_ErpShopEvententry model = new Model_ErpShopEvententry();
  27. void frmTeskView_Load(object sender, EventArgs e)
  28. {
  29. comboBoxApplyState.ReadOnly = true;
  30. if (!string.IsNullOrEmpty(this.ID))
  31. {
  32. model = Bll.GetModel(Convert.ToInt32(ID));
  33. //申请人
  34. this.labPriority.Text = frmMattersApply.UserIDToName(model.Matter_UpdateName);
  35. this.lbCategory.Text = LYFZ.BLL.WageStatisticsProcess.GetClassCodeToCalssName(model.Matter_Category);
  36. //申请时间
  37. this.labReleaseDatetime.Text = model.Matter_CreateDatetime.ToString("yyyy-MM-dd HH:mm");
  38. //申请内容
  39. this.txtApplyInfo.Text = model.Matter_content;
  40. //审批状态
  41. this.comboBoxApplyState.SelectedText = model.Matter_state;
  42. //审批人
  43. this.labPostedby.Text = Bll.Name(model.Matter_UpdateName);
  44. //审批意见
  45. this.txtApplyReply.Text = model.Matter_opinion;
  46. this.txtLeadershipInstruction.Text = model.Matter_LeadershipInstruction;
  47. this.txtTitle.Text = model.Matter_Title;
  48. this.lbRequestLeaveTiem.Text = "从【" + LYFZ.Command.Command_Validate.DateTimeToString(model.Matter_StarLeaveTime, "yyyy-MM-dd HH:mm")
  49. + "】至【"
  50. + LYFZ.Command.Command_Validate.DateTimeToString(model.Matter_EndLeaveTime, "yyyy-MM-dd HH:mm") + "】";
  51. }
  52. switch (_ApplyType)
  53. {
  54. case MattersApplyType.批示领导:
  55. this.txtApplyReply.Enabled = false;
  56. this.txtLeadershipInstruction.Enabled = true;
  57. this.btnSave.Enabled = true;
  58. break;
  59. case MattersApplyType.申请人:
  60. this.txtApplyReply.Enabled = false;
  61. this.txtLeadershipInstruction.Enabled = false;
  62. this.btnSave.Enabled = false;
  63. break;
  64. case MattersApplyType.审核人:
  65. this.txtApplyReply.Enabled = true;
  66. this.txtLeadershipInstruction.Enabled = false;
  67. this.btnSave.Enabled = true;
  68. break;
  69. }
  70. this.comboBoxApplyState.Items.Clear();
  71. // this.comboBoxApplyState.Items.Add(state.申请中.ToString());
  72. this.comboBoxApplyState.Items.Add(state.申请通过.ToString());
  73. this.comboBoxApplyState.Items.Add(state.申请打回.ToString());
  74. }
  75. /// <summary>
  76. /// 审核按钮
  77. /// </summary>
  78. /// <param name="sender"></param>
  79. /// <param name="e"></param>
  80. void btnSave_Click(object sender, EventArgs e)
  81. {
  82. if (model.ID > 0)
  83. {
  84. if (_ApplyType == MattersApplyType.审核人)
  85. {
  86. if (string.IsNullOrEmpty(txtApplyReply.Text))
  87. {
  88. MessageBoxCustom.Show("请输入审批意见"); return;
  89. }
  90. if (txtApplyReply.Text.Trim().Length > 200)
  91. {
  92. MessageBoxCustom.Show("审批意见不能超过200个字"); return;
  93. }
  94. model.Matter_opinion = this.txtApplyReply.Text.Trim();
  95. model.Matter_UpdateDatetime = SDateTime.Now;
  96. model.Matter_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  97. }
  98. else if (_ApplyType == MattersApplyType.批示领导)
  99. {
  100. if (string.IsNullOrEmpty(txtLeadershipInstruction.Text))
  101. {
  102. MessageBoxCustom.Show("请输入领导批示意见"); return;
  103. }
  104. if (txtLeadershipInstruction.Text.Trim().Length > 200)
  105. {
  106. MessageBoxCustom.Show("领导批示意见不能超过200个字"); return;
  107. }
  108. model.Matter_LeadershipInstruction = this.txtLeadershipInstruction.Text.Trim();
  109. model.Matter_InstructedPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  110. model.Matter_InstructedTime = SDateTime.Now;
  111. }
  112. model.Matter_state = this.comboBoxApplyState.Text.Trim();
  113. if (model.Matter_state == state.申请中.ToString())
  114. {
  115. MessageBoxCustom.Show("请选择审核状态"); return;
  116. }
  117. if (Bll.Update(model))
  118. {
  119. MessageBoxCustom.Show("审核成功");
  120. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  121. }
  122. else
  123. {
  124. MessageBoxCustom.Show("审核失败");
  125. }
  126. }
  127. }
  128. void btnClose_Click(object sender, EventArgs e)
  129. { this.Close(); }
  130. MattersApplyType _ApplyType = MattersApplyType.申请人;
  131. /// <summary>
  132. /// 操作人类型 申请,审核
  133. /// </summary>
  134. internal MattersApplyType ApplyType
  135. {
  136. get { return _ApplyType; }
  137. set { _ApplyType = value; }
  138. }
  139. }
  140. }