frmAddApply.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using LYFZ.BLL;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.OAShopManagement
  11. {
  12. public class frmAddApply : LYFZ.Software.UI.OAShopManagement.frmAddApply
  13. {
  14. public frmAddApply()
  15. {
  16. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.comboBoxTreeViewEx1);
  17. this.btnRelease.Click += btnRelease_Click;
  18. this.btnClose.Click += btnClose_Click;
  19. this.Load += frmReleaseTask_Load;
  20. this.comboBoxTreeViewEx1.IsNodeMouseClick = true;
  21. this.btnSet.Click += btnSet_Click;
  22. }
  23. void btnSet_Click(object sender, EventArgs e)
  24. {
  25. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet();
  26. frm.TypeName = BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.事项类别).ToUpper();
  27. frm.Version = "Version";
  28. if (frm.ShowDialog() == DialogResult.OK)
  29. {
  30. FinancialManagement.frmEditStatisticsProgram.LoadAllSystemCategory();
  31. FinancialManagement.frmEditStatisticsProgram.BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.事项类别).ToUpper(), this.cmbCategory.TreeView);
  32. }
  33. }
  34. BLL_ErpShopEvententry ctbll = new BLL_ErpShopEvententry();
  35. string _id = "";
  36. /// <summary>
  37. /// ID
  38. /// </summary>
  39. public string ID { get { return this._id; } set { this._id = value; } }
  40. Model.Model_ErpShopEvententry model = new Model.Model_ErpShopEvententry();
  41. void frmReleaseTask_Load(object sender, EventArgs e)
  42. {
  43. FinancialManagement.frmEditStatisticsProgram.BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.事项类别).ToUpper(), this.cmbCategory.TreeView);
  44. if (!string.IsNullOrEmpty(this.ID))
  45. {
  46. model = ctbll.GetModel(Convert.ToInt32(ID));
  47. FinancialManagement.frmEditStatisticsProgram.SetSelectItme(this.cmbCategory, model.Matter_Category);
  48. this.comboBoxTreeViewEx1.Text = frmMattersApply.UserIDToName(model.Matter_UpdateName);
  49. this.comboBoxTreeViewEx1.Tag = model.Matter_UpdateName;
  50. this.txtTitle.Text = model.Matter_Title;
  51. this.txtInfo.Text = model.Matter_content;
  52. }
  53. }
  54. void btnClose_Click(object sender, EventArgs e)
  55. {
  56. this.Close();
  57. }
  58. void btnRelease_Click(object sender, EventArgs e)
  59. {
  60. if (this.cmbCategory.TreeView.SelectedNode == null && string.IsNullOrEmpty(this.cmbCategory.StrGetName))
  61. {
  62. MessageBoxCustom.Show("请选申请事项类别");
  63. return;
  64. }
  65. if (string.IsNullOrEmpty(this.txtTitle.Text.Trim()))
  66. {
  67. MessageBoxCustom.Show("请输入申请事项主题");
  68. return;
  69. }
  70. if (this.comboBoxTreeViewEx1.Tag == null)
  71. {
  72. MessageBoxCustom.Show("请选申请事项审批人");
  73. return;
  74. }
  75. if (string.IsNullOrEmpty(this.txtInfo.Text.Trim()))
  76. {
  77. MessageBoxCustom.Show("请输入申请事项内容");
  78. return;
  79. }
  80. if (this.txtTitle.Text.Trim().Length > 100)
  81. {
  82. MessageBoxCustom.Show("申请事项主题不能超过100个字");
  83. return;
  84. }
  85. if (this.txtInfo.Text.Trim().Length > 200)
  86. {
  87. MessageBoxCustom.Show("申请事项主题不能超过200个字");
  88. return;
  89. }
  90. model.Matter_ID = LYFZ.WinAPI.CustomPublicMethod.GenerateId();
  91. model.Matter_UpdateName = comboBoxTreeViewEx1.Tag.ToString();
  92. model.Matter_content = txtInfo.Text.Trim();
  93. model.Matter_Title = this.txtTitle.Text.Trim();
  94. model.Matter_CreateDatetime = SDateTime.Now;
  95. model.Matter_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  96. model.Matter_Category = this.cmbCategory.TreeView.SelectedNode != null ? this.cmbCategory.TreeView.SelectedNode.Name : this.cmbCategory.StrGetName;
  97. model.Matter_state = state.申请中.ToString();
  98. model.Matter_Type = 0;
  99. //model.Matter_InstructedTime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime();
  100. //model.Matter_LeadershipInstruction = "";
  101. model.Matter_opinion = "";
  102. model.Matter_UpdateDatetime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime();
  103. if (model.ID > 0)
  104. {
  105. if (ctbll.Update(model))
  106. {
  107. System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(ShopEvententryPushMessage), model);
  108. MessageBoxCustom.Show("重新申请发送成功");
  109. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  110. }
  111. else
  112. {
  113. MessageBoxCustom.Show("重新申请发送失败"); return;
  114. }
  115. }
  116. else
  117. {
  118. if (ctbll.Add(model))
  119. {
  120. System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(ShopEvententryPushMessage), model);
  121. MessageBoxCustom.Show("申请发送成功");
  122. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  123. }
  124. else
  125. {
  126. MessageBoxCustom.Show("申请发送成功"); return;
  127. }
  128. }
  129. }
  130. /// <summary>
  131. /// 发布时推送消息
  132. /// </summary>
  133. void ShopEvententryPushMessage(object b)
  134. {
  135. try
  136. {
  137. if (b != null)
  138. {
  139. LYFZ.Model.Model_ErpShopEvententry eModel = (LYFZ.Model.Model_ErpShopEvententry)b;
  140. ctbll.ShopEvententryPushMessage(eModel);
  141. }
  142. }
  143. catch { }
  144. }
  145. }
  146. }