| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PAM_0101.cs
- * 2.功能描述:工资方案参数设定
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/08/17 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Reflection;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls;
- using Dongke.IBOSS.PRD.Client.DataModels;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.PAMModule
- {
- /// <summary>
- /// 工资方案参数设定
- /// </summary>
- public partial class F_PAM_0101 : DKDockPanelBase
- {
- #region 成员变量
- // 单例模式
- private static F_PAM_0101 _instance;
- // 数据源
- private DataTable _dtSourse;
- // 选定行
- private int _selectedRow = 0;
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PAM_0101 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PAM_0101();
- }
- return _instance;
- }
- }
- #endregion
- #region 构造函数
- public F_PAM_0101()
- {
- InitializeComponent();
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.tsbtnSave.Text = ButtonText.BTN_SAVE;
- this.Text = FormTitles.F_PAM_0101;
- }
- #endregion
- #region 事件
- /// <summary>
- /// 关闭按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 自动适应列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvPayPlanSetting.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PAM_0101_Load(object sender, EventArgs e)
- {
- try
- {
- // 设置datagridview不自动创建列
- this.dgvPayPlanSetting.AutoGenerateColumns = false;
- //this.dgvPayPlanSetting.IsSetInputColumnsColor = true;
- this.dgvPayPlanSetting.AllowUserToDeleteRows = false;
- // 加载数据源
- this.GetPayPlanSetting();
- //权限控制
- FormPermissionManager.FormPermissionControl(this.Name, this,
- LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- this.dgvPayPlanSetting.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;
- tsbtnSave.Size = new System.Drawing.Size(60,25);
- }
- 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_PAM_0101_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 保存按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnSave_Click(object sender, EventArgs e)
- {
- try
- {
- //this.dgvPayPlanSetting.CommitEdit(DataGridViewDataErrorContexts.Commit);
- this.dgvPayPlanSetting.EndEdit();
- DataTable dt = this.dgvPayPlanSetting.DataSource as DataTable;
- if (dt == null)
- {
- return;
- }
- int returnValue = (int)DoAsync(new AsyncMethod(() =>
- {
- return PAMModuleProxy.Service.SavePayPlanSetting(dt);
- }));
- if (returnValue > 0)
- {
- // 提示信息
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- GetPayPlanSetting();
- }
- //else if (returnValue == 0)
- //{
- // // 提示信息
- // MessageBox.Show("保存失败",
- // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- //}
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 获取数据
- /// </summary>
- /// <returns></returns>
- /// <remarks>
- ///
- /// </remarks>
- private void GetPayPlanSetting()
- {
- try
- {
- DataSet dsResultAccount = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetPayPlanSetting();
- }));
- this._dtSourse = dsResultAccount.Tables[0];
- this.dgvPayPlanSetting.DataSource = this._dtSourse;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- private void dgvPayPlanSetting_CurrentCellDirtyStateChanged(object sender, EventArgs e)
- {
- //try
- //{
- // if (this.dgvPayPlanSetting.CurrentRow != null && this.dgvPayPlanSetting.IsCurrentCellDirty)
- // {
- // if ("SettingValue".Equals(this.dgvPayPlanSetting.Columns
- // [this.dgvPayPlanSetting.CurrentCell.ColumnIndex].Name))
- // {
- // this.dgvPayPlanSetting.CommitEdit(DataGridViewDataErrorContexts.Commit);
- // }
- // }
- //}
- //catch (Exception ex)
- //{
- // // 对异常进行共通处理
- // ExceptionManager.HandleEventException(this.ToString(),
- // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- //}
- }
- private void F_PAM_0101_Shown(object sender, EventArgs e)
- {
- this.dgvPayPlanSetting.IsSetInputColumnsColor = true;
- }
- }
- }
|