143 lines
4.5 KiB
C#
143 lines
4.5 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 Payroll.BO;
|
|
using Ease.CoreV35;
|
|
using Ease.CoreV35.Model;
|
|
using System.Configuration;
|
|
|
|
namespace Payroll.Controls
|
|
{
|
|
public partial class fCreatedRequisition : Form
|
|
{
|
|
ObjectsTemplate<CreatedRequisition> _oSelectedRequisitions = null;
|
|
CreatedRequisition _oSelectedRequisition = null;
|
|
public fCreatedRequisition()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public void Showdlg(bool sts)
|
|
{
|
|
this._isMultiple = sts;
|
|
this.ShowDialog();
|
|
}
|
|
#region Is Multiple
|
|
private bool _isMultiple;
|
|
public bool IsMultiple
|
|
{
|
|
get
|
|
{
|
|
return _isMultiple;
|
|
}
|
|
set
|
|
{
|
|
_isMultiple = value;
|
|
}
|
|
}
|
|
#endregion
|
|
public ObjectsTemplate<CreatedRequisition> SelectedRequisitions
|
|
{
|
|
get
|
|
{
|
|
return _oSelectedRequisitions;
|
|
}
|
|
}
|
|
public CreatedRequisition SelectedRequisition
|
|
{
|
|
get
|
|
{
|
|
return _oSelectedRequisition;
|
|
}
|
|
}
|
|
private void fCreatedRequisition_Load(object sender, EventArgs e)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
dt = EmployeeRequisition.GetEmployeeRequisitionsByDepartmentID(ID.FromInteger(1), EnumEmpReqStatus.Approved);
|
|
List<CreatedRequisition> oExistingRequisitions = CreatedRequisition.Get();
|
|
listView1.Items.Clear();
|
|
ListViewItem li = null;
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
CreatedRequisition req = oExistingRequisitions.Find(delegate(CreatedRequisition cr) { return cr.EmpRequisitionID.Integer == Convert.ToInt16(dr[0].ToString()); });
|
|
if (req == null)
|
|
{
|
|
li = new ListViewItem();
|
|
li.Text = dr[1].ToString();
|
|
li.SubItems.Add(dr[2].ToString());
|
|
li.SubItems.Add(dr[3].ToString());
|
|
li.SubItems.Add(Convert.ToDateTime(dr[4]).ToString("dd MMM yyyy"));
|
|
li.SubItems.Add(dr[0].ToString());
|
|
listView1.Items.Add(li);
|
|
}
|
|
}
|
|
|
|
if (this.IsMultiple)
|
|
{
|
|
listView1.CheckBoxes = true;
|
|
}
|
|
else
|
|
listView1.CheckBoxes = false;
|
|
}
|
|
|
|
private void btnOk_Click(object sender, EventArgs e)
|
|
{
|
|
if (!IsMultiple)
|
|
{
|
|
if (listView1.SelectedItems.Count>0)
|
|
{
|
|
ListViewItem li = listView1.SelectedItems[0];
|
|
CreatedRequisition item = new CreatedRequisition();
|
|
item.EmpRequisitionID = ID.FromInteger(Convert.ToInt16(li.SubItems[4].Text));
|
|
item.Name = li.SubItems[1].Text;
|
|
_oSelectedRequisitions.Add(item);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_oSelectedRequisitions = new ObjectsTemplate<CreatedRequisition>();
|
|
foreach (ListViewItem li in listView1.Items)
|
|
{
|
|
if (li.Checked)
|
|
{
|
|
CreatedRequisition item = new CreatedRequisition();
|
|
item.EmpRequisitionID = ID.FromInteger(Convert.ToInt16(li.SubItems[4].Text));
|
|
item.Name = li.SubItems[1].Text;
|
|
_oSelectedRequisitions.Add(item);
|
|
}
|
|
}
|
|
}
|
|
this.Close();
|
|
}
|
|
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void chkAll_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkAll.Checked)
|
|
{
|
|
chkAll.Text = "Deselect All";
|
|
foreach (ListViewItem li in listView1.Items)
|
|
{
|
|
li.Checked = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
chkAll.Text = "Select All";
|
|
foreach (ListViewItem li in listView1.Items)
|
|
{
|
|
li.Checked = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|