F_PC_0402_1.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. /*******************************************************************************
  2. * Copyright(c) 2015 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0402_1.cs
  5. * 2.功能描述:班次配置新建\编辑
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 袁新成 2015/04/22 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Client.CommonModule;
  15. using Dongke.IBOSS.PRD.Client.Controls;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. namespace Dongke.IBOSS.PRD.Client.PCModule
  19. {
  20. /// <summary>
  21. /// 班次配置新建\编辑窗体
  22. /// </summary>
  23. public partial class F_PC_0402_1 : DKFormBase
  24. {
  25. #region 成员变量
  26. // 班次配置ID
  27. private int _classesSettingID;
  28. // 窗体状态的枚举 新建/编辑
  29. private Constant.FormMode _editStatus;
  30. // 选中的员工编码
  31. private string _staffCode;
  32. // 工号ID
  33. private int _userId;
  34. // 工号名称
  35. private string _userName;
  36. // 工号编号
  37. private string _userCode;
  38. // 备注
  39. private string _remark;
  40. //配置日期
  41. private DateTime _accountdate;
  42. //保存影响行
  43. private int _returnRow = Constant.INT_IS_ZERO;
  44. // 打开选择窗体的标识
  45. private bool _showFromFlag = true;
  46. // 当前工号的工种集合
  47. private DataTable _userJobsTable = new DataTable();
  48. //工号集合体
  49. private FPC0402_SE frmse = new FPC0402_SE();
  50. //保存操作类型0--新增,1--更新
  51. private int saveStatus=0;
  52. #endregion
  53. #region 属性
  54. /// <summary>
  55. /// 备注
  56. /// </summary>
  57. public string Remark
  58. {
  59. get { return _remark; }
  60. set { _remark = value; }
  61. }
  62. /// <summary>
  63. /// 工号名称
  64. /// </summary>
  65. public string UserName1
  66. {
  67. get { return _userName; }
  68. set { _userName = value; }
  69. }
  70. /// <summary>
  71. /// 班次配置ID
  72. /// </summary>
  73. public int ClassesSettingID
  74. {
  75. get { return _classesSettingID; }
  76. set { _classesSettingID = value; }
  77. }
  78. /// <summary>
  79. /// 工号ID
  80. /// </summary>
  81. public int UserId
  82. {
  83. get { return _userId; }
  84. set { _userId = value; }
  85. }
  86. /// <summary>
  87. /// 工号编号
  88. /// </summary>
  89. public string UserCode
  90. {
  91. get { return _userCode; }
  92. set { _userCode = value; }
  93. }
  94. public DateTime AccountDate
  95. {
  96. get { return _accountdate; }
  97. set { _accountdate = value; }
  98. }
  99. #endregion
  100. #region 构造函数
  101. /// <summary>
  102. /// 构造函数
  103. /// </summary>
  104. /// <param name="editStatus">新建/编辑</param>
  105. /// <param name="pUserId">要编辑的员工编号</param>
  106. public F_PC_0402_1(Constant.FormMode editStatus)
  107. {
  108. InitializeComponent();
  109. this._editStatus = editStatus;
  110. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  111. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  112. this.btnSave.Text = ButtonText.BTN_SAVE;
  113. this.btnCancel.Text = ButtonText.BTN_CANCEL;
  114. this.btnSave.Enabled = false;
  115. if (this._editStatus == Constant.FormMode.Add)
  116. {
  117. this.Text = FormTitles.F_PC_0402_ADD;
  118. }
  119. else
  120. {
  121. this.Text = FormTitles.F_PC_0402_EDIT;
  122. }
  123. }
  124. #endregion
  125. #region 事件
  126. /// <summary>
  127. /// 页面加载事件
  128. /// </summary>
  129. /// <param name="sender"></param>
  130. /// <param name="e"></param>
  131. private void F_PC_0402_Load(object sender, EventArgs e)
  132. {
  133. try
  134. {
  135. if (this._editStatus == Constant.FormMode.Edit)
  136. {
  137. frmse.ClassSettingID = this._classesSettingID;
  138. frmse.AccountDate = this.AccountDate;
  139. saveStatus = 1; //更新
  140. this.txtRemarks.Text = this.Remark;
  141. this.dkUserInfo.UserID = this._userId;
  142. this.dkUserInfo.UserName = this._userName;
  143. this.dkUserInfo.UserCode = this._userCode;
  144. this.dkUserInfo.Enabled = false;
  145. this.dtpAccountDate.Enabled = false;
  146. this.dgvClassesDetail.AllowUserToAddRows = true;
  147. this.dgvClassesDetail.IsSetInputColumnsColor = true;
  148. }
  149. }
  150. catch (Exception ex)
  151. {
  152. // 对异常进行共通处理
  153. ExceptionManager.HandleEventException(this.ToString(),
  154. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  155. }
  156. }
  157. /// <summary>
  158. /// 自动适应列宽
  159. /// </summary>
  160. /// <param name="sender"></param>
  161. /// <param name="e"></param>
  162. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  163. {
  164. this.dgvClassesDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  165. }
  166. /// <summary>
  167. /// 关闭按钮事件
  168. /// </summary>
  169. /// <param name="sender"></param>
  170. /// <param name="e"></param>
  171. private void tsbtnClose_Click(object sender, EventArgs e)
  172. {
  173. this.Close();
  174. }
  175. /// <summary>
  176. /// 工号ValueChanged事件
  177. /// </summary>
  178. /// <param name="sender"></param>
  179. /// <param name="e"></param>
  180. private void dkUserInfo_UserValueChanged(object sender, Controls.SearchTextBox.dkUserInfoSearchBox.TextChangeEventArgs e)
  181. {
  182. try
  183. {
  184. this.btnSave.Enabled = false;
  185. int userId = this.dkUserInfo.UserID.Value;
  186. if(!string.IsNullOrEmpty(this.dkUserInfo.Text.Trim()))
  187. {
  188. // 调用服务器端获取数据集
  189. ServiceResultEntity sreuser = DoAsync<ServiceResultEntity>(() =>
  190. {
  191. return PCModuleProxyNew.Service.GetUserInfo(userId);
  192. }
  193. );
  194. if (sreuser.Status == Constant.ServiceResultStatus.Success)
  195. {
  196. frmse.UserID = userId;
  197. frmse.UserCode = this.dkUserInfo.UserCode;
  198. frmse.UserOrganizationID = int.Parse(sreuser.Data.Tables[0].Rows[0]["organizationid"].ToString());
  199. }
  200. BindUserJobs();
  201. this.dgvClassesDetail.AllowUserToAddRows = true;
  202. }
  203. }
  204. catch (Exception ex)
  205. {
  206. // 对异常进行共通处理
  207. ExceptionManager.HandleEventException(this.ToString(),
  208. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  209. }
  210. }
  211. /// <summary>
  212. /// 员工编号值改变事件
  213. /// </summary>
  214. /// <param name="sender"></param>
  215. /// <param name="e"></param>
  216. private void dgvClassesDetail_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  217. {
  218. try
  219. {
  220. if (this.dgvClassesDetail.Rows.Count <= Constant.INT_IS_ONE || !_showFromFlag)
  221. {
  222. return;
  223. }
  224. DataGridViewRow rowItem = this.dgvClassesDetail.Rows[e.RowIndex];
  225. DataGridViewColumn columnItem = this.dgvClassesDetail.Columns[e.ColumnIndex];
  226. // 用编号获取员工信息
  227. if ("StaffCode".Equals(columnItem.Name)
  228. && !string.IsNullOrEmpty(this.dgvClassesDetail.Rows[e.RowIndex].Cells[columnItem.Name].Value + ""))
  229. {
  230. this._showFromFlag = false;
  231. FormUtility.BindClassStaffRowDataSource(this.dgvClassesDetail,
  232. e.RowIndex, columnItem.Name, this._staffCode, this.dkUserInfo.UserID.Value, true);
  233. this._showFromFlag = true;
  234. // 设置可输入单元格的颜色
  235. this.dgvClassesDetail.IsSetInputColumnsColor = true;
  236. // 不可出现重复的人员
  237. for (int i = 0; i < this.dgvClassesDetail.Rows.Count; i++)
  238. {
  239. if (i != e.RowIndex)
  240. {
  241. if (this.dgvClassesDetail.Rows[i].IsNewRow == true)
  242. {
  243. return;
  244. }
  245. String NowStaffID = this.dgvClassesDetail.Rows[e.RowIndex].Cells["StaffID"].Value.ToString();
  246. if (NowStaffID == string.Empty)
  247. {
  248. this.dgvClassesDetail.Rows.RemoveAt(e.RowIndex);
  249. return;
  250. }
  251. String ForStaffID = "";
  252. if (this.dgvClassesDetail.Rows[i].Cells["StaffID"].Value != null)
  253. {
  254. ForStaffID = this.dgvClassesDetail.Rows[i].Cells["StaffID"].Value.ToString();
  255. }
  256. if (NowStaffID == ForStaffID)
  257. {
  258. ((DataTable)this.dgvClassesDetail.DataSource).Rows[e.RowIndex].Delete();
  259. //仅限当前页面,工号间的待修改
  260. MessageBox.Show("员工信息不可重复配置!", this.Text,
  261. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  262. return;
  263. }
  264. this.btnSave.Enabled = true;
  265. }
  266. }
  267. }
  268. if (columnItem.Name == "UJobsId")
  269. {
  270. string JobsId = this.dgvClassesDetail.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
  271. if (JobsId == string.Empty)
  272. {
  273. if (((DataTable)this.dgvClassesDetail.DataSource).Rows[e.RowIndex]["UJobsId", DataRowVersion.Original] != null)
  274. {
  275. string OValue = ((DataTable)this.dgvClassesDetail.DataSource).Rows[e.RowIndex]["UJobsId", DataRowVersion.Original].ToString();
  276. ((DataTable)this.dgvClassesDetail.DataSource).Rows[e.RowIndex]["UJobsId"] = OValue;
  277. }
  278. else
  279. {
  280. ((DataTable)this.dgvClassesDetail.DataSource).Rows[e.RowIndex].Delete();
  281. }
  282. }
  283. }
  284. }
  285. catch (Exception ex)
  286. {
  287. this._showFromFlag = true;
  288. // 对异常进行共通处理
  289. ExceptionManager.HandleEventException(this.ToString(),
  290. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  291. }
  292. }
  293. /// <summary>
  294. /// 单元格编辑时
  295. /// </summary>
  296. /// <param name="sender"></param>
  297. /// <param name="e"></param>
  298. private void dgvClassesDetail_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
  299. {
  300. try
  301. {
  302. if (this.dgvClassesDetail.Rows.Count <= Constant.INT_IS_ONE)
  303. {
  304. return;
  305. }
  306. DataGridViewColumn columnItem = this.dgvClassesDetail.Columns[e.ColumnIndex];
  307. if ("StaffCode".Equals(columnItem.Name))
  308. {
  309. this._staffCode = this.dgvClassesDetail.Rows[e.RowIndex].Cells[columnItem.Name].Value + "";
  310. }
  311. }
  312. catch (Exception ex)
  313. {
  314. // 对异常进行共通处理
  315. ExceptionManager.HandleEventException(this.ToString(),
  316. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  317. }
  318. }
  319. /// <summary>
  320. /// 保存按钮事件
  321. /// </summary>
  322. /// <param name="sender"></param>
  323. /// <param name="e"></param>
  324. private void btnSave_Click(object sender, EventArgs e)
  325. {
  326. try
  327. {
  328. // 至少有一条明细信息
  329. if (isWhiteTable() == true)
  330. {
  331. MessageBox.Show("至少要有一条班次配置明细信息!",
  332. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
  333. return;
  334. }
  335. // 不可更改帐务日期之前的班次配置
  336. DateTime accountDate = CommonModuleProxy.Service.GetAccountDate();
  337. if (Convert.ToDateTime(this.dtpAccountDate.Text) < accountDate)
  338. {
  339. FPC0401_SE se = new FPC0401_SE();
  340. se.DateBegin = DateTime.Parse(dtpAccountDate.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  341. se.DateEnd = DateTime.Parse(dtpAccountDate.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  342. se.UserCode = dkUserInfo.UserCode;
  343. // 调用服务器端获取数据集
  344. ServiceResultEntity sreclass = DoAsync<ServiceResultEntity>(() =>
  345. {
  346. return PCModuleProxyNew.Service.GetFPC0401SData(se);
  347. }
  348. );
  349. if (sreclass.Status == Constant.ServiceResultStatus.Success)
  350. {
  351. if (sreclass.Data != null && sreclass.Data.Tables[0].Rows.Count >0)
  352. {
  353. MessageBox.Show("选择日期已存在班次配置,不可再次补录!",
  354. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
  355. return;
  356. }
  357. }
  358. }
  359. // 验证界面必录项的录入;
  360. if (this.CheckInputValidity())
  361. {
  362. // 保存
  363. DataTable dTable = (DataTable)this.dgvClassesDetail.DataSource;
  364. // 修改table中的工号为当前配置的工号
  365. foreach (DataRow row in dTable.Rows)
  366. {
  367. if (row.RowState == DataRowState.Deleted)
  368. {
  369. continue;
  370. }
  371. row["UserID"] = this.dkUserInfo.UserID.Value;
  372. row["UserCode"] = this.dkUserInfo.UserCode;
  373. if (row["UJobsId"].ToString() == string.Empty && row["StaffCode"].ToString() == string.Empty)
  374. {
  375. continue;
  376. }
  377. if (row["UJobsId"].ToString() == string.Empty)
  378. {
  379. MessageBox.Show("请为所有员工配置工种!",
  380. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
  381. return;
  382. }
  383. if (row["StaffCode"].ToString() == "")
  384. {
  385. MessageBox.Show("请为已选择工种配置员工!",
  386. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
  387. return;
  388. }
  389. }
  390. frmse.AccountDate = Convert.ToDateTime(this.dtpAccountDate.Text);
  391. frmse.ClassRemarks = this.txtRemarks.Text.Trim();
  392. // 调用服务器端获取数据集
  393. ServiceResultEntity sreclass = DoAsync<ServiceResultEntity>(() =>
  394. {
  395. return PCModuleProxyNew.Service.SetFPC0402SData(frmse,saveStatus, (DataTable)dgvClassesDetail.DataSource);
  396. }
  397. );
  398. if (sreclass.Status == Constant.ServiceResultStatus.Success)
  399. {
  400. //this.DataSource = sreclass.Data;
  401. // 保存成功提示信息
  402. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "班次配置", "保存"),
  403. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  404. this.InitializationForm();
  405. }
  406. }
  407. }
  408. catch (Exception ex)
  409. {
  410. // 对异常进行共通处理
  411. ExceptionManager.HandleEventException(this.ToString(),
  412. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  413. }
  414. }
  415. /// <summary>
  416. /// 取消按钮
  417. /// </summary>
  418. /// <param name="sender"></param>
  419. /// <param name="e"></param>
  420. private void btnCancel_Click(object sender, EventArgs e)
  421. {
  422. if (this._returnRow > Constant.INT_IS_ZERO)
  423. {
  424. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  425. }
  426. else
  427. {
  428. this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  429. }
  430. }
  431. #endregion
  432. #region 私有方法
  433. /// <summary>
  434. /// 验证输入格式是否正确
  435. /// </summary>
  436. /// <returns></returns>
  437. private bool CheckInputValidity()
  438. {
  439. // 验证员工信息是否录入;
  440. if (string.IsNullOrEmpty(this.dkUserInfo.Text.Trim()))
  441. {
  442. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "工号"),
  443. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  444. this.dkUserInfo.Focus();
  445. return false;
  446. }
  447. if (this.dgvClassesDetail.RowCount <= Constant.INT_IS_ONE)
  448. {
  449. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "员工信息"),
  450. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  451. this.dgvClassesDetail.Focus();
  452. return false;
  453. }
  454. return true;
  455. }
  456. /// <summary>
  457. /// 清空输入项
  458. /// </summary>
  459. private void InitializationForm()
  460. {
  461. if (this._editStatus == Constant.FormMode.Add)
  462. {
  463. this.dkUserInfo.Text = "";
  464. this.txtRemarks.Clear();
  465. this.dgvClassesDetail.DataSource = null;
  466. }
  467. else
  468. {
  469. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  470. }
  471. this.btnSave.Enabled = false;
  472. }
  473. /// <summary>
  474. /// 绑定用户工种
  475. /// </summary>
  476. private void BindUserJobs()
  477. {
  478. try
  479. {
  480. //获取可选择的工种数据源
  481. this.txtRemarks.Text = "";
  482. DataSet userJobsData = new DataSet();
  483. // 调用服务器端获取数据集
  484. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  485. {
  486. return PCModuleProxyNew.Service.GetJobByUserId(Convert.ToInt32(this.dkUserInfo.UserID));
  487. }
  488. );
  489. if (sre.Status == Constant.ServiceResultStatus.Success)
  490. {
  491. userJobsData = sre.Data;
  492. }
  493. this.UJobsId.DisplayMember = "UserJobsCodeName";
  494. this.UJobsId.ValueMember = "UserJobsId";
  495. this.UJobsId.DataSource = userJobsData.Tables[0];
  496. this._userJobsTable = userJobsData.Tables[0];
  497. //获取用户班次配置信息
  498. FPC0401_SE se = new FPC0401_SE();
  499. se.DateBegin =DateTime.Parse( dtpAccountDate.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  500. se.DateEnd =DateTime.Parse( dtpAccountDate.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  501. se.UserCode = dkUserInfo.UserCode;
  502. // 调用服务器端获取数据集
  503. ServiceResultEntity sreclass = DoAsync<ServiceResultEntity>(() =>
  504. {
  505. return PCModuleProxyNew.Service.GetFPC0401SData(se);
  506. }
  507. );
  508. if (sreclass.Status == Constant.ServiceResultStatus.Success)
  509. {
  510. this.DataSource = sreclass.Data;
  511. if (sreclass.Data == null)
  512. {
  513. //获取用户当前关联的员工关系数据源
  514. saveStatus = 0;
  515. this.GetClassDetailData();
  516. }
  517. }
  518. if (this.DataSource != null && this.DataSource.Tables.Count == 2)
  519. {
  520. this.txtRemarks.Text = this.DataSource.Tables[0].Rows[0]["remarks"].ToString();
  521. frmse.ClassSettingID = this._classesSettingID;
  522. frmse.AccountDate = this.AccountDate;
  523. saveStatus = 1; //更新
  524. this.btnSave.Enabled = false;
  525. if (this.DataSource.Tables[1] != null && this.DataSource.Tables[1].Rows.Count > 0)
  526. {
  527. dgvClassesDetail.DataSource = this.DataSource.Tables[1];
  528. }
  529. else
  530. {
  531. //获取用户当前关联的员工关系数据源
  532. this.GetClassDetailData();
  533. }
  534. }
  535. }
  536. catch (Exception ex)
  537. {
  538. throw ex;
  539. }
  540. }
  541. /// <summary>
  542. /// 获取工号下的员工
  543. /// </summary>
  544. /// <returns></returns>
  545. private void GetClassDetailData()
  546. {
  547. int id = Convert.ToInt32(this.dkUserInfo.UserID);
  548. this.dgvClassesDetail.DataSource = null;
  549. // 调用服务器端获取数据集
  550. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  551. {
  552. return PCModuleProxyNew.Service.GetFPC0402SData(id);
  553. }
  554. );
  555. if (sre.Status == Constant.ServiceResultStatus.Success)
  556. {
  557. this.dgvClassesDetail.DataSource = sre.Data.Tables[0];//this.DataSource.Tables[0];
  558. this.btnSave.Enabled = true;
  559. }
  560. }
  561. /// <summary>
  562. /// 是否空表
  563. /// </summary>
  564. /// <returns></returns>
  565. private bool isWhiteTable()
  566. {
  567. foreach (DataGridViewRow gvrFor in this.dgvClassesDetail.Rows)
  568. {
  569. if ((gvrFor.Cells["UJobsId"].Value != null && gvrFor.Cells["UJobsId"].Value.ToString() != "")
  570. || (gvrFor.Cells["StaffCode"].Value != null && gvrFor.Cells["StaffCode"].Value.ToString() != ""))
  571. {
  572. return false;
  573. }
  574. }
  575. return true;
  576. }
  577. #endregion
  578. private void dtpAccountDate_ValueChanged(object sender, EventArgs e)
  579. {
  580. try
  581. {
  582. if(!string.IsNullOrEmpty(dkUserInfo.Text.Trim()))
  583. {
  584. this.btnSave.Enabled = false;
  585. int userId = this.dkUserInfo.UserID.Value;
  586. BindUserJobs();
  587. this.dgvClassesDetail.AllowUserToAddRows = true;
  588. }
  589. }
  590. catch (Exception ex)
  591. {
  592. // 对异常进行共通处理
  593. ExceptionManager.HandleEventException(this.ToString(),
  594. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  595. }
  596. }
  597. private void dgvClassesDetail_UserDeletedRow(object sender, DataGridViewRowEventArgs e)
  598. {
  599. this.btnSave.Enabled = true;
  600. }
  601. private void txtRemarks_TextChanged(object sender, EventArgs e)
  602. {
  603. this.btnSave.Enabled = true;
  604. }
  605. }
  606. }