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

207 lines
6.2 KiB
C#

using Ease.Core.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HRM.BO
{
#region AccessCard
[Serializable]
public class AccessCard : ObjectTemplate
{
#region Constructor
public AccessCard()
{
CardNumber = string.Empty;
TypeID = 0;
Status = 0;
}
#endregion
#region Properties
public string CardNumber { get; set; }
public int TypeID { get; set; }
public EnumCardStatus Status { get; set; }
private AccessCardType _accessCardType;
public AccessCardType AccessCardType
{
get
{
//if (TypeID > 0 && _accessCardType == null)
//{
// _accessCardType = new AccessCardType();
// _accessCardType = AccessCardType.Get(TypeID);
//}
return this._accessCardType;
}
set { _accessCardType = value; }
}
public CardOperation CardOperation { get; set; }
//#region Service Factory IAccessCardService : IAccessCardService
//internal static IAccessCardService Service
//{
// get { return Services.Factory.CreateService<IAccessCardService>(typeof(IAccessCardService)); }
//}
//#endregion
#endregion
//#region Functions
//public static AccessCard Get(ID nID)
//{
// AccessCard oAccessCard = null;
// #region Cache Header
// oAccessCard = (AccessCard)_cache["Get", nID];
// if (oAccessCard != null)
// return oAccessCard;
// #endregion
// oAccessCard = AccessCard.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oAccessCard, "Get", nID);
// #endregion
// return oAccessCard;
//}
//public static AccessCard Get(string CardNumber)
//{
// AccessCard oAccessCard = null;
// #region Cache Header
// oAccessCard = (AccessCard)_cache["Get", CardNumber];
// if (oAccessCard != null)
// return oAccessCard;
// #endregion
// oAccessCard = AccessCard.Service.Get(CardNumber);
// #region Cache Footer
// _cache.Add(oAccessCard, "Get", CardNumber);
// #endregion
// return oAccessCard;
//}
//public ID Save()
//{
// return AccessCard.Service.Save(this);
//}
//public void Save(ObjectsTemplate<AccessCard> _accessCards)
//{
// AccessCard.Service.Save(_accessCards);
//}
//public void Delete()
//{
// AccessCard.Service.Delete(ID);
//}
//public void SetObjectID(int id)
//{
// this.SetID(ID.FromInteger(id));
//}
//public static ObjectsTemplate<AccessCard> Get()
//{
// #region Cache Header
// ObjectsTemplate<AccessCard> accessCards = _cache["Get"] as ObjectsTemplate<AccessCard>;
// if (accessCards != null)
// return accessCards;
// #endregion
// try
// {
// accessCards = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(accessCards, "Get");
// #endregion
// return accessCards;
//}
//public static ObjectsTemplate<AccessCard> Get(EnumCardStatus status)
//{
// #region Cache Header
// ObjectsTemplate<AccessCard> accessCards = _cache["Get"] as ObjectsTemplate<AccessCard>;
// if (accessCards != null)
// return accessCards;
// #endregion
// try
// {
// accessCards = Service.Get(status);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(accessCards, "Get");
// #endregion
// return accessCards;
//}
//public static ObjectsTemplate<AccessCard> Get(params EnumCardStatus[] status)
//{
// #region Cache Header
// ObjectsTemplate<AccessCard> accessCards = _cache["Get"] as ObjectsTemplate<AccessCard>;
// if (accessCards != null)
// return accessCards;
// #endregion
// try
// {
// accessCards = Service.Get(status);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(accessCards, "Get");
// #endregion
// return accessCards;
//}
//public bool IsExist(string CardNumber)
//{
// return AccessCard.Service.IsExist(CardNumber);
//}
//public void UpdateStatus(ID cardID, EnumCardStatus status)
//{
// AccessCard.Service.UpdateStatus(cardID, status);
//}
//////for excel upload
////public static void SaveForExcelUpload(ObjectsTemplate<AccessCard> accessCards)
////{
//// AccessCard.Service.SaveForExcelUpload(accessCards);
////}
//#endregion
}
#endregion
//#region IAccessCard Service
public interface IAccessCardService
{
AccessCard Get(int id);
AccessCard Get(string CardNumber);
//ObjectsTemplate<AccessCard> Get();
//ObjectsTemplate<AccessCard> Get(EnumCardStatus status);
//ObjectsTemplate<AccessCard> Get(params EnumCardStatus[] status);
int Save(AccessCard item);
// void Save(List<AccessCard> items);
//void Delete(ID id);
bool IsExist(string CardNumber);
//void UpdateStatus(ID cardID, EnumCardStatus status);
//void SaveForExcelUpload(ObjectsTemplate<AccessCard> accessCards);
}
//#endregion
}