247 lines
6.1 KiB
C#
247 lines
6.1 KiB
C#
|
|
using Ease.Core.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HRM.BO
|
|
{
|
|
public class Skill : BasicBaseObject
|
|
{
|
|
#region Constructor
|
|
|
|
public Skill()
|
|
{
|
|
Code = string.Empty;
|
|
Name = string.Empty;
|
|
ParentID = 0;
|
|
Value = string.Empty;
|
|
Tier = 1;
|
|
this.Status = EnumStatus.Active;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public string Code { get; set; }
|
|
public string Name { get; set; }
|
|
|
|
public int ParentID { get; set; }
|
|
public string Value { get; set; }
|
|
public int Tier { get; set; }
|
|
public List<Skill> Childs { get; set; }
|
|
public List<ObjectTemplate> PickerChilds { get; set; }
|
|
|
|
|
|
|
|
//private List<Skill> _Childs;
|
|
//public List<Skill> Childs
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_Childs == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
// {
|
|
// _Childs = Skill.GetChilds(this.ID);
|
|
// }
|
|
// return _Childs;
|
|
// }
|
|
// set
|
|
// {
|
|
// _Childs = value;
|
|
// }
|
|
//}
|
|
|
|
//public List<ObjectTemplate> PickerChilds
|
|
//{
|
|
// get
|
|
// {
|
|
// List<ObjectTemplate> pChilds = new List<ObjectTemplate>();
|
|
// if (_Childs == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
// {
|
|
// _Childs = Skill.GetChilds(this.ID);
|
|
// if (_Childs != null)
|
|
// {
|
|
// foreach (Skill oItem in _Childs)
|
|
// {
|
|
// pChilds.Add(oItem);
|
|
// }
|
|
// }
|
|
// }
|
|
// return pChilds;
|
|
// }
|
|
//}
|
|
|
|
|
|
//#region Service Factory ISkillService : ISkillService
|
|
|
|
//internal static ISkillService Service
|
|
//{
|
|
// get { return Services.Factory.CreateService<ISkillService>(typeof(ISkillService)); }
|
|
//}
|
|
|
|
//#endregion
|
|
|
|
#endregion
|
|
|
|
//#region Functions
|
|
|
|
//public ID Save()
|
|
//{
|
|
// try
|
|
// {
|
|
// if (this.IsNew)
|
|
// {
|
|
// if (IsExists(this.Code))
|
|
// {
|
|
// throw new ServiceException("Code already exists");
|
|
// }
|
|
|
|
// }
|
|
// base.SetAuditTrailProperties();
|
|
// return Skill.Service.Save(this);
|
|
// }
|
|
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new ServiceException(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public void Delete(ID id)
|
|
//{
|
|
// Skill.Service.Delete(id);
|
|
//}
|
|
|
|
//public static Skill Get(ID nID)
|
|
//{
|
|
// Skill oSkill = null;
|
|
// #region Cache Header
|
|
// oSkill = (Skill)_cache["Get", nID];
|
|
// if (oSkill != null)
|
|
// return oSkill;
|
|
// #endregion
|
|
// oSkill = Skill.Service.Get(nID);
|
|
// #region Cache Footer
|
|
// _cache.Add(oSkill, "Get", nID);
|
|
// #endregion
|
|
// return oSkill;
|
|
//}
|
|
|
|
//public static List<Skill> Get()
|
|
//{
|
|
// #region Cache Header
|
|
// List<Skill> oSkill = _cache["Get"] as List<Skill>;
|
|
// if (oSkill != null)
|
|
// return oSkill;
|
|
// #endregion
|
|
// try
|
|
// {
|
|
// oSkill = Service.Get();
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
// #region Cache Footer
|
|
// _cache.Add(oSkill, "Get");
|
|
// #endregion
|
|
// return oSkill;
|
|
//}
|
|
|
|
//public static List<Skill> GetParents(EnumStatus status)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// List<Skill> skills = _cache["GetParents", status] as List<Skill>;
|
|
// if (skills != null)
|
|
// return skills;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// skills = Service.GetParents(status);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(skills, "GetParents", status);
|
|
|
|
// #endregion
|
|
|
|
// return skills;
|
|
//}
|
|
|
|
//public static List<Skill> GetChilds(ID parentID)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// List<Skill> skills = _cache["GetChilds"] as List<Skill>;
|
|
// if (skills != null)
|
|
// return skills;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// skills = Service.GetChilds(parentID);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(skills, "GetChilds");
|
|
|
|
// #endregion
|
|
|
|
// return skills;
|
|
//}
|
|
|
|
//private bool IsExists(string Code)
|
|
//{
|
|
// try
|
|
// {
|
|
// bool isExists = false;
|
|
// if (this.Code != null && this.Value.ToUpper() != Code.ToUpper())
|
|
// {
|
|
// isExists = Skill.Service.IsExists(Code);
|
|
// }
|
|
// return isExists;
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new ServiceException(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
|
|
//#endregion
|
|
}
|
|
|
|
#region ISkill Service
|
|
|
|
public interface ISkillService
|
|
{
|
|
int Save(Skill item);
|
|
void Delete(int id);
|
|
Skill Get(int id);
|
|
List<Skill> Get();
|
|
List<Skill> GetParents(EnumStatus status);
|
|
List<Skill> GetChilds(int parentID);
|
|
bool IsExists(string Code);
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|