CEL_Payroll/Payroll.Controls/CustomControls/fSerchTraining.cs
2024-09-17 14:30:13 +06:00

66 lines
2.0 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 Ease.CoreV35.Model;
using Payroll.BO;
namespace Payroll.Controls
{
public partial class fSerchTraining : Form
{
ObjectsTemplate<TrainingSchedule> _trainingSchedules = null;
TrainingSchedule _trainingSchedule = null;
public fSerchTraining()
{
InitializeComponent();
RefreshTraininglsv();
}
#region Properties
public TrainingSchedule SelectedTraining
{
get { return _trainingSchedule; }
set { _trainingSchedule = value; }
}
#endregion
private void RefreshTraininglsv()
{
_trainingSchedules = TrainingSchedule.Get(true);
lsvTraining.Items.Clear();
foreach (TrainingSchedule item in _trainingSchedules)
{
ListViewItem oItem = new ListViewItem(Training.Get(item.TrainingID.Integer).Name);
oItem.SubItems.Add(item.StartDate.ToString("dd MMM yyyy"));
oItem.SubItems.Add(item.EndDate.ToString("dd MMM yyyy"));
oItem.Tag = item;
lsvTraining.Items.Add(oItem);
}
}
private void btnOk_Click(object sender, EventArgs e)
{
if (lsvTraining.SelectedItems != null && lsvTraining.SelectedItems.Count > 0)
{
_trainingSchedule = (TrainingSchedule)lsvTraining.SelectedItems[0].Tag;
this.Close();
}
else
{
MessageBox.Show("Select at least one Item", "Training Search", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}