frmAddWorkReport.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using LYFZ.BLL;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Windows.Forms;
  7. namespace LYFZ.Software.MainBusiness.OAShopManagement
  8. {
  9. public class frmAddWorkReport : LYFZ.Software.UI.OAShopManagement.frmAddWorkReport
  10. {
  11. public frmAddWorkReport()
  12. {
  13. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.comboBoxTreeViewEx1);
  14. this.btnRelease.Click += btnRelease_Click;
  15. this.btnClose.Click += btnClose_Click;
  16. this.Load += frmReleaseTask_Load;
  17. this.comboBoxTreeViewEx1.IsNodeMouseClick = true;
  18. }
  19. BLL_ErpShopEvententry ctbll = new BLL_ErpShopEvententry();
  20. string _id = "";
  21. /// <summary>
  22. /// ID
  23. /// </summary>
  24. public string ID { get { return this._id; } set { this._id = value; } }
  25. Model.Model_ErpShopEvententry model = new Model.Model_ErpShopEvententry();
  26. void frmReleaseTask_Load(object sender, EventArgs e)
  27. {
  28. if (!string.IsNullOrEmpty(this.ID))
  29. {
  30. model = ctbll.GetModel(Convert.ToInt32(ID));
  31. this.comboBoxTreeViewEx1.Text = frmMattersApply.UserIDToName(model.Matter_UpdateName);
  32. this.comboBoxTreeViewEx1.Tag = model.Matter_UpdateName;
  33. this.txtTitle.Text = model.Matter_Title;
  34. this.txtInfo.Text = model.Matter_content;
  35. }
  36. }
  37. void btnClose_Click(object sender, EventArgs e)
  38. {
  39. this.Close();
  40. }
  41. void btnRelease_Click(object sender, EventArgs e)
  42. {
  43. if (string.IsNullOrEmpty(this.txtTitle.Text.Trim()))
  44. {
  45. MessageBoxCustom.Show("请输入工作汇报主题");
  46. return;
  47. }
  48. if (this.comboBoxTreeViewEx1.Tag == null)
  49. {
  50. MessageBoxCustom.Show("请选工作汇报审批人");
  51. return;
  52. }
  53. if (string.IsNullOrEmpty(this.txtInfo.Text.Trim()))
  54. {
  55. MessageBoxCustom.Show("请输入工作汇报内容");
  56. return;
  57. }
  58. if (this.txtTitle.Text.Trim().Length > 100)
  59. {
  60. MessageBoxCustom.Show("申请工作汇报主题不能超过100个字");
  61. return;
  62. }
  63. if (this.txtInfo.Text.Trim().Length > 500)
  64. {
  65. MessageBoxCustom.Show("申请工作汇报内容不能超过500个字");
  66. return;
  67. }
  68. model.Matter_ID = LYFZ.WinAPI.CustomPublicMethod.GenerateId();
  69. model.Matter_UpdateName = comboBoxTreeViewEx1.Tag.ToString();
  70. model.Matter_content = txtInfo.Text.Trim();
  71. model.Matter_Title = this.txtTitle.Text.Trim();
  72. model.Matter_CreateDatetime = SDateTime.Now;
  73. model.Matter_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  74. model.Matter_state = state.申请中.ToString();
  75. model.Matter_Type = 2;
  76. model.Matter_opinion = "";
  77. model.Matter_UpdateDatetime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime();
  78. if (model.ID > 0)
  79. {
  80. if (ctbll.Update(model))
  81. {
  82. MessageBoxCustom.Show("重新汇报发送成功");
  83. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  84. }
  85. else
  86. {
  87. MessageBoxCustom.Show("重新汇报发送失败"); return;
  88. }
  89. }
  90. else
  91. {
  92. if (ctbll.Add(model))
  93. {
  94. MessageBoxCustom.Show("汇报发送成功");
  95. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  96. }
  97. else
  98. {
  99. MessageBoxCustom.Show("汇报发送成功"); return;
  100. }
  101. }
  102. }
  103. }
  104. }