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.Model; using Ease.CoreV35; using Microsoft.Reporting.WinForms; using Ease.CoreV35.DataAccess; namespace Payroll.Report { public partial class rptEmpLifeCycle : Form { private ReportItem _reportitem = null; ObjectsTemplate _employeeStatuss = new ObjectsTemplate(); private EnumReportType _reportType = EnumReportType.None; private EnumReportType _Type = EnumReportType.None; HREmployee _oEmployee = null; public rptEmpLifeCycle() { InitializeComponent(); } private void btnClose_Click(object sender, EventArgs e) { this.Close(); } public void ShowDlg() { this.ShowDialog(); } public EnumReportType Type { set { _Type = value; } } private void btnPreview_Click(object sender, EventArgs e) { DataTable oBody = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpLifeCycleDataTable(); List dataSource; ObjectsTemplate oHistories = new ObjectsTemplate(); oHistories = EmpLifeCycle.GetByEmpID(_oEmployee.ID); foreach (EmpLifeCycle oItem in oHistories) { try { EmployeeStatus oStatus = _employeeStatuss.Find(delegate(EmployeeStatus oSts) { return oSts.ID == oItem.StatusDetailID; }); oBody.Rows.Add(_oEmployee.EmployeeNo, _oEmployee.Name, oItem.Description, oItem.EffectDate.ToString("dd MMM yyyy"), oStatus.Description, _oEmployee.Designation == null ? "" : _oEmployee.DescriptionText, _oEmployee.Department==null?"":_oEmployee.Department.Name, _oEmployee.Grade==null?"": _oEmployee.Grade.Name, _oEmployee.Location==null?"": _oEmployee.Location.Name, _oEmployee.JoiningDate.ToString("dd MMM yyyy"), _oEmployee.BasicSalary,_oEmployee.Function==null?"": _oEmployee.Function.Name,_oEmployee.Category==null?"": _oEmployee.Category.Name); } catch (Exception exp) { } } string embeddedResource = "Payroll.Report.RDLC.EmpLifeCycle.rdlc"; string caption = "Employee History"; dataSource = new List(); dataSource.Add(new ReportDataSource("PayrollDataSet_EmpLifeCycle", oBody)); Cursor.Current = Cursors.WaitCursor; fReportViewer fViewer = new fReportViewer(); fViewer.PreviewReport(_reportitem, dataSource, embeddedResource, caption); } private void rptEmpLifeCycle_Load(object sender, EventArgs e) { _employeeStatuss = EmployeeStatus.Get(); this._reportType = _Type; _reportitem = ReportItem.Get(ID.FromInteger(Convert.ToInt32(_reportType))); } private void ctlEmployee_ItemChanged() { try { if (ctlEmployee.SelectedEmployee != null) { _oEmployee = new HREmployee(); _oEmployee = ctlEmployee.SelectedEmployee.HREmployee; } } catch { } } } }