CEL_Payroll/Payroll.Controls/frmGradePicker.cs

94 lines
2.7 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Payroll.BO;
using Ease.CoreV35.Model;
namespace Payroll.Controls
{
public partial class frmGradePicker : Form
{
ObjectsTemplate<Grade> _Grades = new ObjectsTemplate<Grade>();
ObjectsTemplate<PayScale> _PayScales = new ObjectsTemplate<PayScale>();
Grade _oGrade = new Grade();
PayScale _oPayScale = new PayScale();
public PayScaleDetail _selPayScaleDetail = null;
public frmGradePicker()
{
InitializeComponent();
}
public PayScaleDetail SelectedItem
{
get { return _selPayScaleDetail; }
set
{
_selPayScaleDetail = value;
}
}
private void frmGradePicker_Load(object sender, EventArgs e)
{
_Grades = Grade.Get(EnumStatus.Active);
FillGrades();
}
private void FillGrades()
{
lsvGrade.Items.Clear();
ListViewItem li = null;
foreach (Grade oItem in _Grades)
{
li = new ListViewItem();
li.Text = oItem.Code;
li.SubItems.Add(oItem.Name);
li.Tag = oItem;
lsvGrade.Items.Add(li);
}
}
private void FillSlabs()
{
lsvSlabs.Items.Clear();
ListViewItem li = null;
if (_oPayScale != null)
{
foreach (PayScaleDetail oItem in _oPayScale.PayscaleDetails)
{
li = new ListViewItem();
li.Text = oItem.StepNo.ToString();
li.SubItems.Add(oItem.Amount.ToString());
li.Tag = oItem;
lsvSlabs.Items.Add(li);
}
}
}
private void lsvGrade_Click(object sender, EventArgs e)
{
if (lsvGrade.SelectedItems.Count > 0)
{
Grade grd = (Grade)lsvGrade.SelectedItems[0].Tag;
_oPayScale = PayScale.GetByGrade(grd.ID);
FillSlabs();
}
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOk_Click(object sender, EventArgs e)
{
if (lsvSlabs.SelectedItems.Count > 0)
{
this.SelectedItem = (PayScaleDetail)lsvSlabs.SelectedItems[0].Tag;
this.Close();
}
}
}
}