EchoTex_Payroll/HRM.BO/HRBasic/Institution.cs

199 lines
5.4 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00

using System;
using System.Collections.Generic;
namespace HRM.BO
{
#region class Institution
public class Institution : BasicBaseObject
{
#region constructor
public Institution()
{
Code = string.Empty;
Name = string.Empty;
EducationTypeID = 0;
Type = 0;
Status = EnumStatus.Active;
}
#endregion
#region properties
public string Code { get; set; }
public string Name { get; set; }
public EnmInstituteType Type { get; set; }
public int EducationTypeID { get; set; }
public bool BoardRequired { get; set; }
//#region Service Factory IInstitutionService : IInstitutionService
//internal static IInstitutionService Service
//{
// get { return Services.Factory.CreateService<IInstitutionService>(typeof(IInstitutionService)); }
//}
//#endregion
#endregion
//#region Function
//public static Institution Get(ID nID)
//{
// Institution oInstitution = null;
// #region Cache Header
// oInstitution = (Institution)_cache["Get", nID];
// if (oInstitution != null)
// return oInstitution;
// #endregion
// oInstitution = Institution.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oInstitution, "Get", nID);
// #endregion
// return oInstitution;
//}
//public static Institution Get(string sCode)
//{
// Institution oInstitution = null;
// #region Cache Header
// oInstitution = (Institution)_cache["Get", sCode];
// if (oInstitution != null)
// return oInstitution;
// #endregion
// oInstitution = Institution.Service.Get(sCode);
// #region Cache Footer
// _cache.Add(oInstitution, "Get", sCode);
// #endregion
// return oInstitution;
//}
//public static List<Institution> Get()
//{
// #region cache header
// List<Institution> institutions = _cache["Get"] as List<Institution>;
// if (institutions != null)
// return institutions;
// #endregion
// try
// {
// institutions = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region cache footer
// _cache.Add(institutions, "Get");
// #endregion
// return institutions;
//}
//public static List<Institution> Get(EnumStatus status)
//{
// #region Cache Header
// List<Institution> institutions = _cache["Get", status] as List<Institution>;
// if (institutions != null)
// return institutions;
// #endregion
// try
// {
// institutions = Service.Get(status);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(institutions, "Get", status);
// #endregion
// return institutions;
//}
//public static List<Institution> GetByInstituteType(EnmInstituteType type)
//{
// #region Cache Header
// List<Institution> institutions = _cache["GetByInstituteType", type] as List<Institution>;
// if (institutions != null)
// return institutions;
// #endregion
// try
// {
// institutions = Service.GetByInstituteType(type);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(institutions, "GetByInstituteType", type);
// #endregion
// return institutions;
//}
//public ID Save()
//{
// this.SetAuditTrailProperties();
// if (this.ID.IsUnassigned&& this.IsExists(this.Code))
// throw new Exception("Duplicate code is not allowed.");
// return Institution.Service.Save(this);
//}
//public void Delete(ID id)
//{
// Institution.Service.Delete(id);
//}
//private bool IsExists(string Code)
//{
// try
// {
// bool isExists = false;
// if (this.Code != null)
// {
// isExists = Institution.Service.IsExists(Code);
// }
// return isExists;
// }
// catch (ServiceException e)
// {
// throw new ServiceException(e.Message, e);
// }
//}
//#endregion
}
#endregion
#region IInstitution Service
public interface IInstitutionService
{
Institution Get(int id);
Institution Get(string sCode);
List<Institution> Get();
List<Institution> Get(EnumStatus status);
List<Institution> GetByInstituteType(EnmInstituteType type);
int Save(Institution item);
void Delete(int id);
bool IsExists(string Code);
}
#endregion
}