| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_HR_1201.cs
- * 2.功能描述:工资结算记录查询
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 庄天威 2014/09/12 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.Basics.Library;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.DataModels;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.HRModuleService;
- namespace Dongke.IBOSS.PRD.Client.HRModule
- {
- public partial class F_HR_1201 : DockPanelBase
- {
- #region 成员变量
- // 单例模式
- private static F_HR_1201 _instance;
- #endregion
- #region 构造函数
- /// <summary>
- /// 构造函数
- /// </summary>
- public F_HR_1201()
- {
- InitializeComponent();
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_HR_1201 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_HR_1201();
- }
- return _instance;
- }
- }
- #endregion
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- this.dgvSettlement.DataSource = null;
- BindData();
- if (this.dgvSettlement.Rows.Count == 0)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- catch(Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.txtRemarks.Text = string.Empty;
- }
- private void tsbtnAdd_Click(object sender, EventArgs e)
- {
- try
- {
- //以新建模式打开信息窗体
- F_HR_1202 frmHR1202 = new F_HR_1202(0,Constant.FormMode.Add);
- DialogResult dialogResult = frmHR1202.ShowDialog();
- //操作成功后刷新数据源
- if (dialogResult == DialogResult.OK)
- {
- this.dgvSettlement.DataSource = null;
- this.BindData();
- if (this.dgvSettlement.Rows.Count == 0)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void tsbtnEdit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvSettlement.CurrentRow;
- if (currentRow != null)
- {
- int entityId = Convert.ToInt32(currentRow.Cells["SalarySettlementID"].Value);
- //以新建模式打开信息窗体
- F_HR_1202 frmHR1202 = new F_HR_1202(entityId, Constant.FormMode.Edit);
- DialogResult dialogResult = frmHR1202.ShowDialog();
- //操作成功后刷新数据源
- if (dialogResult == DialogResult.OK)
- {
- this.dgvSettlement.DataSource = null;
- this.BindData();
- if (this.dgvSettlement.Rows.Count == 0)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void tsbtnAudit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvSettlement.CurrentRow;
- if (currentRow != null)
- {
- int entityId = Convert.ToInt32(currentRow.Cells["SalarySettlementID"].Value);
- //以新建模式打开信息窗体
- F_HR_1202 frmHR1202 = new F_HR_1202(entityId, Constant.FormMode.Display);
- DialogResult dialogResult = frmHR1202.ShowDialog();
- //操作成功后刷新数据源
- if (dialogResult == DialogResult.OK)
- {
- this.dgvSettlement.DataSource = null;
- this.BindData();
- if (this.dgvSettlement.Rows.Count == 0)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvSettlement.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void BindData()
- {
- try
- {
- GetSalaryEntity gsEntity = new GetSalaryEntity();
- gsEntity.SalaryDateS = Convert.ToDateTime(this.dtpSalaryDateS.Value.Year + "/" + this.dtpSalaryDateS.Value.Month + "/" + "01");
- gsEntity.SalaryDateE = Convert.ToDateTime(this.dtpSalaryDateE.Value.Year + "/" + this.dtpSalaryDateE.Value.Month + "/" + "01");
- gsEntity.Remarks = this.txtRemarks.Text;
- DataSet dsSourse = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return HRModuleProxy.Service.GetSettlementMain(gsEntity);
- }));
- if(dsSourse != null)
- {
- this.dgvSettlement.AutoGenerateColumns = false;
- this.dgvSettlement.DataSource = dsSourse.Tables[0];
- this.dgvSettlement.ReadOnly = true;
- }
- }
- catch(Exception ex)
- {
- throw ex;
- }
- }
- private void F_HR_1201_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- private void dgvSettlement_SelectionChanged(object sender, EventArgs e)
- {
- if(this.dgvSettlement.SelectedRows.Count !=0)
- {
- this.tsbtnEdit.Enabled = true;
- this.tsbtnAudit.Enabled = true;
- }
- }
- }
- }
|