202 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			202 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using Ease.CoreV35.Model;
							 | 
						|||
| 
								 | 
							
								using Ease.CoreV35.Caching;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace Payroll.BO
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    #region class Nature Of Training
							 | 
						|||
| 
								 | 
							
								    [Serializable]
							 | 
						|||
| 
								 | 
							
								    public class NatureOfTraining : BasicBaseObject
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region cache store
							 | 
						|||
| 
								 | 
							
								        private static Cache _cache = new Cache(typeof(NatureOfTraining));
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region constructor
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public NatureOfTraining()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            _code = string.Empty;
							 | 
						|||
| 
								 | 
							
								            _name = string.Empty;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #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.Name == "")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                sErrorString[0] = "NAME can not be empty";
							 | 
						|||
| 
								 | 
							
								                sErrorString[1] = "NAME";
							 | 
						|||
| 
								 | 
							
								                return sErrorString;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            sErrorString = null;
							 | 
						|||
| 
								 | 
							
								            return sErrorString;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region properties
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region Code : string
							 | 
						|||
| 
								 | 
							
								        private string _code;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public string Code
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get { return _code; }
							 | 
						|||
| 
								 | 
							
								            set 
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                base.OnPropertyChange<string>("CODE", _code, value);
							 | 
						|||
| 
								 | 
							
								                _code = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region Name : string
							 | 
						|||
| 
								 | 
							
								        private string _name;
							 | 
						|||
| 
								 | 
							
								        public string Name
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get { return _name; }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                base.OnPropertyChange<string>("NAME", _name, value);
							 | 
						|||
| 
								 | 
							
								                _name = value; 
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region Service Factory INatureOfTrainingService : INatureOfTrainingService
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        internal static INatureOfTrainingService Service
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get { return Services.Factory.CreateService<INatureOfTrainingService>(typeof(INatureOfTrainingService)); }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region Function
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public static NatureOfTraining Get(ID nID)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            NatureOfTraining oNatureOfTraining = null;
							 | 
						|||
| 
								 | 
							
								            #region Cache Header
							 | 
						|||
| 
								 | 
							
								            oNatureOfTraining = (NatureOfTraining)_cache["Get", nID];
							 | 
						|||
| 
								 | 
							
								            if (oNatureOfTraining != null)
							 | 
						|||
| 
								 | 
							
								                return oNatureOfTraining;
							 | 
						|||
| 
								 | 
							
								            #endregion
							 | 
						|||
| 
								 | 
							
								            oNatureOfTraining = NatureOfTraining.Service.Get(nID);
							 | 
						|||
| 
								 | 
							
								            #region Cache Footer
							 | 
						|||
| 
								 | 
							
								            _cache.Add(oNatureOfTraining, "Get", nID);
							 | 
						|||
| 
								 | 
							
								            #endregion
							 | 
						|||
| 
								 | 
							
								            return oNatureOfTraining;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public static ObjectsTemplate<NatureOfTraining> Get()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            #region cache header
							 | 
						|||
| 
								 | 
							
								            ObjectsTemplate<NatureOfTraining> natureOfTrainings = _cache["Get"] as ObjectsTemplate<NatureOfTraining>;
							 | 
						|||
| 
								 | 
							
								            if (natureOfTrainings != null)
							 | 
						|||
| 
								 | 
							
								                return natureOfTrainings;
							 | 
						|||
| 
								 | 
							
								            #endregion
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                natureOfTrainings = Service.Get();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (ServiceException e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                throw new Exception(e.Message, e);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            #region cache footer
							 | 
						|||
| 
								 | 
							
								            _cache.Add(natureOfTrainings, "Get");
							 | 
						|||
| 
								 | 
							
								            #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return natureOfTrainings;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public static NatureOfTraining Get(string sCode)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            NatureOfTraining oNatureOfTraining = null;
							 | 
						|||
| 
								 | 
							
								            #region Cache Header
							 | 
						|||
| 
								 | 
							
								            oNatureOfTraining = (NatureOfTraining)_cache["Get", sCode];
							 | 
						|||
| 
								 | 
							
								            if (oNatureOfTraining != null)
							 | 
						|||
| 
								 | 
							
								                return oNatureOfTraining;
							 | 
						|||
| 
								 | 
							
								            #endregion
							 | 
						|||
| 
								 | 
							
								            oNatureOfTraining = NatureOfTraining.Service.Get(sCode);
							 | 
						|||
| 
								 | 
							
								            #region Cache Footer
							 | 
						|||
| 
								 | 
							
								            _cache.Add(oNatureOfTraining, "Get", sCode);
							 | 
						|||
| 
								 | 
							
								            #endregion
							 | 
						|||
| 
								 | 
							
								            return oNatureOfTraining;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public static ObjectsTemplate<NatureOfTraining> Get(EnumStatus status)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            #region Cache Header
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            ObjectsTemplate<NatureOfTraining> natureOfTrainings = _cache["Get", status] as ObjectsTemplate<NatureOfTraining>;
							 | 
						|||
| 
								 | 
							
								            if (natureOfTrainings != null)
							 | 
						|||
| 
								 | 
							
								                return natureOfTrainings;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if(status==EnumStatus.Regardless)
							 | 
						|||
| 
								 | 
							
								                    natureOfTrainings = Service.Get();
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                    natureOfTrainings = Service.Get(status);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (ServiceException e)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                throw new Exception(e.Message, e);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            #region Cache Footer
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            _cache.Add(natureOfTrainings, "Get", status);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return natureOfTrainings;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public ID Save()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.SetAuditTrailProperties();
							 | 
						|||
| 
								 | 
							
								            return NatureOfTraining.Service.Save(this);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public void Delete(ID id)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            NatureOfTraining.Service.Delete(id);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								    #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    #region INatureOfTrainingService
							 | 
						|||
| 
								 | 
							
								    public interface INatureOfTrainingService
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        NatureOfTraining Get(ID id);
							 | 
						|||
| 
								 | 
							
								        NatureOfTraining Get(string sCode);
							 | 
						|||
| 
								 | 
							
								        ObjectsTemplate<NatureOfTraining> Get();
							 | 
						|||
| 
								 | 
							
								        ObjectsTemplate<NatureOfTraining> Get(EnumStatus status);
							 | 
						|||
| 
								 | 
							
								        ID Save(NatureOfTraining item);
							 | 
						|||
| 
								 | 
							
								        void Delete(ID id);
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								    #endregion
							 | 
						|||
| 
								 | 
							
								}
							 |