F_HR_0603.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. /*******************************************************************************
  2. * Copyright(c) 2014 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_HR_0603.cs
  5. * 2.功能描述:职务调整审核
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 冯雪 2014/09/16 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseControls;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  16. using Dongke.IBOSS.PRD.Basics.Library;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.Client.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. using Dongke.IBOSS.PRD.WCF.DataModels.HRModule;
  22. using Dongke.IBOSS.PRD.WCF.Proxys;
  23. using Dongke.IBOSS.PRD.WCF.Proxys.HRModuleService;
  24. namespace Dongke.IBOSS.PRD.Client.HRModule
  25. {
  26. /// <summary>
  27. /// 职务调整审核
  28. /// </summary>
  29. public partial class F_HR_0603 : DockPanelBase
  30. {
  31. #region 成员变量
  32. // 窗体的单例模式
  33. private static F_HR_0603 _instance;
  34. //选中的行
  35. private int _selectedRowIndex;
  36. // 查询条件实体
  37. private HR_CMN_StaffEntity _staffEntity = new HR_CMN_StaffEntity();
  38. #endregion
  39. #region 构造函数
  40. /// <summary>
  41. /// 构造函数
  42. /// </summary>
  43. public F_HR_0603()
  44. {
  45. InitializeComponent();
  46. FormPermissionManager.FormPermissionControl(this.Name, this,
  47. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  48. this.SetFromTitleInfo();
  49. }
  50. #endregion
  51. #region 单例模式
  52. /// <summary>
  53. /// 单例模式,防止重复创建窗体
  54. /// </summary>
  55. public static F_HR_0603 Instance
  56. {
  57. get
  58. {
  59. if (_instance == null)
  60. {
  61. _instance = new F_HR_0603();
  62. }
  63. return _instance;
  64. }
  65. }
  66. #endregion
  67. #region 事件
  68. /// <summary>
  69. /// 页面加载事件
  70. /// </summary>
  71. /// <param name="sender"></param>
  72. /// <param name="e"></param>
  73. private void F_HR_0603_Load(object sender, EventArgs e)
  74. {
  75. try
  76. {
  77. // 加载权限
  78. FormPermissionManager.FormPermissionControl(this.Name, this,
  79. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  80. // 设置表格不自动创建列
  81. this.dgvStaffRecord.AutoGenerateColumns = false;
  82. }
  83. catch (Exception ex)
  84. {
  85. // 对异常进行共通处理
  86. ExceptionManager.HandleEventException(this.ToString(),
  87. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  88. }
  89. }
  90. /// <summary>
  91. /// 窗体关闭事件
  92. /// </summary>
  93. /// <param name="sender"></param>
  94. /// <param name="e"></param>
  95. private void F_HR_0603_FormClosed(object sender, FormClosedEventArgs e)
  96. {
  97. _instance = null;
  98. }
  99. /// <summary>
  100. /// 行获取焦点后查看明细
  101. /// </summary>
  102. /// <param name="sender"></param>
  103. /// <param name="e"></param>
  104. private void dgvStaffRecord_CellEnter(object sender, DataGridViewCellEventArgs e)
  105. {
  106. try
  107. {
  108. if (this.dgvStaffRecord.CurrentCell != null)
  109. {
  110. // 记录最后选择行
  111. this._selectedRowIndex = this.dgvStaffRecord.CurrentCell.RowIndex;
  112. }
  113. }
  114. catch (Exception ex)
  115. {
  116. // 对异常进行共通处理
  117. ExceptionManager.HandleEventException(this.ToString(),
  118. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  119. }
  120. }
  121. /// <summary>
  122. /// 单元格鼠标双击事件
  123. /// </summary>
  124. /// <param name="sender"></param>
  125. /// <param name="e"></param>
  126. private void dgvStaffRecord_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
  127. {
  128. if (Constant.INT_IS_NEGATIE_ONE < e.RowIndex && Constant.INT_IS_NEGATIE_ONE < e.ColumnIndex
  129. && this.tsbtnApprover.Enabled && this.tsbtnApprover.Visible)
  130. {
  131. this.tsbtnApprover_Click(sender, e);
  132. }
  133. }
  134. /// <summary>
  135. /// 更多条件按钮
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. private void tsbtnMoreCondition_Click(object sender, EventArgs e)
  140. {
  141. HR_CMN_001 frmCMN001 = new HR_CMN_001();
  142. frmCMN001.StaffEntity = _staffEntity;
  143. if (frmCMN001.ShowDialog() == DialogResult.OK)
  144. {
  145. this.txtOther.Text = frmCMN001.StaffEntity.GetSqlDispText();
  146. this._staffEntity = frmCMN001.StaffEntity;
  147. }
  148. }
  149. /// <summary>
  150. /// 清空条件
  151. /// </summary>
  152. /// <param name="sender"></param>
  153. /// <param name="e"></param>
  154. private void btnClearCondition_Click(object sender, EventArgs e)
  155. {
  156. this.txtStaffCode.Clear();
  157. this.txtStaffName.Clear();
  158. this.txtOther.Clear();
  159. this._staffEntity.ClearEntityValue();
  160. }
  161. /// <summary>
  162. /// 关闭按钮事件
  163. /// </summary>
  164. /// <param name="sender"></param>
  165. /// <param name="e"></param>
  166. private void tsbtnClose_Click(object sender, EventArgs e)
  167. {
  168. this.Close();
  169. }
  170. /// <summary>
  171. /// 自动适应列宽
  172. /// </summary>
  173. /// <param name="sender"></param>
  174. /// <param name="e"></param>
  175. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  176. {
  177. this.dgvStaffRecord.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  178. }
  179. /// <summary>
  180. /// 查询按钮
  181. /// </summary>
  182. /// <param name="sender"></param>
  183. /// <param name="e"></param>
  184. private void btnSearch_Click(object sender, EventArgs e)
  185. {
  186. try
  187. {
  188. this.GetDataGridViewInfo();
  189. if (((DataTable)this.dgvStaffRecord.DataSource).Rows.Count <= Constant.INT_IS_ZERO)
  190. {
  191. // 提示未查找到数据
  192. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  193. MessageBoxButtons.OK, MessageBoxIcon.Information);
  194. }
  195. }
  196. catch (Exception ex)
  197. {
  198. // 对异常进行共通处理
  199. ExceptionManager.HandleEventException(this.ToString(),
  200. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  201. }
  202. }
  203. /// <summary>
  204. /// 审批按钮
  205. /// </summary>
  206. /// <param name="sender"></param>
  207. /// <param name="e"></param>
  208. private void tsbtnApprover_Click(object sender, EventArgs e)
  209. {
  210. try
  211. {
  212. if (this.dgvStaffRecord.CurrentRow != null)
  213. {
  214. int intStaffID = Convert.ToInt32(this.dgvStaffRecord.CurrentRow.Cells["StaffID"].Value);
  215. DateTime sopTimeStamp = Convert.ToDateTime(this.dgvStaffRecord.CurrentRow.Cells["SOPTIMESTAMP"].Value);
  216. int intStaffRecordID = Convert.ToInt32(this.dgvStaffRecord.CurrentRow.Cells["StaffRecordID"].Value);
  217. DateTime ropTimeStamp = Convert.ToDateTime(this.dgvStaffRecord.CurrentRow.Cells["ROPTIMESTAMP"].Value);
  218. StaffRecordEntity staffRecordEntity = new StaffRecordEntity();
  219. staffRecordEntity.StaffRecordID = intStaffRecordID;
  220. staffRecordEntity.OPTimeStamp = ropTimeStamp;
  221. staffRecordEntity.StaffID = intStaffID;
  222. staffRecordEntity.TargetPost = Convert.ToInt32(this.dgvStaffRecord.CurrentRow.Cells["TargetPost"].Value);
  223. S_CMN_011 frmCMN011 = new S_CMN_011();
  224. if (frmCMN011.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  225. {
  226. bool bolState = frmCMN011.HRApprovalState;
  227. string strMemo = frmCMN011.ApprovalMemo;
  228. HRResultEntity resultStaff = (HRResultEntity)DoAsync(new AsyncMethod(() =>
  229. {
  230. return HRModuleProxy.Service.SaveHRStaffPostApprovalInfo(intStaffID, sopTimeStamp, staffRecordEntity, bolState, strMemo);
  231. }));
  232. //0 没有数据被修改 -1员工档案被其他用户修改 -2存在待审批履历 -3员工履历被其他用户修改
  233. if (resultStaff.OperateStatus > Constant.INT_IS_ZERO)
  234. {
  235. // 提示信息
  236. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "职务调整", "审核"),
  237. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  238. this.btnSearch_Click(sender, e);
  239. }
  240. else if (resultStaff.OperateStatus == Constant.INT_IS_NEGATIE_ONE)
  241. {
  242. // 提示信息
  243. MessageBox.Show(string.Format(Messages.MSG_HR_W006, "职务调整", "审核"),
  244. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  245. }
  246. else if (resultStaff.OperateStatus == Constant.INT_IS_NEGATIE_TWO)
  247. {
  248. // 提示信息
  249. MessageBox.Show(Messages.MSG_CMN_W012,
  250. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  251. }
  252. else if (resultStaff.OperateStatus == Constant.INT_IS_NEGATIE_THREE)
  253. {
  254. // 提示信息
  255. MessageBox.Show(Messages.MSG_CMN_W012,
  256. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  257. }
  258. else
  259. {
  260. // 提示信息
  261. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "职务调整", "审核"),
  262. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  263. }
  264. }
  265. }
  266. }
  267. catch (Exception ex)
  268. {
  269. // 对异常进行共通处理
  270. ExceptionManager.HandleEventException(this.ToString(),
  271. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  272. }
  273. }
  274. #endregion
  275. #region 私有方法
  276. /// <summary>
  277. /// 设置窗体按钮的文本信息
  278. /// </summary>
  279. private void SetFromTitleInfo()
  280. {
  281. this.tsrOperate.BackgroundImage = global::Dongke.IBOSS.PRD.Client.HRModule.Properties.Resources.functionbackground;
  282. this.tsrOperate.Height = 35;
  283. this.toolStripSeparator1.Height = 25;
  284. this.toolStripSeparator1.Width = 6;
  285. this.tsbtnApprover.Height = 25;
  286. this.tsbtnMoreCondition.Height = 25;
  287. this.tsbtnAdaptive.Height = 25;
  288. this.tsbtnClose.Height = 25;
  289. this.btnSearch.Height = 30;
  290. this.btnSearch.Width = 85;
  291. this.btnClearCondition.Height = 30;
  292. this.btnClearCondition.Width = 85;
  293. this.dgvStaffRecord.ColumnHeadersHeight = 23;
  294. this.dgvStaffRecord.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
  295. this.dgvStaffRecord.AutoGenerateColumns = false;
  296. this.dgvStaffRecord.AutoGenerateColumns = false;
  297. this.Text = FormTitles.F_HR_0603;
  298. this.tsbtnApprover.Text = ButtonText.TSBTN_APPROVER;
  299. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  300. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  301. this.tsbtnMoreCondition.Text = ButtonText.TSBTN_MORECONDITION;
  302. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  303. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  304. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  305. }
  306. /// <summary>
  307. /// 获取职务调整信息
  308. /// </summary>
  309. private void GetDataGridViewInfo()
  310. {
  311. try
  312. {
  313. SearchStaffEntity searchStaffEntity = new SearchStaffEntity();
  314. DataConvert.Convert(this._staffEntity, searchStaffEntity);
  315. searchStaffEntity.StaffCode = this.txtStaffCode.Text.Trim();
  316. searchStaffEntity.StaffName = this.txtStaffName.Text.Trim();
  317. searchStaffEntity.Recordtype = Convert.ToInt32(Constant.StaffRecordType.AdjustPost);
  318. searchStaffEntity.RValueflag = Convert.ToInt32(Constant.ValueFlag.Effective);
  319. //查询
  320. DataSet dsResult = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  321. {
  322. return WCF.Proxys.HRModuleProxy.Service.SearchHrStaffApprove(searchStaffEntity);
  323. }));
  324. if (dsResult != null && dsResult.Tables.Count > Constant.INT_IS_ZERO)
  325. {
  326. // 记录最后选择行
  327. int selectRowIndex = this._selectedRowIndex;
  328. this.dgvStaffRecord.DataSource = dsResult.Tables[0];
  329. if (dsResult.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
  330. {
  331. // 定位当前行
  332. if (this.dgvStaffRecord.Rows.Count > selectRowIndex)
  333. {
  334. this._selectedRowIndex = selectRowIndex;
  335. this.dgvStaffRecord.Rows[selectRowIndex].Selected = true;
  336. }
  337. else if (this.dgvStaffRecord.Rows.Count <= selectRowIndex)
  338. {
  339. this._selectedRowIndex = dgvStaffRecord.Rows.Count - 1;
  340. this.dgvStaffRecord.Rows[dgvStaffRecord.Rows.Count - 1].Selected = true;
  341. }
  342. }
  343. }
  344. else
  345. {
  346. // 清空明细中的数据
  347. this.dgvStaffRecord.DataSource = null;
  348. // 提示未查找到数据
  349. MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  350. }
  351. }
  352. catch (Exception ex)
  353. {
  354. throw ex;
  355. }
  356. }
  357. #endregion
  358. }
  359. }