| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_TAT_0301.cs
- * 2.功能描述:基本工资策略一览
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 任海 2014/12/10 1.00 新建
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.WCF.Proxys.TATModuleService;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- namespace Dongke.IBOSS.PRD.Client.TATModule
- {
- /// <summary>
- /// 基本工资策略一览
- /// </summary>
- public partial class F_TAT_0301 : DockPanelBase
- {
- #region 成员变量
- // 单例模式
- private static F_TAT_0301 _instance;
- // 检索用加载条件实体
- private BasicSalaryEntity _basicSalaryEntity = new BasicSalaryEntity();
- // 审核状态选择值
- private int? _auditStatusValue;
- // 策略类型选择值
- private int? _salaryTypeValue;
- #endregion
- #region 构造函数
- /// <summary>
- /// 窗体构造
- /// </summary>
- public F_TAT_0301()
- {
- InitializeComponent();
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式
- /// </summary>
- public static F_TAT_0301 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_TAT_0301();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件处理
- /// <summary>
- /// 窗体加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_TAT_0301_Load(object sender, EventArgs e)
- {
- try
- {
- this.Text = FormTitles.F_TAT_0301;
- this.dgvBasicSalary.AutoGenerateColumns = false;
- //绑定页面各查询条件的数据源
- this.BindSelectData();
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 窗体关闭后
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_TAT_0301_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 开始时间启用/关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void cbStartTime_CheckedChanged(object sender, EventArgs e)
- {
- this.dtpStartTimeBetween.Enabled = this.cbStartTime.Checked;
- this.dtpStartTimeAfter.Enabled = this.cbStartTime.Checked;
- }
- private void cbEndTime_CheckedChanged(object sender, EventArgs e)
- {
- this.dtpEndTimeBetween.Enabled = this.cbEndTime.Checked;
- this.dtpEndTimeAfter.Enabled = this.cbEndTime.Checked;
- }
- /// <summary>
- /// 清空条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.txtWagesName.Text = string.Empty;
- this.lbxAuditStatus.Text = string.Empty;
- this._auditStatusValue = null;
- this.txtRemarks.Text = string.Empty;
- this.cbStartTime.Checked = false;
- this.cbEndTime.Checked = false;
- this.lbxSalaryType.Text = string.Empty;
- this._salaryTypeValue = null;
- }
- /// <summary>
- /// 查询一览
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- //置空列表
- this.dgvBasicSalary.DataSource = null;
- //绑定下拉框数据
- this.BindSelectedData();
- //获取数据源
- ServiceResultEntity srEntity = (ServiceResultEntity)DoAsync(this.GetDate);
- if (srEntity.Data != null && srEntity.Data.Tables.Count != 0)
- {
- this.BindGridView(srEntity.Data.Tables[0]);
- }
- //服务实体共通处理
- ServiceResultEntityManager.HandleServiceResultEntity(srEntity, this.Text);
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 选中行改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvBasicSalary_SelectionChanged(object sender, EventArgs e)
- {
- DataGridViewRow gvrNow = this.dgvBasicSalary.CurrentRow;
- if (gvrNow != null)
- {
- //如果是待审核就可以进行修改,审核,停用
- if (Convert.ToInt32(gvrNow.Cells["colAuditStatus"].Value)
- == Convert.ToInt32(Constant.AuditStatus.Pending))
- {
- this.tsbtnEdit.Enabled = true;
- this.tsbtnApprover.Enabled = true;
- this.tsbtnDisable.Enabled = true;
- }
- else //否则不可以
- {
- //如果是审批通过的则不可以删除
- if (Convert.ToInt32(gvrNow.Cells["colAuditStatus"].Value)
- == Convert.ToInt32(Constant.AuditStatus.Agree))
- {
- this.tsbtnDisable.Enabled = false;
- }
- else
- {
- this.tsbtnDisable.Enabled = true;
- }
- this.tsbtnEdit.Enabled = false;
- this.tsbtnApprover.Enabled = false;
- }
- }
- }
- /// <summary>
- /// 新建信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdd_Click(object sender, EventArgs e)
- {
- try
- {
- //以新建模式打开信息窗体
- F_TAT_0303 frmTAT0303 = new F_TAT_0303(Constant.FormMode.Add, 0);
- DialogResult dialogResult = frmTAT0303.ShowDialog();
- //操作成功后刷新数据源
- if (dialogResult == DialogResult.OK)
- {
- this.dgvBasicSalary.DataSource = null;
- this.BindSelectedData();
- ServiceResultEntity srEntity = (ServiceResultEntity)DoAsync(this.GetDate);
- if (srEntity.Data != null && srEntity.Data.Tables.Count != 0)
- {
- this.BindGridView(srEntity.Data.Tables[0]);
- }
- //服务实体共通处理
- ServiceResultEntityManager.HandleServiceResultEntity(srEntity, this.Text);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 编辑信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnEdit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvBasicSalary.CurrentRow;
- if (currentRow != null)
- {
- //获取需要添加明细的信息ID
- int entityId = Convert.ToInt32(currentRow.Cells["colWagesID"].Value);
- //以编辑模式打开信息窗体
- F_TAT_0303 frmTAT0303 = new F_TAT_0303(Constant.FormMode.Edit, entityId);
- DialogResult dialogResult = frmTAT0303.ShowDialog();
- //操作成功后刷新数据源
- if (dialogResult == DialogResult.OK)
- {
- this.dgvBasicSalary.DataSource = null;
- this.BindSelectedData();
- ServiceResultEntity srEntity = (ServiceResultEntity)DoAsync(this.GetDate);
- if (srEntity.Data != null && srEntity.Data.Tables.Count != 0)
- {
- this.BindGridView(srEntity.Data.Tables[0]);
- }
- //服务实体共通处理
- ServiceResultEntityManager.HandleServiceResultEntity(srEntity, this.Text);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 操作明细
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnDetail_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvBasicSalary.CurrentRow;
- if (currentRow != null)
- {
- //获取需要添加明细的信息ID
- int entityId = Convert.ToInt32(currentRow.Cells["colWagesID"].Value);
- String entityname = Convert.ToString(currentRow.Cells["colWagesName"].Value);
- //以编辑模式打开明细窗体
- F_TAT_0302 frmTAT0302 = new F_TAT_0302(Constant.FormMode.Edit, entityId, entityname);
- DialogResult dialogResult = frmTAT0302.ShowDialog();
- //操作成功后刷新数据源
- if (dialogResult == DialogResult.OK)
- {
- this.dgvBasicSalary.DataSource = null;
- this.BindSelectedData();
- ServiceResultEntity srEntity = (ServiceResultEntity)DoAsync(this.GetDate);
- if (srEntity.Data != null && srEntity.Data.Tables.Count != 0)
- {
- this.BindGridView(srEntity.Data.Tables[0]);
- }
- //服务实体共通处理
- ServiceResultEntityManager.HandleServiceResultEntity(srEntity, this.Text);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 审核信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnApprover_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvBasicSalary.CurrentRow;
- if (currentRow != null)
- {
- //获取需审核的信息ID
- int entityId = Convert.ToInt32(currentRow.Cells["colWagesID"].Value);
- //编辑窗体以审核模式开启
- F_TAT_0303 frmTAT0303 = new F_TAT_0303(Constant.FormMode.Display, entityId);
- DialogResult dialogResult = frmTAT0303.ShowDialog();
- //操作成功后刷新数据源与列表
- if (dialogResult == DialogResult.OK)
- {
- this.dgvBasicSalary.DataSource = null;
- this.BindSelectedData();
- ServiceResultEntity srEntity = (ServiceResultEntity)DoAsync(this.GetDate);
- if (srEntity.Data != null && srEntity.Data.Tables.Count != 0)
- {
- this.BindGridView(srEntity.Data.Tables[0]);
- }
- //服务实体共通处理
- ServiceResultEntityManager.HandleServiceResultEntity(srEntity, this.Text);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 停用信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnDisable_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvBasicSalary.CurrentRow;
- if (currentRow != null)
- {
- BasicSalaryEntity dfEntity = new BasicSalaryEntity();
- //获取ID以及时间戳
- dfEntity.BasicSalaryID = Convert.ToInt32(currentRow.Cells["colWagesID"].Value);
- dfEntity.OPTimeStamp = Convert.ToDateTime(currentRow.Cells["colOPTimeStamp"].Value);
- ServiceResultEntity srEntity = (ServiceResultEntity)DoAsync(() =>
- {
- return TATModuleProxy.Service.StopBasicSalary(dfEntity);
- });
- //服务实体共通处理
- ServiceResultEntityManager.HandleServiceResultEntity(srEntity, this.Text);
- //成功后刷新数据源
- if (srEntity.Status == Constant.ServiceResultStatus.Success)
- {
- this.dgvBasicSalary.DataSource = null;
- this.BindSelectedData();
- srEntity = (ServiceResultEntity)DoAsync(this.GetDate);
- if (srEntity.Data != null && srEntity.Data.Tables.Count != 0)
- {
- this.BindGridView(srEntity.Data.Tables[0]);
- }
- //服务实体共通处理
- ServiceResultEntityManager.HandleServiceResultEntity(srEntity, this.Text);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 复制添加信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnCopy_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvBasicSalary.CurrentRow;
- if (currentRow != null)
- {
- //获取需要添加明细的信息ID
- int entityId = Convert.ToInt32(currentRow.Cells["colWagesID"].Value);
- //以复制模式打开信息窗体
- F_TAT_0303 frmTAT0303 = new F_TAT_0303(Constant.FormMode.CopyAndAdd, entityId);
- DialogResult dialogResult = frmTAT0303.ShowDialog();
- //操作成功后刷新数据源
- if (dialogResult == DialogResult.OK)
- {
- this.dgvBasicSalary.DataSource = null;
- this.BindSelectedData();
- ServiceResultEntity srEntity = (ServiceResultEntity)DoAsync(this.GetDate);
- if (srEntity.Data != null && srEntity.Data.Tables.Count != 0)
- {
- this.BindGridView(srEntity.Data.Tables[0]);
- }
- //服务实体共通处理
- ServiceResultEntityManager.HandleServiceResultEntity(srEntity, this.Text);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 自适应列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvBasicSalary.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 窗体关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- #endregion
- #region 私有方法/函数
- /// <summary>
- /// 绑定检索条件数据
- /// </summary>
- private void BindSelectData()
- {
- try
- {
- //绑定审核状态
- DataSet dsStatus = SystemModuleProxy.Service.GetAuditStatus();
- this.lbxAuditStatus.DataSource = dsStatus.Tables[0];
- this.lbxAuditStatus.ValueMember = "AuditStatusID";
- this.lbxAuditStatus.DisplayMember = "AuditStatusName";
- this.lbxAuditStatus.Text = "";
- //绑定策略类型
- DataTable dtSalaryType = new DataTable();
- dtSalaryType.Columns.Add("SalaryTypeValue");
- dtSalaryType.Columns.Add("SalaryTypeName");
- Type SalaryTypeEnum = typeof(Constant.SalaryType);
- Array SalaryTypeArray = Enum.GetValues(SalaryTypeEnum);
- for (int i = 0; i < Constant.SalaryTypeName.Length; i++)
- {
- dtSalaryType.Rows.Add(Convert.ToInt32(SalaryTypeArray.GetValue(i)), Constant.SalaryTypeName[i]);
- }
- this.lbxSalaryType.DisplayMember = "SalaryTypeName";
- this.lbxSalaryType.ValueMember = "SalaryTypeValue";
- this.lbxSalaryType.DataSource = dtSalaryType;
- this.lbxSalaryType.Text = "";
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 获取页面的输入值
- /// </summary>
- private void BindSelectedData()
- {
- try
- {
- if (this.lbxSalaryType.SelectedValue != null)
- {
- this._salaryTypeValue = Convert.ToInt32(this.lbxSalaryType.SelectedValue);
- }
- else
- {
- this._salaryTypeValue = null;
- }
- if (this.lbxAuditStatus.SelectedValue != null)
- {
- this._auditStatusValue = Convert.ToInt32(this.lbxAuditStatus.SelectedValue);
- }
- else
- {
- this._auditStatusValue = null;
- }
- //为查询用实体赋值
- this._basicSalaryEntity = new BasicSalaryEntity();
- if (!string.IsNullOrWhiteSpace(this.txtWagesName.Text))
- {
- this._basicSalaryEntity.BasicSalaryName = this.txtWagesName.Text.Trim();
- }
- if (this._auditStatusValue != null)
- {
- this._basicSalaryEntity.AuditStatus = this._auditStatusValue;
- }
- if (!string.IsNullOrWhiteSpace(this.txtRemarks.Text))
- {
- this._basicSalaryEntity.Remarks = this.txtRemarks.Text;
- }
- if (this.cbStartTime.Checked)
- {
- this._basicSalaryEntity.BeginAccountMonth = this.dtpStartTimeBetween.Value;
- this._basicSalaryEntity.BeginAccountMonthEnd = this.dtpStartTimeAfter.Value.AddDays(1);
- }
- if (this.cbEndTime.Checked)
- {
- this._basicSalaryEntity.EndAccountMonth = this.dtpEndTimeBetween.Value;
- this._basicSalaryEntity.EndAccountMonthEnd = this.dtpEndTimeAfter.Value.AddDays(1);
- }
- if (this._salaryTypeValue != null)
- {
- this._basicSalaryEntity.SalaryType = Convert.ToInt32(this._salaryTypeValue);
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 绑定列表查询数据
- /// </summary>
- private ServiceResultEntity GetDate()
- {
- try
- {
- return TATModuleProxy.Service.GetBasicSalary(this._basicSalaryEntity);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 绑定页面数据源
- /// </summary>
- /// <param name="dtSourse">数据源TABLE</param>
- private void BindGridView(DataTable dtSourse)
- {
- this.dgvBasicSalary.DataSource = dtSourse;
- this.dgvBasicSalary.ReadOnly = true;
- }
- #endregion
- }
- }
|