390 lines
10 KiB
C#
390 lines
10 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Ease.CoreV35;
|
|
using Ease.CoreV35.Model;
|
|
using Ease.CoreV35.Caching;
|
|
using System.Data.Linq.Mapping;
|
|
|
|
namespace Payroll.BO
|
|
{
|
|
#region Class Discipline
|
|
[Serializable]
|
|
public class Discipline : BasicBaseObject
|
|
{
|
|
#region cache store
|
|
private static Cache _cache = new Cache(typeof(Discipline));
|
|
#endregion
|
|
|
|
#region constructor
|
|
public Discipline()
|
|
{
|
|
_code = string.Empty;
|
|
_description = string.Empty;
|
|
_educationLevelID = null;
|
|
_status = EnumStatus.Active;
|
|
}
|
|
|
|
#region input validator
|
|
#region Input validator
|
|
public string[] InputValidator()
|
|
{
|
|
string[] sErrorString = new string[2];
|
|
if (this.Code == "")
|
|
{
|
|
sErrorString[0] = "Code can not be empty";
|
|
sErrorString[1] = "Code";
|
|
return sErrorString;
|
|
}
|
|
if (this.Description == "")
|
|
{
|
|
sErrorString[0] = "Description can not be empty";
|
|
sErrorString[1] = "Description";
|
|
return sErrorString;
|
|
}
|
|
|
|
sErrorString = null;
|
|
return sErrorString;
|
|
}
|
|
#endregion
|
|
#endregion
|
|
#endregion
|
|
|
|
#region Internal Class
|
|
public class DisciplineLevel : AuditTrailBase
|
|
{
|
|
#region Cache Store
|
|
|
|
private static Cache _cache = new Cache(typeof(DisciplineLevel));
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
public DisciplineLevel()
|
|
{
|
|
_discilineID = null;
|
|
_levelID = null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region DiscilineID : ID
|
|
|
|
private ID _discilineID;
|
|
public ID DiscilineID
|
|
{
|
|
get { return _discilineID; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("DisciplineID", _discilineID, value);
|
|
_discilineID = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region LevelID : ID
|
|
|
|
private ID _levelID;
|
|
public ID LevelID
|
|
{
|
|
get { return _levelID; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("LevelID", _levelID, value);
|
|
_levelID = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region properties
|
|
|
|
#region DisciplineID : ID
|
|
private ID _DisciplineID;
|
|
public ID DisciplineID
|
|
{
|
|
get { return _DisciplineID; }
|
|
set { _DisciplineID = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region code : String
|
|
private string _code;
|
|
|
|
public string Code
|
|
{
|
|
get { return _code; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("CODE", _code, value);
|
|
_code = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region description : string
|
|
private string _description;
|
|
public string Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("DESCRIPTION", _description, value);
|
|
_description = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region EducationLevelID: ID
|
|
private ID _educationLevelID;
|
|
|
|
public ID EducationLevelID
|
|
{
|
|
get { return _educationLevelID; }
|
|
set { _educationLevelID = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region DisciplineLevels : DisciplineLevel
|
|
|
|
private ObjectsTemplate<Discipline.DisciplineLevel> _disciplineLevels = null;
|
|
public ObjectsTemplate<Discipline.DisciplineLevel> DisciplineLevels
|
|
{
|
|
get
|
|
{
|
|
if (_disciplineLevels == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
{
|
|
_disciplineLevels = Discipline.GetDisplineByDID(this.ID);
|
|
}
|
|
return this._disciplineLevels;
|
|
}
|
|
set
|
|
{
|
|
_disciplineLevels = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Service Factory IDisciplineService : IDisciplineService
|
|
|
|
internal static IDisciplineService Service
|
|
{
|
|
get { return Services.Factory.CreateService<IDisciplineService>(typeof(IDisciplineService)); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region functions
|
|
public static Discipline Get(ID nID)
|
|
{
|
|
Discipline oDiscipline = null;
|
|
#region Cache Header
|
|
oDiscipline = (Discipline)_cache["Get", nID];
|
|
if (oDiscipline != null)
|
|
return oDiscipline;
|
|
#endregion
|
|
oDiscipline = Discipline.Service.Get(nID);
|
|
#region Cache Footer
|
|
_cache.Add(oDiscipline, "Get", nID);
|
|
#endregion
|
|
return oDiscipline;
|
|
}
|
|
|
|
public static Discipline Get(string sCode)
|
|
{
|
|
Discipline oDiscipline = null;
|
|
#region cache header
|
|
oDiscipline = (Discipline)_cache["Get", sCode];
|
|
if (oDiscipline != null)
|
|
return oDiscipline;
|
|
#endregion
|
|
oDiscipline = Discipline.Service.Get(sCode);
|
|
|
|
#region cache footer
|
|
_cache.Add(oDiscipline, "Get", sCode);
|
|
#endregion
|
|
return oDiscipline;
|
|
}
|
|
|
|
public static ObjectsTemplate<Discipline> Get()
|
|
{
|
|
#region cache header
|
|
ObjectsTemplate<Discipline> disciplines = _cache["Get"] as ObjectsTemplate<Discipline>;
|
|
if (disciplines != null)
|
|
return disciplines;
|
|
#endregion
|
|
try
|
|
{
|
|
disciplines = Service.Get();
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region cache footer
|
|
_cache.Add(disciplines, "Get");
|
|
#endregion
|
|
|
|
return disciplines;
|
|
}
|
|
|
|
public static ObjectsTemplate<Discipline> Get(EnumStatus status)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<Discipline> disciplines = _cache["Get", status] as ObjectsTemplate<Discipline>;
|
|
if (disciplines != null)
|
|
return disciplines;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
disciplines = Service.Get(status);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(disciplines, "Get", status);
|
|
|
|
#endregion
|
|
|
|
return disciplines;
|
|
}
|
|
|
|
public static ObjectsTemplate<Discipline.DisciplineLevel> GetDisplineByDID(ID DisID)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<Discipline.DisciplineLevel> disciplines = _cache["GetDisplineByDID", DisID] as ObjectsTemplate<Discipline.DisciplineLevel>;
|
|
if (disciplines != null)
|
|
return disciplines;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
disciplines = Service.GetDisplineByDID(DisID);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(disciplines, "GetDisplineByDID", DisID);
|
|
|
|
#endregion
|
|
|
|
return disciplines;
|
|
}
|
|
|
|
public static ObjectsTemplate<Discipline> GetByEducationLevel(ID levelID)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<Discipline> disciplines = _cache["GetByEducationLevel", levelID] as ObjectsTemplate<Discipline>;
|
|
if (disciplines != null)
|
|
return disciplines;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
disciplines = Service.GetByEducationLevel(levelID);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(disciplines, "GetByEducationLevel", levelID);
|
|
|
|
#endregion
|
|
|
|
return disciplines;
|
|
}
|
|
|
|
public static ObjectsTemplate<Discipline.DisciplineLevel> GetDisByEducationLevel(ID levelID)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<Discipline.DisciplineLevel> disciplines = _cache["GetDisByEducationLevel", levelID] as ObjectsTemplate<Discipline.DisciplineLevel>;
|
|
if (disciplines != null)
|
|
return disciplines;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
disciplines = Service.GetDisByEducationLevel(levelID);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(disciplines, "GetDisByEducationLevel", levelID);
|
|
|
|
#endregion
|
|
|
|
return disciplines;
|
|
}
|
|
|
|
|
|
public ID Save()
|
|
{
|
|
this.SetAuditTrailProperties();
|
|
return Discipline.Service.Save(this);
|
|
|
|
}
|
|
|
|
public void Delete(ID id)
|
|
{
|
|
Discipline.Service.Delete(id);
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
#region IDiscipline Service
|
|
public interface IDisciplineService
|
|
{
|
|
Discipline Get(ID id);
|
|
Discipline Get(string sCode);
|
|
ObjectsTemplate<Discipline> Get();
|
|
ObjectsTemplate<Discipline> Get(EnumStatus status);
|
|
ObjectsTemplate<Discipline> GetByEducationLevel(ID levelID);
|
|
ID Save(Discipline item);
|
|
void Delete(ID id);
|
|
ObjectsTemplate<Discipline.DisciplineLevel> GetDisplineByDID(ID DisID);
|
|
ObjectsTemplate<Discipline.DisciplineLevel> GetDisByEducationLevel(ID levelID);
|
|
}
|
|
#endregion
|
|
}
|