/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PAM_0501.cs
* 2.功能描述:行政奖惩
* 编辑履历:
* 作者 日期 版本 修改内容
* 张国印 2014/09/24 1.00 新建
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Data;
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.HRModule
{
///
/// 行政奖惩
///
public partial class F_PAM_0503 : DKDockPanelBase
{
#region 成员变量
// 窗体的单例模式
private static F_PAM_0503 _instance;
//Grid当前选中的行
private int _selectedRowIndex;
//用户编辑的ID集合
int[] _staffIDList;
#endregion
#region 构造函数
///
/// 构造函数
///
public F_PAM_0503()
{
InitializeComponent();
this.SetFromTitleInfo();
}
#endregion
#region 单例模式
///
/// 单例模式,防止重复创建窗体
///
public static F_PAM_0503 Instance
{
get
{
if (_instance == null)
{
_instance = new F_PAM_0503();
}
return _instance;
}
}
#endregion
#region 事件
///
/// 窗体加载事件
///
///
///
private void F_HR_1101_Load(object sender, EventArgs e)
{
try
{
#region 绑定数据源
this.dkStaffName.WhereCondition = "(StaffStatus = 1 Or StaffStatus = 2) AND ValueFlag = 1";
this.comAdministrationType.DataSource = DataDictionaryInfo();
this.comAdministrationType.DisplayMember = "DictionaryValue";
this.comAdministrationType.ValueMember = "DictionaryID";
#endregion
FormPermissionManager.FormPermissionControl(this.Name, this,
LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 窗体关闭事件
///
///
///
private void F_HR_1101_FormClosed(object sender, FormClosedEventArgs e)
{
_instance = null;
}
///
/// 行获取焦点事件
///
///
///
private void dgvStaff_CellEnter(object sender, DataGridViewCellEventArgs e)
{
try
{
if (this.dgvStaff.CurrentCell != null)
{
// 记录最后选择行
this._selectedRowIndex = this.dgvStaff.CurrentCell.RowIndex;
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 停用按钮事件
///
///
///
private void tsbtnDisable_Click(object sender, EventArgs e)
{
try
{
List AdminEXAIDs = new List();
dgvStaff.EndEdit();
foreach (DataGridViewRow item in dgvStaff.Rows)
{
if ("1" == item.Cells["sel"].Value.ToString())
{
AdminEXAIDs.Add(item.Cells["AdminEXAID"].Value.ToString());
}
}
if (AdminEXAIDs.Count > 0)
{
string ids = string.Join(",", AdminEXAIDs);
F_PAM_0504 fpam0504 = new F_PAM_0504(ids);
fpam0504.ShowDialog();
this.btnSearch_Click(null, null);
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 自动适应列宽
///
///
///
private void tsbtnAdaptive_Click(object sender, EventArgs e)
{
this.dgvStaff.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
}
///
/// 关闭按钮事件
///
///
///
private void tsbtnClose_Click(object sender, EventArgs e)
{
this.Close();
}
///
/// 查询按钮事件
///
///
///
private void btnSearch_Click(object sender, EventArgs e)
{
try
{
this._staffIDList = null;
this.dgvStaff.DataSource = null;
// 记录当前选中行
//int selectRowIndex = this._selectedRowIndex;
AdminEXAEntity se = SetSearchAdminRAPEntity();
ServiceResultEntity sre = DoAsync(() =>
{
return PAMModuleProxy.Service.GetAdminEXA(se);
}
);
if (sre.Status == Constant.ServiceResultStatus.Success)
{
this.dgvStaff.DataSource = sre.Data.Tables[0];
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 清空条件
///
///
///
private void btnClearCondition_Click(object sender, EventArgs e)
{
this.dkStaffName.UserID = null;
this.dkStaffName.UserCode = string.Empty;
this.dkStaffName.UserName = string.Empty;
this.dkStaffName.StaffEntity = null;
this.comAdministrationType.SelectedIndex = 0;
this.txtRemarks.Clear();
}
#endregion
#region 私有方法
///
/// 设置窗体按钮的文本信息
///
private void SetFromTitleInfo()
{
this.Text = FormTitles.F_PAM_0503;
this.tsbtnApprover.Text = ButtonText.TSBTN_AUDIT;
this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
this.btnSearch.Text = ButtonText.BTN_SEARCH;
this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
}
///
/// 获取行政考核类别数据源
///
///
public DataTable DataDictionaryInfo()
{
DataTable dtDicInfo = (DataTable)DoAsync(new AsyncMethod(() =>
{
return CommonModuleProxy.Service.GetDataDictionaryByType(Constant.ASE_ASE001);
}));
DataRow newRowDic = dtDicInfo.NewRow();
newRowDic["DictionaryID"] = Constant.CBO_SELECT_ALL_VALUE;
newRowDic["DictionaryValue"] = Constant.CBO_SELECT_ALL_NAME;
dtDicInfo.Rows.InsertAt(newRowDic, 0);
return dtDicInfo;
}
///
/// 根据查询条件 形成查询实体
///
///
public AdminEXAEntity SetSearchAdminRAPEntity()
{
AdminEXAEntity searchAdminRAPEntity = new AdminEXAEntity();
// searchAdminRAPEntity.ValueFlag = Constant.ValueFlag.Effective.GetHashCode().ToString();
if (this.dkStaffName.UserID != null)
{
searchAdminRAPEntity.StaffID = this.dkStaffName.UserID.Value;
}
if (this.comAdministrationType.SelectedValue != null
&& Constant.CBO_SELECT_ALL_VALUE.ToString() !=this.comAdministrationType.SelectedValue.ToString())
{
searchAdminRAPEntity.AdminEXATypeID = Convert.ToInt32(this.comAdministrationType.SelectedValue);
}
searchAdminRAPEntity.AuditStatus = 0;
searchAdminRAPEntity.Remarks = this.txtRemarks.Text;
return searchAdminRAPEntity;
}
#endregion
}
}