EchoTex_Payroll/HRM.BO/TrainingBOs/TrainingNeedAnalysis.cs
2024-10-14 10:01:49 +06:00

313 lines
10 KiB
C#

using Ease.Core.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.IO;
using System.Reflection;
namespace HRM.BO
{
#region Class TrainingNeedAnalysis
[Serializable]
public class TrainingNeedAnalysis : AuditTrailBase
{
#region Constructor
public TrainingNeedAnalysis()
{
TrainingYear = 0;
Name = string.Empty;
DepartmentID = 0;
EmployeeID = 0;
TrainingID = 0;
Description = string.Empty;
MaxParticipent = 0;
// _schedule = string.Empty;
Conduct_Required = 0;
}
#endregion
#region Properties
public int TrainingYear { get; set; }
public int EmployeeID { get; set; }
public Employee Employee { get; set; }
public int TrainingID { get; set; }
public Training Training { get; set; }
public int DepartmentID { get; set; }
public string Description { get; set; }
public string Name { get; set; }
public int MaxParticipent { get; set; }
public double Conduct_Required { get; set; }
//#region Property Schedule : string
//private string _schedule;
//public string Schedule
//{
// get
// {
// return _schedule;
// }
// set
// {
// _schedule = value;
// }
//}
//#endregion
public List<TrainingDepartment> TrainingDepartments { get; set; }
public List<SubordinateTrainee> TrainingEmployee { get; set; }
public List<TrainingNdAnalysisTimeSch> TrainingNdAnalysisTimeSchs { get; set; }
#endregion
//#region Functions
//public static TrainingNeedAnalysis Get(int nTrainingNeedAnalysisID)
//{
// TrainingNeedAnalysis oTrainingNeedAnalysis = null;
// #region Cache Header
// oTrainingNeedAnalysis = (TrainingNeedAnalysis)_cache["Get", nTrainingNeedAnalysisID];
// if (oTrainingNeedAnalysis != null)
// return oTrainingNeedAnalysis;
// #endregion
// oTrainingNeedAnalysis = TrainingNeedAnalysis.Service.Get(ID.FromInteger(nTrainingNeedAnalysisID));
// #region Cache Footer
// _cache.Add(oTrainingNeedAnalysis, "Get", nTrainingNeedAnalysisID);
// #endregion
// return oTrainingNeedAnalysis;
//}
//public ID Save()
//{
// this.SetAuditTrailProperties();
// return TrainingNeedAnalysis.Service.Save(this);
//}
//public static void Delete(ID id)
//{
// TrainingNeedAnalysis.Service.Delete(id);
//}
//public static string GetStatus(TrainingNeedAnalysis oTNA)
//{
// string status = string.Empty;
// if (oTNA.TrainingID > 0)
// {
// ObjectsTemplate<TrainingSchedule> oTrainingSch = TrainingSchedule.Get(oTNA.TrainingID, oTNA.ID.Integer, true);
// if (oTrainingSch.Count > 0)
// {
// //int left = oTNA.TrainingNdAnalysisTimeSchs.Count - oTrainingSch.Count;
// status = "Scheduled (" + oTrainingSch.Count + ")";
// }
// else
// {
// status = "Not Schedule";
// }
// }
// else
// {
// status = "Training Not Available";
// }
// return status;
//}
//#endregion
//#region Collection Functions
//public static ObjectsTemplate<TrainingNeedAnalysis> Get()
//{
// ObjectsTemplate<TrainingNeedAnalysis> oTrainingNeedAnalysiss = null;
// #region Cache Header
// oTrainingNeedAnalysiss = (ObjectsTemplate<TrainingNeedAnalysis>)_cache["Get"];
// if (oTrainingNeedAnalysiss != null)
// return oTrainingNeedAnalysiss;
// #endregion
// oTrainingNeedAnalysiss = TrainingNeedAnalysis.Service.Get();
// #region Cache Footer
// _cache.Add(oTrainingNeedAnalysiss, "Get");
// #endregion
// return oTrainingNeedAnalysiss;
//}
//public string GetTimeschedule(int year)
//{
// string str = "";
// int nCount = 0;
// foreach (TrainingNdAnalysisTimeSch item in this.TrainingNdAnalysisTimeSchs)
// {
// nCount = nCount + 1;
// str = str + item.Month.ToString() + " " + year.ToString();
// if (nCount != this.TrainingNdAnalysisTimeSchs.Count)
// str = str + ", ";
// }
// return str;
//}
//public string GetDepartmetns()
//{
// string str = "";
// int nCount = 0;
// foreach (TrainingDepartment item in this.TrainingDepartments)
// {
// nCount = nCount + 1;
// Department od = Department.Get(item.DepartmentID);
// str = str + od.Name.ToString();
// if (nCount != this.TrainingNdAnalysisTimeSchs.Count)
// str = str + ", ";
// }
// return str;
//}
//public static ObjectsTemplate<TrainingNeedAnalysis> GetByYear(int year)
//{
// ObjectsTemplate<TrainingNeedAnalysis> oTrainingNeedAnalysiss = null;
// #region Cache Header
// oTrainingNeedAnalysiss = (ObjectsTemplate<TrainingNeedAnalysis>)_cache["Get"];
// if (oTrainingNeedAnalysiss != null)
// return oTrainingNeedAnalysiss;
// #endregion
// oTrainingNeedAnalysiss = TrainingNeedAnalysis.Service.GetByYear(year);
// #region Cache Footer
// _cache.Add(oTrainingNeedAnalysiss, "Get");
// #endregion
// return oTrainingNeedAnalysiss;
//}
//public static ObjectsTemplate<TrainingNeedAnalysis> GetByParam(int year, string sEmpIDs, string sDeptForIDs)
//{
// ObjectsTemplate<TrainingNeedAnalysis> oTrainingNeedAnalysiss = null;
// #region Cache Header
// oTrainingNeedAnalysiss = (ObjectsTemplate<TrainingNeedAnalysis>)_cache["Get"];
// if (oTrainingNeedAnalysiss != null)
// return oTrainingNeedAnalysiss;
// #endregion
// oTrainingNeedAnalysiss = TrainingNeedAnalysis.Service.GetByParam(year, sEmpIDs, sDeptForIDs);
// #region Cache Footer
// _cache.Add(oTrainingNeedAnalysiss, "Get");
// #endregion
// return oTrainingNeedAnalysiss;
//}
//#endregion
//#region Service Factory
//internal static ITrainingNeedAnalysisService Service
//{
// get
// {
// return Services.Factory.CreateService<ITrainingNeedAnalysisService>(typeof(ITrainingNeedAnalysisService));
// }
//}
//#endregion
//public static ObjectsTemplate<TrainingNeedAnalysis> Get(string query)
//{
// ObjectsTemplate<TrainingNeedAnalysis> oTrainingNeedAnalysiss = null;
// #region Cache Header
// oTrainingNeedAnalysiss = (ObjectsTemplate<TrainingNeedAnalysis>)_cache["Get"];
// if (oTrainingNeedAnalysiss != null)
// return oTrainingNeedAnalysiss;
// #endregion
// oTrainingNeedAnalysiss = TrainingNeedAnalysis.Service.Get(query);
// #region Cache Footer
// _cache.Add(oTrainingNeedAnalysiss, "Get");
// #endregion
// return oTrainingNeedAnalysiss;
//}
//public static TrainingNeedAnalysis GetByEmployeeID(string employeeNo)
//{
// return TrainingNeedAnalysis.Service.GetByEmployeeID(employeeNo);
//}
//#region Subordinate Function
//public static SubordinateTrainee SubordinateGet(ID id)
//{
// return TrainingNeedAnalysis.Service.SubordinateGet(id);
//}
//public static ObjectsTemplate<SubordinateTrainee> SubordinateGet()
//{
// return TrainingNeedAnalysis.Service.SubordinateGet();
//}
//public static ObjectsTemplate<SubordinateTrainee> GetByTrainingNeedAnalysisID(ID trainingNeedAnalysisID)
//{
// return TrainingNeedAnalysis.Service.GetByTrainingNeedAnalysisID(trainingNeedAnalysisID);
//}
//#endregion
//public static TrainingNeedAnalysis IsExist(ID trainingID)
//{
// return TrainingNeedAnalysis.Service.IsExist(trainingID);
//}
}
#endregion
#region Class SubordinateTrainee
public class SubordinateTrainee : BasicBaseObject
{
#region Constructor
public SubordinateTrainee()
{
TrainingNeedAnalysisID = 0;
EmployeeID = 0;
Remarks = string.Empty;
}
#endregion
#region Properties
public int TrainingNeedAnalysisID { get; set; }
public int EmployeeID { get; set; }
public string Remarks { get; set; }
#endregion
}
#endregion
#region ITrainingNeedAnalysisService Service
public interface ITrainingNeedAnalysisService
{
TrainingNeedAnalysis Get(int id);
TrainingNeedAnalysis GetByEmployeeID(string employeeNo);
List<TrainingNeedAnalysis> Get();
List<TrainingNeedAnalysis> GetByYear(int year);
List<TrainingNeedAnalysis> Get(string query);
int Save(TrainingNeedAnalysis oTrainingNeedAnalysis);
void Delete(int id);
List<TrainingNeedAnalysis> Get(int trainingID, int departmentID, int departmentForID, int trainingType);
List<TrainingNeedAnalysis> GetByParam(int year, string sDeptIDs, string sDeptForIDs);
#region Subordinate Interface
SubordinateTrainee SubordinateGet(int id);
List<SubordinateTrainee> SubordinateGet();
List<SubordinateTrainee> GetByTrainingNeedAnalysisID(int trainingNeedAnalysisID);
#endregion
TrainingNeedAnalysis IsExist(int trainingID);
}
#endregion
}