/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_HR_0401.cs
* 2.功能描述:员工离职
* 编辑履历:
* 作者 日期 版本 修改内容
* 张国印 2014/09/16 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.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.DataModels.HRModule;
using Dongke.IBOSS.PRD.WCF.Proxys;
namespace Dongke.IBOSS.PRD.Client.HRModule
{
///
/// 员工离职
///
public partial class F_HR_0401 : DockPanelBase
{
#region 成员变量
// 窗体的单例模式
private static F_HR_0401 _instance;
//Grid当前选中的行
private int _selectedRowIndex;
// 查询条件实体
private HR_CMN_StaffEntity _staffEntity = new HR_CMN_StaffEntity();
//用户编辑的ID集合
int[] _staffIDList;
// 员工ID
private int _staffID;
#endregion
#region 构造函数处理
///
/// 构造函数
///
public F_HR_0401()
{
InitializeComponent();
this.SetFromTitleInfo();
// 设置ToolStripButton状态
//this.SetToolStripButtonEnable();
}
#endregion
#region 单例模式
///
/// 单例模式,防止重复创建窗体
///
public static F_HR_0401 Instance
{
get
{
if (_instance == null)
{
_instance = new F_HR_0401();
}
return _instance;
}
}
#endregion
#region 事件处理
///
/// 页面加载事件
///
///
///
private void F_HR_0401_Load(object sender, EventArgs e)
{
try
{
FormPermissionManager.FormPermissionControl(this.Name, this,
LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
this.tsbtnDisable.Visible = false;
// 加载员工状态
DataTable dtStaffStatus = LogInUserInfo.CurrentUser.GetSystemParameterByName(Constant.SysCacheTable.TP_SYS_StaffStatus);
this.SelStaffStatus.DataSource = dtStaffStatus;
this.SelStaffStatus.SelectedValues = new object[] { 0, 1, 2 };
//this.SelStaffStatus.AllItemCheck();
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 窗体关闭事件
///
///
///
private void F_HR_0401_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 dgvStaff_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
// {
// if (Constant.INT_IS_NEGATIE_ONE < e.RowIndex && Constant.INT_IS_NEGATIE_ONE < e.ColumnIndex
// && this.tsbtnEdit.Enabled && this.tsbtnEdit.Visible)
// {
//this.tsbtnTurnover_Click(sender, e);
// }
// }
///
/// 添加按钮
///
///
///
//private void tsbtnAdd_Click(object sender, EventArgs e)
//{
// try
// {
//F_HR_0402 frmHR0402 = new F_HR_0402(Constant.FormMode.Add, Constant.INT_IS_NEGATIE_ONE, Constant.INT_IS_NEGATIE_ONE);
//if (frmHR0402.ShowDialog() == DialogResult.OK)
//{
// this._staffIDList = frmHR0402.StaffIDList.ToArray();
// DataSet userDataSet = (DataSet)DoAsync(new AsyncMethod(this.GetDataGridViewInfo));
// if (userDataSet != null && userDataSet.Tables.Count > Constant.INT_IS_ZERO
// && userDataSet.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
// {
// this.dgvStaff.DataSource = null;
// this.dgvStaff.DataSource = userDataSet.Tables[0];
// // 设置ToolStripButton按钮状态
// this.SetToolStripButtonEnable();
// this.dgvStaff.ReadOnly = true;
// }
//}
// }
// catch (Exception ex)
// {
// // 对异常进行共通处理
// ExceptionManager.HandleEventException(this.ToString(),
// System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
// }
//}
///
/// 编辑按钮
///
///
///
//private void tsbtnEdit_Click(object sender, EventArgs e)
//{
// try
// {
//if (this.dgvStaff.CurrentRow != null)
//{
// if (this.dgvStaff.CurrentRow.Cells["ApprovalStatus"].Value == null || this.dgvStaff.CurrentRow.Cells["RecordType"].Value == null)
// {
// MessageBox.Show(string.Format(Messages.MSG_HR_W007, "员工离职", "编辑"),
// this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
// }
// string strApprovalStatus = this.dgvStaff.CurrentRow.Cells["ApprovalStatus"].Value.ToString();
// string strRecordType = this.dgvStaff.CurrentRow.Cells["RecordType"].Value.ToString();
// if (Constant.ApprovalStatus.Pending.GetHashCode().ToString().Equals(strApprovalStatus)
// && Constant.StaffRecordType.Departure.GetHashCode().ToString().Equals(strRecordType))
// {
// int intStaffID = Convert.ToInt32(this.dgvStaff.CurrentRow.Cells["StaffID"].Value);
// int intStaffRecordID = Convert.ToInt32(this.dgvStaff.CurrentRow.Cells["StaffRecordID"].Value);
// F_HR_0402 frmHR0402 = new F_HR_0402(Constant.FormMode.Edit, intStaffID, intStaffRecordID);
// if (frmHR0402.ShowDialog() == DialogResult.OK)
// {
// this._staffIDList = frmHR0402.StaffIDList.ToArray();
// DataSet userDataSet = (DataSet)DoAsync(new AsyncMethod(this.GetDataGridViewInfo));
// if (userDataSet != null && userDataSet.Tables.Count > Constant.INT_IS_ZERO
// && userDataSet.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
// {
// this.dgvStaff.DataSource = null;
// this.dgvStaff.DataSource = userDataSet.Tables[0];
// // 设置ToolStripButton按钮状态
// this.SetToolStripButtonEnable();
// this.dgvStaff.ReadOnly = true;
// }
// }
// }
// else
// {
// MessageBox.Show(string.Format(Messages.MSG_HR_W007, "员工离职", "编辑"),
// this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
// return;
// }
//}
// }
// catch (Exception ex)
// {
// // 对异常进行共通处理
// ExceptionManager.HandleEventException(this.ToString(),
// System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
// }
//}
///
/// 停用按钮事件
///
///
///
private void tsbtnDisable_Click(object sender, EventArgs e)
{
try
{
DialogResult msgBoxResult = MessageBox.Show(
string.Format(Messages.MSG_CMN_Q002, "该员工", "停用"), this.Text,
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (msgBoxResult == DialogResult.Yes)
{
int staffid = Convert.ToInt32(this.dgvStaff.CurrentRow.Cells["StaffRecordID"].Value);
this._staffID = staffid;
HRResultEntity resultStaff = (HRResultEntity)DoAsync(() =>
{
return HRModuleProxy.Service.SetStaffRecordValueFlag(_staffID);
}
);
//this.dgvStaff.ReadOnly = true;
// 修改成功
if (resultStaff.OperateStatus > Constant.INT_IS_ZERO)
{
MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "员工离职", "停用"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.btnSearch_Click(sender, e);
}
else if (resultStaff.OperateStatus == Constant.INT_IS_NEGATIE_FIVE)
{
MessageBox.Show(Messages.MSG_HR_W002,
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "员工离职", "停用"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 更多条件按钮
///
///
///
private void tsbtnMoreCondition_Click(object sender, EventArgs e)
{
HR_CMN_001 frmCMN001 = new HR_CMN_001();
frmCMN001.StaffEntity = _staffEntity;
if (frmCMN001.ShowDialog() == DialogResult.OK)
{
this.txtOtherWhere.Text = frmCMN001.StaffEntity.GetSqlDispText();
this._staffEntity = frmCMN001.StaffEntity;
}
}
///
/// 自动适应列宽
///
///
///
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;
// 记录当前选中行
int selectRowIndex = this._selectedRowIndex;
DataSet dsResultStaff = (DataSet)DoAsync(new AsyncMethod(this.GetDataGridViewInfo));
if (dsResultStaff != null)
{
if (!dsResultStaff.Tables[0].Columns.Contains("Sel"))
{
dsResultStaff.Tables[0].Columns.Add("Sel", typeof(int));
}
base.DataSource = dsResultStaff;
if (this.DataSource != null && this.DataSource.Tables.Count > Constant.INT_IS_ZERO)
{
this.dgvStaff.DataSource = this.DataSource.Tables[0];
if (this.DataSource.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
{
// 提示未查找到数据
MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
#region 选择原有行
if (selectRowIndex >= Constant.INT_IS_ZERO)
{
if (selectRowIndex >= dsResultStaff.Tables[0].Rows.Count)
{
this.dgvStaff.Rows[this.dgvStaff.Rows.Count - 1].Selected = true;
this.dgvStaff.CurrentCell = this.dgvStaff.Rows[this.dgvStaff.Rows.Count - 1].Cells["StaffCode"];
}
else
{
this.dgvStaff.Rows[selectRowIndex].Selected = true;
this.dgvStaff.CurrentCell = this.dgvStaff.Rows[selectRowIndex].Cells["StaffCode"];
}
}
#endregion
}
}
foreach (DataGridViewColumn col in this.dgvStaff.Columns)
{
col.ReadOnly = col.Name == "Sel" ? false:true;
}
}
//this.SetToolStripButtonEnable();
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 清空条件
///
///
///
private void btnClearCondition_Click(object sender, EventArgs e)
{
// 加载员工状态
DataTable dtStaffStatus = LogInUserInfo.CurrentUser.GetSystemParameterByName(Constant.SysCacheTable.TP_SYS_StaffStatus);
this.SelStaffStatus.DataSource = dtStaffStatus;
this.SelStaffStatus.SelectedValues = new object[] { 0, 1, 2 };
//this.SelStaffStatus.AllItemCheck();
this.txtStaffCode.Clear();
this.txtStaffName.Clear();
this.txtOtherWhere.Clear();
this._staffEntity.ClearEntityValue();
}
///
/// 导入按钮点击事件
///
///
///
private void tsbtnImport_Click(object sender, EventArgs e)
{
try
{
this.oFileDialog.Filter = "Excel文件|*.xls;*.xlsx|Excel文件(*.xlsx)|*.xlsx|Excel文件(*.xls)|*.xls";
this.oFileDialog.FileName = string.Empty;
if (this.oFileDialog.ShowDialog() != DialogResult.OK)
{
return;
}
int v = (".xlsx" == System.IO.Path.GetExtension(this.oFileDialog.FileName)) ? 1 : 0;
DataTable dtStaffInfo = ExcelLayer.GetDataTable(this.oFileDialog.FileName, "Staff", v);
#region 对数据进行验证
if (dtStaffInfo == null || dtStaffInfo.Rows.Count < 1)
{
// 提示信息
MessageBox.Show(string.Format(Messages.MSG_CMN_W007, "文件正在被占用 或 导入的Excel文件中没有符合规则的数据!"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (!CheckImportExcel(dtStaffInfo))
{
// 提示信息
MessageBox.Show(string.Format(Messages.MSG_CMN_W007, "导入模板错误!"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (!CheckImportExcelData(dtStaffInfo))
{
return;
}
if (dtStaffInfo.Rows.Count < 1)
{
// 提示信息
MessageBox.Show(string.Format(Messages.MSG_CMN_W007, "导入的Excel文件中的数据没有员工编码!"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
#endregion
if (MessageBox.Show("导入成功,是否全部离职", this.Text,
MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
{
DataSet dsStaffInfo = new DataSet();
dsStaffInfo.Tables.Add(dtStaffInfo.Copy());
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "HR001";
cre.Name = "ImportStaffTurnover";
cre.Data = dsStaffInfo;
ServiceResultEntity result = CommonModuleProxy.Service.DoRequest(cre);
if (result.Status == Constant.ServiceResultStatus.Success)
{
MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "员工离职", "导入"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
// 导入成功之后,查询
string[] ids = (result.Result + "").Split(',');
this._staffIDList = new int[ids.Length];
for (int i = 0; i < ids.Length; i++)
{
this._staffIDList[i] = int.Parse(ids[i]);
}
DataSet dsHrStaff = (DataSet)DoAsync(new AsyncMethod(this.SearchHrStaff));
if (dsHrStaff != null && dsHrStaff.Tables.Count > Constant.INT_IS_ZERO
&& dsHrStaff.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
{
this.dgvStaff.DataSource = null;
this.dgvStaff.DataSource = dsHrStaff.Tables[0];
}
}
else
{
MessageBox.Show(string.Format(Messages.MSG_CMN_W007, result.Message),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 下载模板按钮点击事件
///
///
///
private void tsbtnDown_Click(object sender, EventArgs e)
{
try
{
TempletFileEntity resultTemplet = (TempletFileEntity)DoAsync(new AsyncMethod(() =>
{
return CommonModuleProxy.Service.GetTempletFileContentByUrl(Constant.HR_STAFF_DIMISSION_TEMPLET);
}));
if (string.IsNullOrEmpty(resultTemplet.FileName))
{
// 提示未查找到数据
MessageBox.Show(Messages.MSG_CMN_W021, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
this.sfDialogTemplet.FileName = resultTemplet.FileName;
this.sfDialogTemplet.Filter = "Excel文件(*.xlsx)|*.xlsx";
if (this.sfDialogTemplet.ShowDialog() == DialogResult.OK)
{
string localFilePath = this.sfDialogTemplet.FileName.ToString(); //获得文件路径
System.IO.File.WriteAllBytes(localFilePath, resultTemplet.FileContent);
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 离职按钮点击事件
///
///
///
private void tsbtnTurnover_Click(object sender, EventArgs e)
{
try
{
if (this.dgvStaff.DataSource == null || this.dgvStaff.CurrentRow == null)
{
// 提示未查找到数据
MessageBox.Show("未选择任何数据", this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
(this.dgvStaff.DataSource as DataTable).AcceptChanges();
DataTable dtStaff = (this.dgvStaff.DataSource as DataTable).Copy();
dtStaff.DefaultView.RowFilter = "Sel = 1";
dtStaff = dtStaff.DefaultView.ToTable();
if (dtStaff.Rows.Count == 0)
{
// 提示未查找到数据
MessageBox.Show("未选择任何数据", this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (MessageBox.Show("是否进行离职操作?", this.Text,
MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
{
string staffIDs = string.Empty;
foreach (DataRow row in dtStaff.Rows)
{
staffIDs += row["StaffID"] + ",";
}
staffIDs = staffIDs.Substring(0, staffIDs.Length - 1);
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "HR001";
cre.Name = "StaffTurnover";
cre.Properties["staffIDs"] = staffIDs;
DataSet dsStaff = new DataSet();
dsStaff.Tables.Add(dtStaff);
cre.Data = dsStaff;
ServiceResultEntity result = CommonModuleProxy.Service.DoRequest(cre);
if (result.Status == Constant.ServiceResultStatus.Success)
{
MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "员工离职", "离职"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
// 操作成功之后,查询
string[] ids = staffIDs.Split(',');
this._staffIDList = new int[ids.Length];
for (int i = 0; i < ids.Length; i++)
{
this._staffIDList[i] = int.Parse(ids[i]);
}
DataSet dsHrStaff = (DataSet)DoAsync(new AsyncMethod(this.SearchHrStaff));
if (dsHrStaff != null && dsHrStaff.Tables.Count > Constant.INT_IS_ZERO
&& dsHrStaff.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
{
this.dgvStaff.DataSource = null;
this.dgvStaff.DataSource = dsHrStaff.Tables[0];
// 设置ToolStripButton按钮状态
//this.SetToolStripButtonEnable();
}
}
else
{
MessageBox.Show(string.Format(Messages.MSG_CMN_W007, result.Message),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 提交对选择列的修改
///
///
///
private void dgvStaff_CurrentCellDirtyStateChanged(object sender, EventArgs e)
{
try
{
if (this.dgvStaff.CurrentRow != null && this.dgvStaff.IsCurrentCellDirty)
{
if ("Sel".Equals(this.dgvStaff.Columns[this.dgvStaff.CurrentCell.ColumnIndex].Name))
{
this.dgvStaff.CommitEdit(DataGridViewDataErrorContexts.Commit);
if ("已离职".Equals(this.dgvStaff.CurrentRow.Cells["StaffStatusName"].Value + ""))
{
MessageBox.Show("不能选择已经离职的员工",
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.dgvStaff.CurrentRow.Cells["Sel"].Value = 0;
}
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
#endregion
#region 私有方法
///
/// 获取员工档案数据集
///
///
private DataSet SearchHrStaff()
{
SearchStaffEntity pSearchStaff = new SearchStaffEntity();
if (this._staffIDList != null && this._staffIDList.Length > Constant.INT_IS_ZERO)
{
pSearchStaff.RStaffRecordIDList = this._staffIDList;
this._staffIDList = null;
}
else
{
DataConvert.Convert(_staffEntity, pSearchStaff);
pSearchStaff.StaffCode = this.txtStaffCode.Text.Trim();
pSearchStaff.StaffName = this.txtStaffName.Text.Trim();
pSearchStaff.ValueFlag = true;
pSearchStaff.StaffStatusArray = SelStaffStatus.SelectedArray;
}
try
{
return HRModuleProxy.Service.SearchHrStaff(pSearchStaff);
}
catch (Exception ex)
{
throw ex;
}
}
///
/// 设置工具按钮的可用状态
///
///
//private void SetToolStripButtonEnable()
// {
// if (this.dgvStaff.CurrentCell != null)
// {
// this.tsbtnEdit.Enabled = true;
// }
// else
// {
// this.tsbtnEdit.Enabled = false;
// }
// }
///
/// 设置窗体按钮的文本信息
///
private void SetFromTitleInfo()
{
this.Text = FormTitles.F_HR_0401;
//this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
//this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
this.tsbtnDisable.Text = ButtonText.TSBTN_DISABLE;
this.tsbtnMoreCondition.Text = ButtonText.TSBTN_MORECONDITION;
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;
}
///
/// 根据查询条件获取要显示的数据
///
/// 返回查询的结果集
private DataSet GetDataGridViewInfo()
{
SearchStaffEntity searchStaffEntity = new SearchStaffEntity();
DataConvert.Convert(this._staffEntity, searchStaffEntity);
searchStaffEntity.StaffCode = this.txtStaffCode.Text.Trim();
searchStaffEntity.StaffName = this.txtStaffName.Text.Trim();
//searchStaffEntity.Recordtype = Constant.StaffRecordType.Departure.GetHashCode(); //6:离职
//searchStaffEntity.RValueflag = Constant.ValueFlag.Effective.GetHashCode(); //1:正常
searchStaffEntity.StaffStatusArray = SelStaffStatus.SelectedArray;
searchStaffEntity.ValueFlag = true;
if (this._staffIDList != null && this._staffIDList.Length > Constant.INT_IS_ZERO)
{
searchStaffEntity.RStaffRecordIDList = this._staffIDList;
}
//return WCF.Proxys.HRModuleProxy.Service.SearchHrStaffAndRecord(searchStaffEntity);
return WCF.Proxys.HRModuleProxy.Service.SearchHrStaff(searchStaffEntity);
}
///
/// 导入的Excel列验证
///
///
///
private bool CheckImportExcel(DataTable datatable)
{
if (datatable.Columns.Count < 1)
{
return false;
}
if (!datatable.Columns.Contains("员工编码"))
{
return false;
}
if (!datatable.Columns.Contains("离职日期"))
{
return false;
}
return true;
}
///
/// 导入的Excel数据验证
///
///
///
private bool CheckImportExcelData(DataTable datatable)
{
List codes = new List();
string code = string.Empty;
foreach (DataRow item in datatable.Rows)
{
code = item["员工编码"] + "";
if (string.IsNullOrWhiteSpace(code))
{
item.Delete();
continue;
}
if (codes.Contains(code))
{
MessageBox.Show(string.Format(Messages.MSG_CMN_W007, "员工编码【" + code + "】重复。"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
codes.Add(code);
}
datatable.AcceptChanges();
return true;
}
#endregion
}
}