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(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 _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 Get() //{ // #region Cache Header // ObjectsTemplate accessCards = _cache["Get"] as ObjectsTemplate; // 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 Get(EnumCardStatus status) //{ // #region Cache Header // ObjectsTemplate accessCards = _cache["Get"] as ObjectsTemplate; // 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 Get(params EnumCardStatus[] status) //{ // #region Cache Header // ObjectsTemplate accessCards = _cache["Get"] as ObjectsTemplate; // 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 accessCards) ////{ //// AccessCard.Service.SaveForExcelUpload(accessCards); ////} //#endregion } #endregion //#region IAccessCard Service public interface IAccessCardService { AccessCard Get(int id); AccessCard Get(string CardNumber); //ObjectsTemplate Get(); //ObjectsTemplate Get(EnumCardStatus status); //ObjectsTemplate Get(params EnumCardStatus[] status); int Save(AccessCard item); // void Save(List items); //void Delete(ID id); bool IsExist(string CardNumber); //void UpdateStatus(ID cardID, EnumCardStatus status); //void SaveForExcelUpload(ObjectsTemplate accessCards); } //#endregion }