F_HR_1103.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_HR_1103.cs
  5. * 2.功能描述:行政奖惩审批
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 张国印 2014/09/25 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.Basics.DockPanel;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.Client.Controls;
  17. using Dongke.IBOSS.PRD.Client.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. using Dongke.IBOSS.PRD.WCF.Proxys.HRModuleService;
  21. namespace Dongke.IBOSS.PRD.Client.HRModule
  22. {
  23. /// <summary>
  24. /// 行政奖惩审批
  25. /// </summary>
  26. public partial class F_HR_1103 : DockPanelBase
  27. {
  28. #region 成员变量
  29. // 窗体的单例模式
  30. private static F_HR_1103 _instance;
  31. //Grid当前选中的行
  32. private int _selectedRowIndex;
  33. #endregion
  34. #region 构造函数
  35. /// <summary>
  36. /// 构造函数
  37. /// </summary>
  38. public F_HR_1103()
  39. {
  40. InitializeComponent();
  41. this.SetFromTitleInfo();
  42. }
  43. #endregion
  44. #region 单例模式
  45. /// <summary>
  46. /// 单例模式,防止重复创建窗体
  47. /// </summary>
  48. public static F_HR_1103 Instance
  49. {
  50. get
  51. {
  52. if (_instance == null)
  53. {
  54. _instance = new F_HR_1103();
  55. }
  56. return _instance;
  57. }
  58. }
  59. #endregion
  60. #region 事件
  61. /// <summary>
  62. /// 窗体加载事件
  63. /// </summary>
  64. /// <param name="sender"></param>
  65. /// <param name="e"></param>
  66. private void F_HR_1103_Load(object sender, EventArgs e)
  67. {
  68. try
  69. {
  70. #region 绑定数据源
  71. this.dkStaffName.WhereCondition = "(StaffStatus = 1 Or StaffStatus = 2) AND ValueFlag = 1";
  72. this.comRAPType.DataSource = GetRAPTypeInfo();
  73. this.comRAPType.DisplayMember = "TypeName";
  74. this.comRAPType.ValueMember = "TypeID";
  75. this.comSettlementFlag.DataSource = GetSettlementFlagInfo();
  76. this.comSettlementFlag.DisplayMember = "SettlementFlagName";
  77. this.comSettlementFlag.ValueMember = "SettlementFlagID";
  78. this.comAdministrationType.DataSource = DataDictionaryInfo();
  79. this.comAdministrationType.DisplayMember = "DictionaryValue";
  80. this.comAdministrationType.ValueMember = "DictionaryID";
  81. #endregion
  82. FormPermissionManager.FormPermissionControl(this.Name, this,
  83. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  84. }
  85. catch (Exception ex)
  86. {
  87. // 对异常进行共通处理
  88. ExceptionManager.HandleEventException(this.ToString(),
  89. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  90. }
  91. }
  92. /// <summary>
  93. /// 窗体关闭事件
  94. /// </summary>
  95. /// <param name="sender"></param>
  96. /// <param name="e"></param>
  97. private void F_HR_1103_FormClosed(object sender, FormClosedEventArgs e)
  98. {
  99. _instance = null;
  100. }
  101. /// <summary>
  102. /// 行获取焦点后查看明细
  103. /// </summary>
  104. /// <param name="sender"></param>
  105. /// <param name="e"></param>
  106. private void dgvStaff_CellEnter(object sender, DataGridViewCellEventArgs e)
  107. {
  108. try
  109. {
  110. if (this.dgvStaff.CurrentCell != null)
  111. {
  112. // 记录最后选择行
  113. this._selectedRowIndex = this.dgvStaff.CurrentCell.RowIndex;
  114. }
  115. }
  116. catch (Exception ex)
  117. {
  118. // 对异常进行共通处理
  119. ExceptionManager.HandleEventException(this.ToString(),
  120. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  121. }
  122. }
  123. /// <summary>
  124. /// 单元格鼠标双击事件
  125. /// </summary>
  126. /// <param name="sender"></param>
  127. /// <param name="e"></param>
  128. private void dgvStaff_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
  129. {
  130. if (Constant.INT_IS_NEGATIE_ONE < e.RowIndex && Constant.INT_IS_NEGATIE_ONE < e.ColumnIndex
  131. && this.tsbtnApprover.Enabled && this.tsbtnApprover.Visible)
  132. {
  133. this.tsbtnApprover_Click(sender, e);
  134. }
  135. }
  136. /// <summary>
  137. /// 审批按钮
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. private void tsbtnApprover_Click(object sender, EventArgs e)
  142. {
  143. try
  144. {
  145. if (this.dgvStaff.CurrentRow != null)
  146. {
  147. int intRAPID = Convert.ToInt32(this.dgvStaff.CurrentRow.Cells["RAPID"].Value);
  148. DateTime sopTimeStamp = Convert.ToDateTime(this.dgvStaff.CurrentRow.Cells["OPTIMESTAMP"].Value);
  149. HRAdminRAPEntity aminRapEntity = new HRAdminRAPEntity();
  150. aminRapEntity.RAPID = intRAPID;
  151. aminRapEntity.OPTimeStamp = sopTimeStamp;
  152. S_CMN_012 frmCMN012 = new S_CMN_012();
  153. if (frmCMN012.ShowDialog() == DialogResult.OK)
  154. {
  155. bool bolState = frmCMN012.HRApprovalState;
  156. HRResultEntity resultStaff = (HRResultEntity)DoAsync(new AsyncMethod(() =>
  157. {
  158. return HRModuleProxy.Service.SaveStaffAdminRAPApprovalInfo(aminRapEntity, bolState);
  159. }));
  160. //0 没有数据被修改 -1员工档案被其他用户修改 -2存在待审批履历 -3员工履历被其他用户修改
  161. if (resultStaff.OperateStatus > Constant.INT_IS_ZERO)
  162. {
  163. // 提示信息
  164. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, " 行政奖惩", "审核"),
  165. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  166. this.btnSearch_Click(sender, e);
  167. }
  168. else if (resultStaff.OperateStatus == Constant.INT_IS_NEGATIE_ONE)
  169. {
  170. // 提示信息
  171. MessageBox.Show(string.Format(Messages.MSG_HR_W003, "行政奖惩"),
  172. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  173. }
  174. else if (resultStaff.OperateStatus == Constant.INT_IS_NEGATIE_TWO)
  175. {
  176. // 提示信息
  177. MessageBox.Show(Messages.MSG_CMN_W012,
  178. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  179. }
  180. else
  181. {
  182. // 提示信息
  183. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "行政奖惩", "保存"),
  184. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  185. }
  186. }
  187. }
  188. }
  189. catch (Exception ex)
  190. {
  191. // 对异常进行共通处理
  192. ExceptionManager.HandleEventException(this.ToString(),
  193. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  194. }
  195. }
  196. /// <summary>
  197. /// 自动适应列宽
  198. /// </summary>
  199. /// <param name="sender"></param>
  200. /// <param name="e"></param>
  201. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  202. {
  203. this.dgvStaff.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  204. }
  205. /// <summary>
  206. /// 关闭按钮事件
  207. /// </summary>
  208. /// <param name="sender"></param>
  209. /// <param name="e"></param>
  210. private void tsbtnClose_Click(object sender, EventArgs e)
  211. {
  212. this.Close();
  213. }
  214. /// <summary>
  215. /// 查询按钮
  216. /// </summary>
  217. /// <param name="sender"></param>
  218. /// <param name="e"></param>
  219. private void btnSearch_Click(object sender, EventArgs e)
  220. {
  221. try
  222. {
  223. // 记录当前选中行
  224. int selectRowIndex = this._selectedRowIndex;
  225. SearchAdminRAPEntity searchAdminRAPEntity = SetSearchAdminRAPEntity();
  226. DataSet dsResultStaff = (DataSet)DoAsync(new AsyncMethod(() =>
  227. {
  228. return HRModuleProxy.Service.SearcStaffAdminRAPInfo(searchAdminRAPEntity);
  229. }));
  230. if (dsResultStaff != null)
  231. {
  232. base.DataSource = dsResultStaff;
  233. if (this.DataSource != null && this.DataSource.Tables.Count > Constant.INT_IS_ZERO)
  234. {
  235. this.dgvStaff.DataSource = this.DataSource.Tables[0];
  236. if (this.DataSource.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  237. {
  238. // 提示未查找到数据
  239. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  240. MessageBoxButtons.OK, MessageBoxIcon.Information);
  241. }
  242. else
  243. {
  244. #region 选择原有行
  245. if (selectRowIndex >= Constant.INT_IS_ZERO)
  246. {
  247. if (selectRowIndex >= dsResultStaff.Tables[0].Rows.Count)
  248. {
  249. this.dgvStaff.Rows[this.dgvStaff.Rows.Count - 1].Selected = true;
  250. this.dgvStaff.CurrentCell = this.dgvStaff.Rows[this.dgvStaff.Rows.Count - 1].Cells["StaffName"];
  251. }
  252. else
  253. {
  254. this.dgvStaff.Rows[selectRowIndex].Selected = true;
  255. this.dgvStaff.CurrentCell = this.dgvStaff.Rows[selectRowIndex].Cells["StaffName"];
  256. }
  257. }
  258. #endregion
  259. }
  260. }
  261. }
  262. }
  263. catch (Exception ex)
  264. {
  265. // 对异常进行共通处理
  266. ExceptionManager.HandleEventException(this.ToString(),
  267. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  268. }
  269. }
  270. /// <summary>
  271. /// 清空条件
  272. /// </summary>
  273. /// <param name="sender"></param>
  274. /// <param name="e"></param>
  275. private void btnClearCondition_Click(object sender, EventArgs e)
  276. {
  277. this.dkStaffName.UserID = null;
  278. this.dkStaffName.UserName = string.Empty;
  279. this.dkStaffName.UserCode = string.Empty;
  280. this.dkStaffName.StaffEntity = null;
  281. this.comRAPType.SelectedIndex = 0;
  282. this.comSettlementFlag.SelectedIndex = 0;
  283. this.comAdministrationType.SelectedIndex = 0;
  284. }
  285. #endregion
  286. #region 私有方法
  287. /// <summary>
  288. /// 设置窗体按钮的文本信息
  289. /// </summary>
  290. private void SetFromTitleInfo()
  291. {
  292. this.Text = FormTitles.F_HR_1103;
  293. this.tsbtnApprover.Text = ButtonText.TSBTN_APPROVER;
  294. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  295. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  296. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  297. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  298. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  299. }
  300. /// <summary>
  301. /// 获取奖惩类型数据源
  302. /// </summary>
  303. /// <returns></returns>
  304. private DataTable GetRAPTypeInfo()
  305. {
  306. //1:奖励;-1:惩罚
  307. DataTable dtRAPType = new DataTable();
  308. dtRAPType.Columns.Add("TypeID");
  309. dtRAPType.Columns.Add("TypeName");
  310. DataRow newRowType = dtRAPType.NewRow();
  311. newRowType["TypeID"] = Constant.CBO_SELECT_ALL_VALUE;
  312. newRowType["TypeName"] = Constant.CBO_SELECT_ALL_NAME;
  313. dtRAPType.Rows.Add(newRowType);
  314. newRowType = dtRAPType.NewRow();
  315. newRowType["TypeID"] = "1";
  316. newRowType["TypeName"] = "奖励";
  317. dtRAPType.Rows.Add(newRowType);
  318. newRowType = dtRAPType.NewRow();
  319. newRowType["TypeID"] = "-1";
  320. newRowType["TypeName"] = "惩罚";
  321. dtRAPType.Rows.Add(newRowType);
  322. return dtRAPType;
  323. }
  324. /// <summary>
  325. /// 工资结算标识数据源
  326. /// </summary>
  327. /// <returns></returns>
  328. private DataTable GetSettlementFlagInfo()
  329. {
  330. //1:已经结算 0:未结算
  331. DataTable dtRAPType = new DataTable();
  332. dtRAPType.Columns.Add("SettlementFlagID");
  333. dtRAPType.Columns.Add("SettlementFlagName");
  334. DataRow newRowType = dtRAPType.NewRow();
  335. newRowType["SettlementFlagID"] = Constant.CBO_SELECT_ALL_VALUE;
  336. newRowType["SettlementFlagName"] = Constant.CBO_SELECT_ALL_NAME;
  337. dtRAPType.Rows.Add(newRowType);
  338. newRowType = dtRAPType.NewRow();
  339. newRowType["SettlementFlagID"] = "0";
  340. newRowType["SettlementFlagName"] = "未结算";
  341. dtRAPType.Rows.Add(newRowType);
  342. newRowType = dtRAPType.NewRow();
  343. newRowType["SettlementFlagID"] = "1";
  344. newRowType["SettlementFlagName"] = "已经结算";
  345. dtRAPType.Rows.Add(newRowType);
  346. return dtRAPType;
  347. }
  348. /// <summary>
  349. /// 获取行政考核类别数据源
  350. /// </summary>
  351. /// <returns></returns>
  352. public DataTable DataDictionaryInfo()
  353. {
  354. DataTable dtDicInfo = (DataTable)DoAsync(new AsyncMethod(() =>
  355. {
  356. return CommonModuleProxy.Service.GetDataDictionaryByType(Constant.ASE_ASE001);
  357. }));
  358. DataRow newRowDic = dtDicInfo.NewRow();
  359. newRowDic["DictionaryID"] = Constant.CBO_SELECT_ALL_VALUE;
  360. newRowDic["DictionaryValue"] = Constant.CBO_SELECT_ALL_NAME;
  361. dtDicInfo.Rows.InsertAt(newRowDic, 0);
  362. return dtDicInfo;
  363. }
  364. /// <summary>
  365. /// 根据查询条件 形成查询实体
  366. /// </summary>
  367. /// <returns></returns>
  368. public SearchAdminRAPEntity SetSearchAdminRAPEntity()
  369. {
  370. SearchAdminRAPEntity searchAdminRAPEntity = new SearchAdminRAPEntity();
  371. searchAdminRAPEntity.ValueFlag = Constant.ValueFlag.Effective.GetHashCode().ToString();
  372. searchAdminRAPEntity.AuditStatus = Constant.ApprovalStatus.Pending.GetHashCode();
  373. if (this.dkStaffName.UserID != null)
  374. {
  375. searchAdminRAPEntity.StaffID = this.dkStaffName.UserID;
  376. }
  377. if (this.comRAPType.SelectedValue != null
  378. && !Constant.CBO_SELECT_ALL_VALUE.Equals(this.comRAPType.SelectedValue.ToString()))
  379. {
  380. searchAdminRAPEntity.RAPType = Convert.ToDouble(this.comRAPType.SelectedValue);
  381. }
  382. if (this.comSettlementFlag.SelectedValue != null
  383. && !Constant.CBO_SELECT_ALL_VALUE.Equals(this.comSettlementFlag.SelectedValue.ToString()))
  384. {
  385. searchAdminRAPEntity.SettlementFlag = this.comSettlementFlag.SelectedValue.ToString();
  386. }
  387. if (this.comAdministrationType.SelectedValue != null
  388. && !Constant.CBO_SELECT_ALL_VALUE.Equals(this.comAdministrationType.SelectedValue.ToString()))
  389. {
  390. searchAdminRAPEntity.AdministrationType = Convert.ToInt32(this.comAdministrationType.SelectedValue);
  391. }
  392. return searchAdminRAPEntity;
  393. }
  394. #endregion
  395. }
  396. }