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 { [Serializable] public class SurveyWeightDefinition : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(SurveyWeightDefinition)); #endregion #region Constructor #region Input validator #endregion public SurveyWeightDefinition() { _surveyID = null; _fromWeight = 0; _toWeight = 0; _remark = string.Empty; } #endregion #region Properties #region SurveyID : ID private ID _surveyID; public ID SurveyID { get { return _surveyID; } set { base.OnPropertyChange("SurveyID", _surveyID, value); _surveyID = value; } } #endregion #region FromWeight : double private double _fromWeight; public double FromWeight { get { return _fromWeight; } set { base.OnPropertyChange("FromWeight", _fromWeight, value); _fromWeight = value; } } #endregion #region ToWeight : double private double _toWeight; public double ToWeight { get { return _toWeight; } set { base.OnPropertyChange("ToWeight", _toWeight, value); _toWeight = value; } } #endregion #region Remark : string private string _remark; public string Remark { get { return _remark; } set { base.OnPropertyChange("Remark", _remark, value); _remark = value; } } #endregion #region Service Factory IPFTransactionService : IPFTransactionService internal static ISurveyWeightDefinitionService Service { get { return Services.Factory.CreateService(typeof(ISurveyWeightDefinitionService)); } } #endregion #endregion #region Functions public static ObjectsTemplate GetSurveyWeightDefinition() { #region cache header ObjectsTemplate SurveyWeightDefinitions = _cache["GetSurveyWeightDefinition"] as ObjectsTemplate; if (SurveyWeightDefinitions != null) return SurveyWeightDefinitions; #endregion try { SurveyWeightDefinitions = Service.GetSurveyWeightDefinition(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(SurveyWeightDefinitions, "GetSurveyWeightDefinition"); #endregion return SurveyWeightDefinitions; } public static ObjectsTemplate GetSurveyWeightDefinition(ID surveyId) { #region Cache Header ObjectsTemplate SurveyWeightDefinitions = _cache["GetSurveyWeightDefinition", surveyId] as ObjectsTemplate; if (SurveyWeightDefinitions != null) return SurveyWeightDefinitions; #endregion try { SurveyWeightDefinitions = Service.GetSurveyWeightDefinition(surveyId); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(SurveyWeightDefinitions, "GetSurveyWeightDefinition", surveyId); #endregion return SurveyWeightDefinitions; } public ID Save() { base.SetAuditTrailProperties(); return SurveyWeightDefinition.Service.Save(this); } public void Delete(ID id) { SurveyWeightDefinition.Service.Delete(id); } #endregion } #region ISurveyWeightDefinition Service public interface ISurveyWeightDefinitionService { ObjectsTemplate GetSurveyWeightDefinition(ID surveyId); ObjectsTemplate GetSurveyWeightDefinition(); ID Save(SurveyWeightDefinition item); void Delete(ID id); } #endregion }