using System; using Ease.CoreV35.Caching; using Ease.CoreV35.Model; using System.Data; using System.Linq; using System.Text; namespace Payroll.BO { #region Class Training [Serializable] public class Training : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(Training)); #endregion #region Constructor public Training() { _code = string.Empty; _name = string.Empty; _trainingTypeID = null; _trainingType = null; _trainingDuration = 0; _standardCost = 0; _learningObjective = string.Empty; } #endregion #region Properties #region Property Code : string private string _code; public string Code { get { return _code; } set { _code = value; base.SetObjectStateModified(); } } #endregion #region Property Name : string private string _name; public string Name { get { return _name; } set { _name = value; base.SetObjectStateModified(); } } #endregion #region Property TrainingTypeID : ID private ID _trainingTypeID; public ID TrainingTypeID { get { return _trainingTypeID; } set { _trainingTypeID = value; base.SetObjectStateModified(); _trainingType = null; } } #endregion #region Property TrainingType : TrainingType private TrainingType _trainingType; public TrainingType TrainingType { get { if (_trainingType == null) { _trainingType = new TrainingType(); _trainingType = TrainingType.Get(_trainingTypeID); } return _trainingType; } } #endregion #region Property TrainingDuration : double private double _trainingDuration; public double TrainingDuration { get { return _trainingDuration; } set { _trainingDuration = value; base.SetObjectStateModified(); } } #endregion #region Property TrainingSTDCost : double private double _standardCost; public double StandardCost { get { return _standardCost; } set { _standardCost = value; base.SetObjectStateModified(); } } #endregion #region Property LearningObjective : string private string _learningObjective; public string LearningObjective { get { return _learningObjective; } set { _learningObjective = value; } } #endregion #endregion #region Functions public static Training Get(int nTrainingID) { Training oTraining = null; #region Cache Header oTraining = (Training)_cache["Get", nTrainingID]; if (oTraining != null) return oTraining; #endregion oTraining = Training.Service.Get(ID.FromInteger(nTrainingID)); #region Cache Footer _cache.Add(oTraining, "Get", nTrainingID); #endregion return oTraining; } public ID Save() { this.SetAuditTrailProperties(); return Training.Service.Save(this); } public void Delete() { Training.Service.Delete(ID); } #endregion #region Collection Functions public static ObjectsTemplate Get() { ObjectsTemplate oTrainings = null; #region Cache Header oTrainings = (ObjectsTemplate)_cache["Get"]; if (oTrainings != null) return oTrainings; #endregion oTrainings = Training.Service.Get(); #region Cache Footer _cache.Add(oTrainings, "Get"); #endregion return oTrainings; } public static ObjectsTemplate Get(string query) { ObjectsTemplate oTrainings = null; #region Cache Header oTrainings = (ObjectsTemplate)_cache["Get"]; if (oTrainings != null) return oTrainings; #endregion oTrainings = Training.Service.Get(query); #region Cache Footer _cache.Add(oTrainings, "Get"); #endregion return oTrainings; } public static ObjectsTemplate GetByTrainingType(int typeID) { ObjectsTemplate oTrainings = null; #region Cache Header oTrainings = (ObjectsTemplate)_cache["Get"]; if (oTrainings != null) return oTrainings; #endregion string query = string.Format("Select * from Training Where TrainingTypeID = {0} ORDER BY Name", typeID); oTrainings = Training.Service.Get(query); #region Cache Footer _cache.Add(oTrainings, "Get"); #endregion return oTrainings; } public static DataSet GetEmployeeWiseTrainingSummary(ObjectsTemplate Employees, DateTime fromDate, DateTime toDate, int tNature, int tTrainingType, int trainingID, int deptID, int instituteID) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetEmployeeWiseTrainingSummary(sEmpIDs, fromDate, toDate, tNature, tTrainingType, trainingID, deptID, instituteID,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet GetTrainingWiseReport(ObjectsTemplate Employees, ID trainingID, DateTime fromDate, DateTime toDate, int nTypeID, int nNatureID, int ndeptID, int instituteID) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetTrainingWiseReport(sEmpIDs,trainingID, fromDate, toDate, nTypeID, nNatureID, ndeptID, instituteID,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet GetDeptWiseTrainingReport(int dptID, DateTime fromDate, DateTime toDate, int tNatureID, int tTrainingTypeID, int instituteID, int trainingID) { DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetDeptWiseTrainingReport(dptID, fromDate, toDate, tNatureID, tTrainingTypeID, instituteID, trainingID,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet GetEmployeeWiseTrainingReport(ObjectsTemplate Employees, int nNatureID, int tTrainingTypeID, int ndeptID, int instituteID,int year) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetEmployeeWiseTrainingReport(sEmpIDs, nNatureID, tTrainingTypeID, ndeptID, instituteID, year,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet GetEmployeeWiseTrainingReport(ObjectsTemplate Employees) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetEmployeeWiseTrainingReport(sEmpIDs); return oDataSet; } #endregion #region Service Factory internal static ITrainingService Service { get { return Services.Factory.CreateService(typeof(ITrainingService)); } } #endregion public static DataSet GetTrainingAttendenceReport(ObjectsTemplate Employees, ID trainingID, DateTime dStartDate, DateTime dEndDate, int tTrainingTypeID, int nNatureID, int instituteID, int nScheduleID) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetTrainingAttendenceReport(sEmpIDs, trainingID, dStartDate, dEndDate, tTrainingTypeID, nNatureID, instituteID, nScheduleID,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet GetEmployeeWiseTrainingDetails(ObjectsTemplate Employees, DateTime dStartDate, DateTime dEndDate, int nTypeID, int nNatureID, int instituteID) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetEmployeeWiseTrainingDetails(sEmpIDs, dStartDate, dEndDate, nTypeID, nNatureID, instituteID,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet GetTrainingNameWiseDetails(ObjectsTemplate Employees, DateTime dStartDate, DateTime dEndDate, int nTyprID, int nNatureID, int instituteID, int trainingID) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetTrainingNameWiseDetails(sEmpIDs,dStartDate,dEndDate, nTyprID, nNatureID, instituteID, trainingID,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet GetDepartmentWiseTrainingExpense(ObjectsTemplate Employees, int nNatureID, int nTrainingTypeID, int instituteID, int year) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetDepartmentWiseTrainingExpense(sEmpIDs, nNatureID, nTrainingTypeID, instituteID, year,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet GetTrainingConductedByDeptReport(int dptID, DateTime fromDate, DateTime toDate, int tNature, int tTrainingType, int nTrainingID, int instituteID) { DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetTrainingConductedByDeptReport(dptID, fromDate, toDate, tNature, tTrainingType, nTrainingID, instituteID,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet GetEntityWiseTrainingSummery(ObjectsTemplate Employees, DateTime fromDate, DateTime toDate, int tNature, int tTrainingType, int instituteID) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetEntityWiseTrainingSummery(sEmpIDs, fromDate, toDate, tNature, tTrainingType, instituteID); return oDataSet; } public static DataSet GetTrainingCostDetailsReport(ObjectsTemplate Employees) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetTrainingCostDetailsReport(sEmpIDs); return oDataSet; } public static DataSet GetTrainingCostingInfoReport(ObjectsTemplate Employees, DateTime dFromDate, DateTime dToDate, int tNature, int instituteID, int tTrainingType) { string sEmpIDs = string.Empty; if (Employees != null) { sEmpIDs = Employees.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e.EmployeeID.Integer.ToString() + ","), sb => sb.ToString().Trim(',')); } DataSet oDataSet = new DataSet(); oDataSet = Training.Service.GetTrainingCostingInfoReport(sEmpIDs, dFromDate, dToDate, tNature, instituteID, tTrainingType,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); return oDataSet; } public static DataSet ShowSoftPlanReport(string year) { string tYear = year.ToString(); DataSet oDataSet = new DataSet(); oDataSet = Training.Service.ShowSoftPlanReport(tYear); return oDataSet; } } #endregion #region ITrainingService Service public interface ITrainingService { Training Get(ID id); ObjectsTemplate Get(); ObjectsTemplate Get(string query); ID Save(Training oTraining); void Delete(ID id); DataSet GetEmployeeWiseTrainingSummary(string sEmpIDs, DateTime fromDate, DateTime toDate, int tNature, int tTrainingType, int trainingID, int deptID, int instituteID, int payrollTypeID); DataSet GetTrainingWiseReport(string sEmpIDs, ID trainingID, DateTime fromDate, DateTime toDate, int nTypeID, int nNatureID, int ndeptID, int instituteID, int payrollTypeID); DataSet GetDeptWiseTrainingReport(int dptID, DateTime fromDate, DateTime toDate, int tNatureID, int tTrainingTypeID, int instituteID, int trainingID, int payrollTypeID); DataSet GetEmployeeWiseTrainingReport(string sEmpIDs, int nNatureID, int tTrainingTypeID, int ndeptID, int instituteID, int year, int payrollTypeID); DataSet GetTrainingAttendenceReport(string sEmpIDs, ID trainingID, DateTime dStartDate, DateTime dEndDate, int tTrainingTypeID, int nNatureID, int instituteID, int nScheduleID, int payrollTypeID); DataSet GetEmployeeWiseTrainingDetails(string sEmpIDs, DateTime dStartDate, DateTime dEndDate, int nTypeID, int nNatureID, int instituteID, int payrollTypeID); DataSet GetTrainingNameWiseDetails(string sEmpIDs, DateTime dStartDate, DateTime dEndDate, int nTyprID, int nNatureID, int instituteID, int trainingID, int payrollTypeID); DataSet GetDepartmentWiseTrainingExpense(string sEmpIDs, int nNatureID, int nTrainingTypeID, int instituteID, int year, int payrollTypeID); DataSet GetTrainingConductedByDeptReport(int dptID, DateTime fromDate, DateTime toDate, int tNature, int tTrainingType, int nTrainingID, int instituteID, int payrollTypeID); DataSet GetEntityWiseTrainingSummery(string sEmpIDs, DateTime fromDate, DateTime toDate, int tNature, int tTrainingType, int instituteID); DataSet GetTrainingCostDetailsReport(string sEmpIDs); DataSet GetTrainingCostingInfoReport(string sEmpIDs, DateTime dFromDate, DateTime dToDate, int tNature, int instituteID, int tTrainingType, int payrollTypeID); DataSet ShowSoftPlanReport(string tYear); DataSet GetEmployeeWiseTrainingReport(string sEmpIDs); } #endregion }