887 lines
30 KiB
C#
887 lines
30 KiB
C#
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 Ease.CoreV35.Utility;
|
|
using Payroll.BO;
|
|
using Ease.CoreV35.Model;
|
|
using System.Diagnostics;
|
|
using Payroll.Controls;
|
|
|
|
namespace Payroll.UI
|
|
{
|
|
public partial class fSearchEmployee : Form
|
|
{
|
|
private bool _MultipleSelection = false;
|
|
private bool _IsPayrollMember = false;
|
|
private bool _IsPosted = false;
|
|
private bool _IsConfirmed = false;
|
|
private bool _IsPFMember = false;
|
|
private bool _IsOTEligible = false;
|
|
private bool _IsExpatriate = false;
|
|
private bool _searchForSalary = false;
|
|
private bool _searchForUndoSalary = false;
|
|
private bool _searchForOPI = false;
|
|
private bool _searchForCarFuel = false;
|
|
private Ease.CoreV35.Model.ObjectsTemplate<Payroll.BO.SearchEmployee> _Emps = null;
|
|
private Ease.CoreV35.Model.ObjectsTemplate<Payroll.BO.SearchEmployee> _SelectedEmps = null;
|
|
private Payroll.BO.SearchEmployee _Emp = null;
|
|
private ObjectsTemplate<Grade> _Grades = null;
|
|
private bool _isFinished = false;
|
|
private ColumnHeader SortingColumn = null;
|
|
private HashSet< int > hsSet = null; // O(1) lookup for Employee
|
|
private ObjectsTemplate<Grade> _allGrades = null;
|
|
private ObjectsTemplate<Department> _allDepartments = null;
|
|
public fSearchEmployee()
|
|
{
|
|
InitializeComponent();
|
|
_allGrades = Grade.Get(EnumStatus.Active);
|
|
_allDepartments = Department.Get();
|
|
dtpChkBox.Checked = false;
|
|
dtpFromDate.Enabled = false;
|
|
dtpToDate.Enabled = false;
|
|
|
|
}
|
|
|
|
#region Properties
|
|
|
|
public Ease.CoreV35.Model.ObjectsTemplate<Payroll.BO.SearchEmployee> SelectedEmployees
|
|
{
|
|
get
|
|
{
|
|
if (_SelectedEmps == null) _SelectedEmps = new ObjectsTemplate<SearchEmployee>();
|
|
return _SelectedEmps;
|
|
}
|
|
}
|
|
|
|
public Payroll.BO.SearchEmployee SelectedEmployee
|
|
{
|
|
get
|
|
{
|
|
return _Emp;
|
|
}
|
|
}
|
|
|
|
public bool MultipleSelection
|
|
{
|
|
get
|
|
{
|
|
return _MultipleSelection;
|
|
}
|
|
set
|
|
{
|
|
lsvEmployee.MultiSelect = value;
|
|
lsvEmployee.CheckBoxes = value;
|
|
_MultipleSelection = value;
|
|
btnSelectAll.Visible = value;
|
|
//label12.Visible = value;
|
|
//lblTotSearched.Visible = value;
|
|
}
|
|
}
|
|
|
|
public bool IsPayrollMember
|
|
{
|
|
get
|
|
{
|
|
return _IsPayrollMember;
|
|
}
|
|
set
|
|
{
|
|
_IsPayrollMember = value;
|
|
chkLive.Checked = value;
|
|
}
|
|
}
|
|
|
|
public bool SearchForSalary
|
|
{
|
|
get
|
|
{
|
|
return _searchForSalary;
|
|
}
|
|
set
|
|
{
|
|
_searchForSalary = value;
|
|
}
|
|
}
|
|
|
|
public bool SearchForUndoSalary
|
|
{
|
|
get
|
|
{
|
|
return _searchForUndoSalary;
|
|
}
|
|
set
|
|
{
|
|
_searchForUndoSalary = value;
|
|
if (value) _searchForSalary = false;
|
|
}
|
|
}
|
|
|
|
public bool SearchForOPI
|
|
{
|
|
get
|
|
{
|
|
return _searchForOPI;
|
|
}
|
|
set
|
|
{
|
|
_searchForOPI = value;
|
|
}
|
|
}
|
|
public bool SearchForCarFuel
|
|
{
|
|
get
|
|
{
|
|
return _searchForCarFuel;
|
|
}
|
|
set
|
|
{
|
|
_searchForCarFuel = value;
|
|
}
|
|
}
|
|
|
|
public bool IsPosted
|
|
{
|
|
get
|
|
{
|
|
return _IsPosted;
|
|
}
|
|
set
|
|
{
|
|
_IsPosted = value;
|
|
}
|
|
}
|
|
|
|
public ObjectsTemplate<Employee> GetEmployees()
|
|
{
|
|
return Employee.Get(this.SelectedEmployees);
|
|
}
|
|
|
|
public bool IsConfirmated
|
|
{
|
|
get
|
|
{
|
|
return _IsConfirmed;
|
|
}
|
|
set
|
|
{
|
|
_IsConfirmed = value;
|
|
chkEmpConfirm.Checked = value;
|
|
}
|
|
}
|
|
|
|
public bool IsPFMember
|
|
{
|
|
get
|
|
{
|
|
return _IsPFMember;
|
|
}
|
|
set
|
|
{
|
|
_IsPFMember = value;
|
|
chkEmpPF.Checked = value;
|
|
}
|
|
}
|
|
|
|
public bool IsOTEligible
|
|
{
|
|
get
|
|
{
|
|
return _IsOTEligible;
|
|
}
|
|
set
|
|
{
|
|
_IsOTEligible = value;
|
|
chkOTEligibility.Checked = value;
|
|
}
|
|
}
|
|
|
|
public bool IsExpatriate
|
|
{
|
|
get
|
|
{
|
|
return _IsExpatriate;
|
|
}
|
|
set
|
|
{
|
|
_IsExpatriate = value;
|
|
chkExpat.Checked = value;
|
|
}
|
|
}
|
|
|
|
public ObjectsTemplate<Grade> Grades
|
|
{
|
|
set
|
|
{
|
|
_Grades = value;
|
|
ctlGrade.SetFixedItems<Grade>(_Grades);
|
|
}
|
|
get
|
|
{
|
|
return _Grades;
|
|
}
|
|
}
|
|
|
|
public string SearchCriteria
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Events
|
|
private void btnFind_Click(object sender, EventArgs e)
|
|
{
|
|
string empnos = string.Empty;
|
|
this.Cursor = Cursors.WaitCursor;
|
|
try
|
|
{
|
|
|
|
SearchManager manager = new SearchManager(EnumSearchFrom.Employee);
|
|
if (ctlCategory.IsItemSelected == true)
|
|
{
|
|
manager.Parameter.Add(ctlCategory.SearchParam);
|
|
}
|
|
//manager.Parameter.Add(ctlCategory.SearchParam);
|
|
//manager.Parameter.Add(ctlDepartment.SearchParam);
|
|
if (ctlGrade.IsItemSelected == false && _Grades != null)
|
|
{
|
|
|
|
Payroll.BO.SearchManager.SearchParameter oSearchParam = new Payroll.BO.SearchManager.SearchParameter();
|
|
oSearchParam.DataType = EnumSearchObjDataType.Number;
|
|
string sGradeID = "";
|
|
foreach (Grade ograde in _Grades)
|
|
sGradeID = sGradeID + ograde.ID.Integer + ", ";
|
|
sGradeID = sGradeID.Substring(0, sGradeID.Length - 2);
|
|
oSearchParam.ParameterValue = sGradeID;
|
|
oSearchParam.Paramter = EnumSearchParameter.GradeID;
|
|
oSearchParam.SqlOperator = EnumSQLOperator.In;
|
|
manager.Parameter.Add(oSearchParam);
|
|
|
|
}
|
|
else
|
|
manager.Parameter.Add(ctlGrade.SearchParam);
|
|
//if (ctlGrade.IsItemSelected == true )
|
|
//{
|
|
// manager.Parameter.Add(ctlGrade.SearchParam);
|
|
//}
|
|
|
|
if (ctlReligion.IsItemSelected == true)
|
|
{
|
|
manager.Parameter.Add(ctlReligion.SearchParam);
|
|
}
|
|
if (ctlDesignation.IsItemSelected == true)
|
|
{
|
|
manager.Parameter.Add(ctlDesignation.SearchParam);
|
|
}
|
|
//manager.Parameter.Add(ctlReligion.SearchParam);
|
|
manager.Parameter.Add(ctlLocation.SearchParam);
|
|
//manager.Parameter.Add(ctlDesignation.SearchParam);
|
|
manager.Parameter.Add(ctlCostCenter.SearchParam);
|
|
|
|
|
|
#region checked fox logic
|
|
if (chkLive.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.Status, (int)EnumEmployeeStatus.Live);
|
|
else if (chknotLive.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.Status, EnumSQLOperator.NotEqualTo, EnumSearchObjDataType.Number, (object)((int)EnumEmployeeStatus.Live));
|
|
|
|
if (txtName.Text != "")
|
|
manager.Parameter.Add(EnumSearchParameter.Name, EnumSQLOperator.Like, EnumSearchObjDataType.String, txtName.Text);
|
|
//if (chkEmpPosted.Checked == true)
|
|
// manager.Parameter.Add(EnumSearchParameter.Posted, (int)EnumEmployeeStatus.Live);
|
|
//else if (chknotEmpPosted.Checked == true)
|
|
// manager.Parameter.Add(EnumSearchParameter.Posted, EnumSQLOperator.NotEqualTo, EnumSearchObjDataType.Number, (object)((int)EnumEmployeeStatus.Live));
|
|
|
|
if (chkEmpConfirm.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.Confirm, true);
|
|
else if (chknotEmpConfirm.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.Confirm, false);
|
|
|
|
if (chkEmpPF.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.PFMember, (int)EnumPFMembershipType.Live);
|
|
else if (chknoEmpPF.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.PFMember, (int)EnumPFMembershipType.NotYetLive);
|
|
|
|
if (chkOTEligibility.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.OTEligible, true);
|
|
else if (chknotOTEligibility.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.OTEligible, false);
|
|
|
|
if (chkExpat.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.Expatriate, true);
|
|
else if (chknotexpaxt.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.Expatriate, false);
|
|
|
|
if (chkCardAssgn.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.AssingedAccCard, EnumSQLOperator.NotNull);
|
|
else if (chknotCardAssgn.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.AssingedAccCard, EnumSQLOperator.Null);
|
|
if (chkIA.Checked == true)
|
|
manager.Parameter.Add(EnumSearchParameter.Status, (int)EnumEmployeeStatus.Mobility);
|
|
if (txtFEmp.Text != "" && txtTEmp.Text != "")
|
|
{
|
|
manager.Parameter.Add(EnumSearchParameter.FromEmployeeNO, EnumSQLOperator.Between, EnumSearchObjDataType.Number, txtFEmp.Text);
|
|
manager.Parameter.Add(EnumSearchParameter.ToEmployeeNO, EnumSQLOperator.Between, EnumSearchObjDataType.Number, txtTEmp.Text);
|
|
}
|
|
else if (txtFEmp.Text != "" || txtTEmp.Text != "")
|
|
{
|
|
manager.Parameter.Add(EnumSearchParameter.EmployeeNo, txtFEmp.Text + txtTEmp.Text);
|
|
}
|
|
if (txtNationalID.Text != "")
|
|
{
|
|
manager.Parameter.Add(EnumSearchParameter.NationalID, txtNationalID.Text);
|
|
}
|
|
if (dtpChkBox.Checked == true)
|
|
{
|
|
manager.Parameter.Add(EnumSearchParameter.JoiningDate, dtpFromDate.Value);
|
|
manager.Parameter.Add(EnumSearchParameter.JoiningDate, dtpToDate.Value);
|
|
}
|
|
|
|
|
|
|
|
if (txtEmpNo.Text != "")
|
|
{
|
|
|
|
txtEmpNo.Text = txtEmpNo.Text.Trim(',');
|
|
manager.Parameter.Add(EnumSearchParameter.EmployeeNo, txtEmpNo.Text);
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
if (cboGender.SelectedIndex > 0)
|
|
manager.Parameter.Add(EnumSearchParameter.Gender, cboGender.SelectedIndex);
|
|
manager.Parameter.Add(ctlDepartment.SearchParam);
|
|
_Emps = manager.Find();
|
|
|
|
if (_searchForSalary == true)
|
|
{
|
|
ObjectsTemplate<SalaryMonthly> salaries = SalaryMonthly.Get(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|
if (salaries != null && salaries.Count > 0)
|
|
{
|
|
foreach (SalaryMonthly item in salaries)
|
|
{
|
|
SearchEmployee employee = _Emps.Find(delegate(SearchEmployee emp) { return emp.EmployeeID.Integer == item.EmployeeID.Integer; });
|
|
if (employee != null) _Emps.Remove(employee);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (_searchForUndoSalary)
|
|
{
|
|
ObjectsTemplate<SalaryMonthly> salaries = SalaryMonthly.Get(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|
|
|
_Emps = salaries.Join(_Emps,
|
|
sm => sm.EmployeeID.Integer,
|
|
se => se.EmployeeID.Integer,
|
|
(sm, se) => se).ToObjectsTemplate();
|
|
}
|
|
|
|
if (_searchForOPI == true)
|
|
{
|
|
ObjectsTemplate<OPIProcess> opis = OPIProcess.Get(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|
if (opis != null && opis.Count > 0)
|
|
{
|
|
foreach (OPIProcess item in opis)
|
|
{
|
|
|
|
foreach (OPIProcessDetail itemDetail in item.OPIProcessDetails)
|
|
{
|
|
SearchEmployee employee = _Emps.Where(x => x.EmployeeID.Integer == itemDetail.EmployeeID.Integer).SingleOrDefault();
|
|
if (employee != null)
|
|
_Emps.Remove(employee);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (_searchForCarFuel == true)
|
|
{
|
|
ObjectsTemplate<CarFuelProcess> opis = CarFuelProcess.Get(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|
if (opis != null && opis.Count > 0)
|
|
{
|
|
foreach (CarFuelProcess item in opis)
|
|
{
|
|
|
|
foreach (CarFuelProcessDetail itemDetail in item.CarFuelProcessDetails)
|
|
{
|
|
SearchEmployee employee = _Emps.Where(x => x.EmployeeID.Integer == itemDetail.EmployeeID.Integer).SingleOrDefault();
|
|
if (employee != null)
|
|
_Emps.Remove(employee);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
RefreshList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw;
|
|
}
|
|
finally
|
|
{
|
|
this.Cursor = Cursors.Default;
|
|
}
|
|
}
|
|
private void lsvEmployee_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
btnOK_Click(sender, e);
|
|
}
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
if (!MultipleSelection)
|
|
{
|
|
if (lsvEmployee.SelectedItems != null && lsvEmployee.SelectedItems.Count > 0)
|
|
{
|
|
_Emp = (SearchEmployee)lsvEmployee.SelectedItems[0].Tag;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CreateSearchCriteriaMultiple();
|
|
_SelectedEmps = new ObjectsTemplate<SearchEmployee>();
|
|
foreach (ListViewItem item in lsvEmployee.CheckedItems)
|
|
{
|
|
if (item.Checked)
|
|
{
|
|
_SelectedEmps.Add((SearchEmployee)item.Tag);
|
|
}
|
|
}
|
|
}
|
|
this.Close();
|
|
}
|
|
|
|
private void btnSelectAll_Click(object sender, EventArgs e)
|
|
{
|
|
bool bSelected = false;
|
|
if(btnSelectAll.Text.Equals("&Select All"))
|
|
{
|
|
bSelected = true;
|
|
btnSelectAll.Text = "&Unselect All";
|
|
}
|
|
else
|
|
{
|
|
btnSelectAll.Text = "&Select All";
|
|
}
|
|
|
|
foreach (ListViewItem item in lsvEmployee.Items)
|
|
{
|
|
item.Checked = bSelected;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Function
|
|
|
|
#region
|
|
|
|
public void PopulateThisCtl(HashSet< int > set)
|
|
{
|
|
_isFinished = true;
|
|
hsSet = set;
|
|
btnFind_Click(this, new EventArgs());
|
|
foreach (ListViewItem item in lsvEmployee.Items)
|
|
{
|
|
if (set.Contains(((SearchEmployee)item.Tag).EmployeeID.Integer))
|
|
{
|
|
item.Checked = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void RefrsCtl()
|
|
{
|
|
foreach (ListViewItem item in lsvEmployee.Items)
|
|
{
|
|
SearchEmployee srEmp = (SearchEmployee) item.Tag;
|
|
if(hsSet.Contains(srEmp.ID.Integer))
|
|
{
|
|
item.Checked = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
private void RefreshList()
|
|
{
|
|
int count = 0;
|
|
lsvEmployee.Items.Clear();
|
|
Stopwatch sw = Stopwatch.StartNew();
|
|
|
|
if (_Emps != null)
|
|
{
|
|
|
|
#region Old Method
|
|
|
|
//foreach (SearchEmployee emp in _Emps)
|
|
//{
|
|
// ListViewItem item = new ListViewItem();
|
|
// item.Text = emp.Name;
|
|
// item.Tag = emp;
|
|
// item.SubItems.Add(emp.EmployeeNo);
|
|
// if (emp.DepartmentID.IsUnassigned == false && emp.DepartmentID.Integer > 0)
|
|
// {
|
|
// Department dept = _allDepartments.GetItem(emp.DepartmentID);
|
|
// if (dept == null)
|
|
// {
|
|
// item.SubItems.Add("");
|
|
// }
|
|
// else
|
|
// {
|
|
// item.SubItems.Add(dept.Name);
|
|
// }
|
|
// //throw new ServiceException("Invalid department found that exist in the Department Basic for the employee:" + emp.EmployeeNo );
|
|
// }
|
|
// else item.SubItems.Add("");
|
|
// if (emp.GradeID.IsUnassigned == false && emp.GradeID.Integer > 0)
|
|
// {
|
|
// Grade grd = _allGrades.GetItem(emp.GradeID);
|
|
// if (grd == null)
|
|
// {
|
|
// item.SubItems.Add("");
|
|
// }
|
|
// else
|
|
// {
|
|
// item.SubItems.Add(grd.Name);
|
|
// }
|
|
// //throw new ServiceException("Invalid Grade found that exist in the Department Basic for the employee:" + emp.EmployeeNo);
|
|
|
|
// }
|
|
// else item.SubItems.Add("");
|
|
|
|
// lsvEmployee.Items.Add(item);
|
|
// count++;
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region New Method by Hassan
|
|
|
|
var ListItems = _Emps.GroupJoin(_allDepartments,
|
|
e => e.DepartmentID,
|
|
d => d.ID,
|
|
(e, g1) => g1.Select(d => new { SEmployee = e, DeptName = d.Name })
|
|
.DefaultIfEmpty(new { SEmployee = e, DeptName = string.Empty }))
|
|
.SelectMany(g1 => g1)
|
|
.GroupJoin(_allGrades,
|
|
g1 => g1.SEmployee.GradeID,
|
|
gd => gd.ID,
|
|
(g1, g2) => g2
|
|
.Select(gd => new { SEmployee = g1.SEmployee, listItem = new ListViewItem(new[] { g1.SEmployee.Name, g1.SEmployee.EmployeeNo, g1.DeptName, gd.Name }) })
|
|
.DefaultIfEmpty(new { SEmployee = g1.SEmployee, listItem = new ListViewItem(new[] { g1.SEmployee.Name, g1.SEmployee.EmployeeNo, g1.DeptName, string.Empty }) }))
|
|
.SelectMany(g2 => g2);
|
|
//.OrderBy(x => Convert.ToInt64(x.SEmployee.EmployeeNo)); // Only for GP as GP's Eployee No is Number Only
|
|
|
|
|
|
|
|
ListViewItem[] lc = new ListViewItem[ListItems.Count()];
|
|
|
|
foreach (var item in ListItems)
|
|
{
|
|
item.listItem.Tag = item.SEmployee;
|
|
lc[count] =item.listItem;
|
|
count++;
|
|
}
|
|
|
|
lsvEmployee.Items.AddRange(lc);
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
sw.Stop();
|
|
|
|
lblTotSearched.Text = Convert.ToString(count) + string.Format(" Time taken: {0} seconds", (sw.Elapsed.TotalMilliseconds/1000).ToString("0.00"));
|
|
}
|
|
|
|
private void CreateSearchCriteriaMultiple()
|
|
{
|
|
SearchCriteria = string.Empty;
|
|
|
|
if (lsvEmployee.CheckedItems.Count == 0)
|
|
return;
|
|
|
|
if (ctlCategory.GetLabelText().Trim() != string.Empty)
|
|
{
|
|
SearchCriteria += " Category:" + ctlCategory.GetLabelText().Trim();
|
|
}
|
|
if (ctlLocation.GetLabelText().Trim() != string.Empty)
|
|
{
|
|
SearchCriteria += " Location:" + ctlLocation.GetLabelText().Trim();
|
|
}
|
|
if (ctlDepartment.GetLabelText().Trim() != string.Empty)
|
|
{
|
|
SearchCriteria += " Department:" + ctlDepartment.GetLabelText().Trim();
|
|
}
|
|
if (cboGender.SelectedIndex > 0)
|
|
{
|
|
SearchCriteria += " Gender:" + cboGender.Text.Trim();
|
|
}
|
|
if (ctlReligion.GetLabelText().Trim() != string.Empty)
|
|
{
|
|
SearchCriteria += " Religion:" + ctlReligion.GetLabelText().Trim();
|
|
}
|
|
if (ctlGrade.GetLabelText().Trim() != string.Empty)
|
|
{
|
|
SearchCriteria += " Grade:" + ctlGrade.GetLabelText().Trim();
|
|
}
|
|
if (ctlDesignation.GetLabelText().Trim() != string.Empty)
|
|
{
|
|
SearchCriteria += "Designation:" + ctlDesignation.GetLabelText().Trim();
|
|
}
|
|
|
|
if (ctlCostCenter.GetLabelText().Trim() != string.Empty)
|
|
{
|
|
SearchCriteria += " CostCenter:" + ctlCostCenter.GetLabelText().Trim();
|
|
}
|
|
|
|
if (lsvEmployee.Items.Count != lsvEmployee.CheckedItems.Count)
|
|
{
|
|
SearchCriteria += " EmployeeNo(s):";
|
|
string str = string.Empty;
|
|
foreach (ListViewItem item in lsvEmployee.CheckedItems)
|
|
{
|
|
str += (item.Tag as SearchEmployee).EmployeeNo + ",";
|
|
}
|
|
SearchCriteria += str.Trim(',');
|
|
//SearchCriteria += "Employees: " + ctlCostCenter.GetLabelText().Trim();
|
|
}
|
|
//if (txtNationalID.Text != string.Empty)
|
|
//{
|
|
// SearchCriteria += "NationalID:" + txtNationalID.Text;
|
|
//}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region CheckBoxSelect
|
|
|
|
private void chkLive_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkLive.Checked == true)
|
|
{
|
|
chknotLive.Checked = false;
|
|
chkIA.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chknotLive_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chknotLive.Checked == true)
|
|
{
|
|
chkLive.Checked = false;
|
|
chkIA.Checked = false;
|
|
}
|
|
}
|
|
|
|
|
|
private void chkEmpConfirm_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkEmpConfirm.Checked == true)
|
|
{
|
|
chknotEmpConfirm.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chknotEmpConfirm_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chknotEmpConfirm.Checked == true)
|
|
{
|
|
chkEmpConfirm.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chkEmpPF_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkEmpPF.Checked == true)
|
|
{
|
|
chknoEmpPF.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chknoEmpPF_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chknoEmpPF.Checked == true)
|
|
{
|
|
chkEmpPF.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chkOTEligibility_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkOTEligibility.Checked == true)
|
|
{
|
|
chknotOTEligibility.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chknotOTEligibility_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chknotOTEligibility.Checked == true)
|
|
{
|
|
chkOTEligibility.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chkExpat_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkExpat.Checked == true)
|
|
{
|
|
chknotexpaxt.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chknotexpaxt_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chknotexpaxt.Checked == true)
|
|
{
|
|
chkExpat.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chkCardAssgn_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkCardAssgn.Checked == true)
|
|
{
|
|
chknotCardAssgn.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chknotCardAssgn_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chknotCardAssgn.Checked == true)
|
|
{
|
|
chkCardAssgn.Checked = false;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void txtSearch_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
//string sEmpNo = txtSearch.Text;
|
|
//foreach (ListViewItem oItem in lsvEmployee.Items)
|
|
//{
|
|
// SearchEmployee ob = (SearchEmployee)oItem.Tag;
|
|
|
|
// if (ob.EmployeeNo == sEmpNo)
|
|
// {
|
|
// oItem.BackColor = Color.Silver;
|
|
// }
|
|
//}
|
|
}
|
|
|
|
private void txtSearch_Leave(object sender, EventArgs e)
|
|
{
|
|
string sEmpNo = txtSearch.Text;
|
|
foreach (ListViewItem oItem in lsvEmployee.Items)
|
|
{
|
|
SearchEmployee ob = (SearchEmployee)oItem.Tag;
|
|
oItem.BackColor = Color.White;
|
|
if (ob.EmployeeNo == sEmpNo)
|
|
{
|
|
oItem.BackColor = Color.Silver;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void lsvEmployee_ColumnClick(object sender, ColumnClickEventArgs e)
|
|
{
|
|
this.Cursor = Cursors.WaitCursor;
|
|
|
|
// Get the new sorting column.
|
|
ColumnHeader new_sorting_column = lsvEmployee.Columns[e.Column];
|
|
|
|
// Figure out the new sorting order.
|
|
System.Windows.Forms.SortOrder sort_order;
|
|
if (SortingColumn == null)
|
|
{
|
|
// New column. Sort ascending.
|
|
sort_order = SortOrder.Ascending;
|
|
}
|
|
else
|
|
{
|
|
// See if this is the same column.
|
|
if (new_sorting_column == SortingColumn)
|
|
{
|
|
// Same column. Switch the sort order.
|
|
if (SortingColumn.Text.StartsWith("> "))
|
|
{
|
|
sort_order = SortOrder.Descending;
|
|
}
|
|
else
|
|
{
|
|
sort_order = SortOrder.Ascending;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// New column. Sort ascending.
|
|
sort_order = SortOrder.Ascending;
|
|
}
|
|
|
|
// Remove the old sort indicator.
|
|
SortingColumn.Text = SortingColumn.Text.Substring(2);
|
|
}
|
|
|
|
// Display the new sort order.
|
|
SortingColumn = new_sorting_column;
|
|
if (sort_order == SortOrder.Ascending)
|
|
{
|
|
SortingColumn.Text = "> " + SortingColumn.Text;
|
|
}
|
|
else
|
|
{
|
|
SortingColumn.Text = "< " + SortingColumn.Text;
|
|
}
|
|
|
|
// Create a comparer.
|
|
lsvEmployee.ListViewItemSorter =
|
|
new ListViewComparer(e.Column, sort_order);
|
|
|
|
// Sort.
|
|
lsvEmployee.Sort();
|
|
|
|
this.Cursor = Cursors.Default;
|
|
}
|
|
|
|
private void dtpChkBox_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (dtpChkBox.Checked)
|
|
{
|
|
dtpFromDate.Enabled = true;
|
|
dtpToDate.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
dtpFromDate.Enabled = false;
|
|
dtpToDate.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void chkIA_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkIA.Checked)
|
|
{
|
|
chkLive.Checked = false;
|
|
chknotLive.Checked = false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|