190 lines
4.7 KiB
C#
190 lines
4.7 KiB
C#
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<ID>("SurveyID", _surveyID, value);
|
|
_surveyID = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region FromWeight : double
|
|
|
|
private double _fromWeight;
|
|
public double FromWeight
|
|
{
|
|
get { return _fromWeight; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<double>("FromWeight", _fromWeight, value);
|
|
_fromWeight = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
#region ToWeight : double
|
|
|
|
private double _toWeight;
|
|
public double ToWeight
|
|
{
|
|
get { return _toWeight; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<double>("ToWeight", _toWeight, value);
|
|
_toWeight = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
#region Remark : string
|
|
|
|
private string _remark;
|
|
public string Remark
|
|
{
|
|
get { return _remark; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("Remark", _remark, value);
|
|
_remark = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Service Factory IPFTransactionService : IPFTransactionService
|
|
|
|
internal static ISurveyWeightDefinitionService Service
|
|
{
|
|
get { return Services.Factory.CreateService<ISurveyWeightDefinitionService>(typeof(ISurveyWeightDefinitionService)); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Functions
|
|
|
|
|
|
|
|
public static ObjectsTemplate<SurveyWeightDefinition> GetSurveyWeightDefinition()
|
|
{
|
|
#region cache header
|
|
ObjectsTemplate<SurveyWeightDefinition> SurveyWeightDefinitions = _cache["GetSurveyWeightDefinition"] as ObjectsTemplate<SurveyWeightDefinition>;
|
|
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<SurveyWeightDefinition> GetSurveyWeightDefinition(ID surveyId)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<SurveyWeightDefinition> SurveyWeightDefinitions = _cache["GetSurveyWeightDefinition", surveyId] as ObjectsTemplate<SurveyWeightDefinition>;
|
|
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<SurveyWeightDefinition> GetSurveyWeightDefinition(ID surveyId);
|
|
ObjectsTemplate<SurveyWeightDefinition> GetSurveyWeightDefinition();
|
|
|
|
ID Save(SurveyWeightDefinition item);
|
|
void Delete(ID id);
|
|
}
|
|
|
|
#endregion
|
|
}
|