frmTeskView.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. using LYFZ.Helper;
  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. using System.Data.SqlClient;
  11. using LYFZ.Software.MainBusiness.DoorCityProcess;
  12. using LYFZ.Model;
  13. namespace LYFZ.Software.MainBusiness.OAShopManagement
  14. {
  15. public partial class frmTeskView : LYFZ.Software.UI.OAShopManagement.frmTeskView
  16. {
  17. public frmTeskView()
  18. {
  19. this.btnClose.Click += btnClose_Click;
  20. this.btnSave.Click += btnSave_Click;
  21. this.btnReply.Click += btnReply_Click;
  22. this.Load += frmTeskView_Load;
  23. }
  24. /// <summary>
  25. /// 回复
  26. /// </summary>
  27. /// <param name="sender"></param>
  28. /// <param name="e"></param>
  29. void btnReply_Click(object sender, EventArgs e)
  30. {
  31. if (this.txtTaskSummary.Text == "")
  32. {
  33. MessageBoxCustom.Show("请输入回复!");
  34. }
  35. else
  36. {
  37. DateTime strTime = SDateTime.Now;
  38. LYFZ.Model.Model_ErpShopAssignmente model3 = ambll.GetModel(Convert.ToInt32(TeskRow.Cells[0].Value));
  39. model3.Agt_Revert = this.txtTaskSummary.Text.Trim();
  40. model3.Agt_UpdateName = strUserID;
  41. model3.Agt_UpdateDatetime = strTime;
  42. if (ambll.Update(model3))
  43. {
  44. MessageBoxCustom.Show("提交成功");
  45. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  46. }
  47. else
  48. {
  49. MessageBoxCustom.Show("提交失败");
  50. }
  51. }
  52. }
  53. /// <summary>
  54. /// 是否保存
  55. /// </summary>
  56. public bool IsSaveed = false;
  57. //当前登录者的ID
  58. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  59. string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  60. LYFZ.BLL.BLL_ErpShopAssignmente ambll = new BLL.BLL_ErpShopAssignmente();
  61. LYFZ.BLL.BLL_ErpShopDebriefing ambll1 = new BLL.BLL_ErpShopDebriefing();
  62. LYFZ.Model.Model_ErpShopAssignmente assigmodel = null;
  63. void frmTeskView_Load(object sender, EventArgs e)
  64. {
  65. this.comboBoxCompletionState.Items.Clear();
  66. this.comboBoxCompletionState.Items.AddRange(Enum.GetNames(typeof(frmTaskAssigned.CompleteStatus)));
  67. if (this.TeskRow != null)
  68. {
  69. assigmodel = ambll.GetModel(Convert.ToInt32(this.TeskRow.Cells[0].Value.ToString()));
  70. if (assigmodel.ID > 0)
  71. {
  72. //任务状态选择
  73. this.comboBoxCompletionState.SelectedItem =((frmTaskAssigned.CompleteStatus)assigmodel.Agt_CompleteStatus).ToString();// TeskRow.Cells[7].Value.ToString();
  74. //任务优先级
  75. this.labPriority.Text = ((frmTaskAssigned.Priority)assigmodel.Agt_Priority).ToString();// TeskRow.Cells["优先级"].Value.ToString();
  76. //发布时间
  77. this.labReleaseDatetime.Text = assigmodel.Agt_PublishTime.ToString("yyyy-MM-dd HH:mm:ss");// TeskRow.Cells["发布时间"].Value.ToString();
  78. //完成期限
  79. this.labCompletiondate.Text = LYFZ.Command.Command_Validate.DateTimeToString(assigmodel.Agt_Deadlines,"yyyy-MM-dd HH:mm:ss");// TeskRow.Cells["完成期限"].Value.ToString();
  80. //任务内容
  81. this.txtTaskInfo.Text = assigmodel.Agt_Content;// TeskRow.Cells["任务内容"].Value.ToString();
  82. //完成时间
  83. this.dateTimePickerEx1.DateValue = LYFZ.Command.Command_Validate.DateTimeToString(assigmodel.Agt_CompleteTime, "yyyy-MM-dd HH:mm:ss");// TeskRow.Cells["完成期限"].Value.ToString();
  84. DataRow dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(assigmodel.Agt_ManageName);
  85. string Agt_ManageName = "";
  86. if (dtRow != null)
  87. {
  88. Agt_ManageName = dtRow["User_Name"].ToString().Trim();
  89. }
  90. //办理人
  91. this.labTransactor.Text = Agt_ManageName;// TeskRow.Cells["办理人"].Value.ToString();
  92. dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(assigmodel.Agt_PublishName);
  93. Agt_ManageName = "";
  94. if (dtRow != null)
  95. {
  96. Agt_ManageName = dtRow["User_Name"].ToString().Trim();
  97. }
  98. this.lbTitle.Text = assigmodel.Agt_TaskTopic;
  99. //发布人
  100. this.labPostedby.Text = Agt_ManageName;// TeskRow.Cells["发布人"].Value.ToString();
  101. //任务总结
  102. this.txtTaskSummary.Text = assigmodel.Agt_Summary;// TeskRow.Cells["任务总结"].Value.ToString();
  103. //发布人回复
  104. this.txtTaskReply.Text = assigmodel.Agt_Revert;
  105. if (_myTeskType == TeskType.发布人)
  106. {
  107. this.comboBoxCompletionState.Enabled = false;
  108. this.dateTimePickerEx1.Enabled = false;
  109. this.txtTaskSummary.Enabled = false;
  110. this.btnSave.Enabled = false;
  111. this.txtTaskReply.Enabled = true;
  112. this.btnReply.Enabled = true;
  113. }
  114. else
  115. {
  116. this.comboBoxCompletionState.Enabled = true;
  117. this.dateTimePickerEx1.Enabled = true;
  118. this.txtTaskSummary.Enabled = true;
  119. this.btnSave.Enabled = true;
  120. this.txtTaskReply.Enabled = false;
  121. this.btnReply.Enabled = false;
  122. }
  123. }
  124. }
  125. }
  126. /// <summary>
  127. /// 保存更新
  128. /// </summary>
  129. /// <param name="sender"></param>
  130. /// <param name="e"></param>
  131. void btnSave_Click(object sender, EventArgs e)
  132. {
  133. try
  134. {
  135. if (comboBoxCompletionState.Text == "")
  136. {
  137. MessageBoxCustom.Show("请选择任务状态");
  138. }
  139. else
  140. {
  141. frmTaskAssigned.CompleteStatus cStatus = (frmTaskAssigned.CompleteStatus)Enum.Parse(typeof(frmTaskAssigned.CompleteStatus), this.comboBoxCompletionState.SelectedItem.ToString());
  142. DateTime strTime = SDateTime.Now;
  143. List<Helper.CommandInfo> clist = new List<CommandInfo>();
  144. LYFZ.Model.Model_ErpShopAssignmente model = ambll.GetModel(Convert.ToInt32(TeskRow.Cells[0].Value));
  145. model.Agt_CompleteStatus = Convert.ToInt32(cStatus);
  146. model.Agt_CompleteTime = Convert.ToDateTime(this.labReleaseDatetime.Text.Trim());
  147. model.Agt_Summary = this.txtTaskSummary.Text.Trim();
  148. model.Agt_UpdateName = strUserID;
  149. model.Agt_UpdateDatetime = strTime;
  150. clist.Add(ambll.GetUpdateCommandInfo(model));
  151. LYFZ.Model.Model_ErpShopDebriefing mode2 = new Model.Model_ErpShopDebriefing();
  152. mode2.Rpt_CompleteState = Convert.ToInt32(cStatus);
  153. mode2.Rpt_Summary = this.txtTaskSummary.Text.Trim();
  154. mode2.Rpt_UpdateName = strUserID;
  155. mode2.Rpt_CreateDatetime = strTime;
  156. mode2.fuID = model.ID;
  157. clist.Add(ambll1.GetAddCommandInfo(mode2));
  158. if (clist.Count > 0)
  159. {
  160. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  161. {
  162. MessageBoxCustom.Show("保存成功");
  163. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  164. }
  165. else { MessageBoxCustom.Show("保存失败"); }
  166. }
  167. }
  168. }
  169. catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  170. }
  171. void btnClose_Click(object sender, EventArgs e)
  172. {
  173. this.Close();
  174. }
  175. DataGridViewRow _teskRow = null;
  176. public DataGridViewRow TeskRow
  177. {
  178. get { return _teskRow; }
  179. set { _teskRow = value; }
  180. }
  181. TeskType _myTeskType = TeskType.办理人;
  182. internal TeskType MyTeskType
  183. {
  184. get { return _myTeskType; }
  185. set { _myTeskType = value; }
  186. }
  187. }
  188. /// <summary>
  189. /// 任务关系类型 是发布人还是办理人
  190. /// </summary>
  191. enum TeskType
  192. {
  193. 发布人,
  194. 办理人
  195. }
  196. }