F_HR_1201.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_HR_1201.cs
  5. * 2.功能描述:工资结算记录查询
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/09/12 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.Basics.Library;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  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. public partial class F_HR_1201 : DockPanelBase
  24. {
  25. #region 成员变量
  26. // 单例模式
  27. private static F_HR_1201 _instance;
  28. #endregion
  29. #region 构造函数
  30. /// <summary>
  31. /// 构造函数
  32. /// </summary>
  33. public F_HR_1201()
  34. {
  35. InitializeComponent();
  36. }
  37. #endregion
  38. #region 单例模式
  39. /// <summary>
  40. /// 单例模式,防止重复创建窗体
  41. /// </summary>
  42. public static F_HR_1201 Instance
  43. {
  44. get
  45. {
  46. if (_instance == null)
  47. {
  48. _instance = new F_HR_1201();
  49. }
  50. return _instance;
  51. }
  52. }
  53. #endregion
  54. private void btnSearch_Click(object sender, EventArgs e)
  55. {
  56. try
  57. {
  58. this.dgvSettlement.DataSource = null;
  59. BindData();
  60. if (this.dgvSettlement.Rows.Count == 0)
  61. {
  62. // 提示未查找到数据
  63. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  64. MessageBoxButtons.OK, MessageBoxIcon.Information);
  65. }
  66. }
  67. catch(Exception ex)
  68. {
  69. // 对异常进行共通处理
  70. ExceptionManager.HandleEventException(this.ToString(),
  71. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  72. }
  73. }
  74. private void btnClearCondition_Click(object sender, EventArgs e)
  75. {
  76. this.txtRemarks.Text = string.Empty;
  77. }
  78. private void tsbtnAdd_Click(object sender, EventArgs e)
  79. {
  80. try
  81. {
  82. //以新建模式打开信息窗体
  83. F_HR_1202 frmHR1202 = new F_HR_1202(0,Constant.FormMode.Add);
  84. DialogResult dialogResult = frmHR1202.ShowDialog();
  85. //操作成功后刷新数据源
  86. if (dialogResult == DialogResult.OK)
  87. {
  88. this.dgvSettlement.DataSource = null;
  89. this.BindData();
  90. if (this.dgvSettlement.Rows.Count == 0)
  91. {
  92. // 提示未查找到数据
  93. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  94. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  95. }
  96. }
  97. }
  98. catch (Exception ex)
  99. {
  100. // 对异常进行共通处理
  101. ExceptionManager.HandleEventException(this.ToString(),
  102. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  103. }
  104. }
  105. private void tsbtnEdit_Click(object sender, EventArgs e)
  106. {
  107. try
  108. {
  109. DataGridViewRow currentRow = this.dgvSettlement.CurrentRow;
  110. if (currentRow != null)
  111. {
  112. int entityId = Convert.ToInt32(currentRow.Cells["SalarySettlementID"].Value);
  113. //以新建模式打开信息窗体
  114. F_HR_1202 frmHR1202 = new F_HR_1202(entityId, Constant.FormMode.Edit);
  115. DialogResult dialogResult = frmHR1202.ShowDialog();
  116. //操作成功后刷新数据源
  117. if (dialogResult == DialogResult.OK)
  118. {
  119. this.dgvSettlement.DataSource = null;
  120. this.BindData();
  121. if (this.dgvSettlement.Rows.Count == 0)
  122. {
  123. // 提示未查找到数据
  124. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  125. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  126. }
  127. }
  128. }
  129. }
  130. catch (Exception ex)
  131. {
  132. // 对异常进行共通处理
  133. ExceptionManager.HandleEventException(this.ToString(),
  134. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  135. }
  136. }
  137. private void tsbtnAudit_Click(object sender, EventArgs e)
  138. {
  139. try
  140. {
  141. DataGridViewRow currentRow = this.dgvSettlement.CurrentRow;
  142. if (currentRow != null)
  143. {
  144. int entityId = Convert.ToInt32(currentRow.Cells["SalarySettlementID"].Value);
  145. //以新建模式打开信息窗体
  146. F_HR_1202 frmHR1202 = new F_HR_1202(entityId, Constant.FormMode.Display);
  147. DialogResult dialogResult = frmHR1202.ShowDialog();
  148. //操作成功后刷新数据源
  149. if (dialogResult == DialogResult.OK)
  150. {
  151. this.dgvSettlement.DataSource = null;
  152. this.BindData();
  153. if (this.dgvSettlement.Rows.Count == 0)
  154. {
  155. // 提示未查找到数据
  156. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  157. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  158. }
  159. }
  160. }
  161. }
  162. catch (Exception ex)
  163. {
  164. // 对异常进行共通处理
  165. ExceptionManager.HandleEventException(this.ToString(),
  166. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  167. }
  168. }
  169. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  170. {
  171. this.dgvSettlement.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  172. }
  173. private void tsbtnClose_Click(object sender, EventArgs e)
  174. {
  175. this.Close();
  176. }
  177. private void BindData()
  178. {
  179. try
  180. {
  181. GetSalaryEntity gsEntity = new GetSalaryEntity();
  182. gsEntity.SalaryDateS = Convert.ToDateTime(this.dtpSalaryDateS.Value.Year + "/" + this.dtpSalaryDateS.Value.Month + "/" + "01");
  183. gsEntity.SalaryDateE = Convert.ToDateTime(this.dtpSalaryDateE.Value.Year + "/" + this.dtpSalaryDateE.Value.Month + "/" + "01");
  184. gsEntity.Remarks = this.txtRemarks.Text;
  185. DataSet dsSourse = (DataSet)DoAsync(new AsyncMethod(() =>
  186. {
  187. return HRModuleProxy.Service.GetSettlementMain(gsEntity);
  188. }));
  189. if(dsSourse != null)
  190. {
  191. this.dgvSettlement.AutoGenerateColumns = false;
  192. this.dgvSettlement.DataSource = dsSourse.Tables[0];
  193. this.dgvSettlement.ReadOnly = true;
  194. }
  195. }
  196. catch(Exception ex)
  197. {
  198. throw ex;
  199. }
  200. }
  201. private void F_HR_1201_FormClosed(object sender, FormClosedEventArgs e)
  202. {
  203. _instance = null;
  204. }
  205. private void dgvSettlement_SelectionChanged(object sender, EventArgs e)
  206. {
  207. if(this.dgvSettlement.SelectedRows.Count !=0)
  208. {
  209. this.tsbtnEdit.Enabled = true;
  210. this.tsbtnAudit.Enabled = true;
  211. }
  212. }
  213. }
  214. }