CEL_Payroll/Payroll.BO/Survey/SurveyOrganization.cs
2024-09-17 14:30:13 +06:00

247 lines
6.2 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 SurveyOrganization : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(SurveyOrganization));
#endregion
#region Constructor
public SurveyOrganization()
{
_surveyID = null;
_gradeID = null;
_companyID = null;
_departmentID = null;
_locationID = null;
}
#endregion
#region Properties
#region SurveyID : ID
private ID _surveyID;
public ID SurveyID
{
get { return _surveyID; }
set
{
base.OnPropertyChange<ID>("SurveyOrganizationID", _surveyID, value);
_surveyID = value;
}
}
#endregion
#region GradeID : ID
private ID _gradeID;
public ID GradeID
{
get { return _gradeID; }
set
{
base.OnPropertyChange<ID>("GradeID", _gradeID, value);
_gradeID = value;
}
}
#endregion
#region CompanyID : ID
private ID _companyID;
public ID CompanyID
{
get { return _companyID; }
set
{
base.OnPropertyChange<ID>("CompanyID", _companyID, value);
_companyID = value;
}
}
#endregion
#region DepartmentID : ID
private ID _departmentID;
public ID DepartmentID
{
get { return _departmentID; }
set
{
base.OnPropertyChange<ID>("DepartmentID", _departmentID, value);
_departmentID = value;
}
}
#endregion
#region LocationID : ID
private ID _locationID;
public ID LocationID
{
get { return _locationID; }
set
{
base.OnPropertyChange<ID>("LocationID", _locationID, value);
_locationID = value;
}
}
#endregion
#region Service Factory IPFTransactionService : IPFTransactionService
internal static ISurveyOrganizationService Service
{
get { return Services.Factory.CreateService<ISurveyOrganizationService>(typeof(ISurveyOrganizationService)); }
}
#endregion
#endregion
#region Functions
public SurveyOrganization Get(ID nID)
{
SurveyOrganization oSurveyOrganization = null;
#region Cache Header
oSurveyOrganization = (SurveyOrganization)_cache["Get", ID];
if (oSurveyOrganization != null)
return oSurveyOrganization;
#endregion
oSurveyOrganization = SurveyOrganization.Service.Get(nID);
#region Cache Footer
_cache.Add(oSurveyOrganization, "Get", ID);
#endregion
return oSurveyOrganization;
}
public static ObjectsTemplate<SurveyOrganization> Get()
{
#region cache header
ObjectsTemplate<SurveyOrganization> SurveyOrganizations = _cache["Get"] as ObjectsTemplate<SurveyOrganization>;
if (SurveyOrganizations != null)
return SurveyOrganizations;
#endregion
try
{
SurveyOrganizations = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region cache footer
_cache.Add(SurveyOrganizations, "Get");
#endregion
return SurveyOrganizations;
}
public static ObjectsTemplate<SurveyOrganization> Get(EnumStatus status)
{
#region Cache Header
ObjectsTemplate<SurveyOrganization> SurveyOrganizations = _cache["Get", status] as ObjectsTemplate<SurveyOrganization>;
if (SurveyOrganizations != null)
return SurveyOrganizations;
#endregion
try
{
SurveyOrganizations = Service.Get(status);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(SurveyOrganizations, "Get", status);
#endregion
return SurveyOrganizations;
}
public static ObjectsTemplate<SurveyOrganization> GetSurveyOrganization(ID surveyId)
{
#region Cache Header
ObjectsTemplate<SurveyOrganization> SurveyOrganizations = _cache["GetSurveyOrganization", surveyId] as ObjectsTemplate<SurveyOrganization>;
if (SurveyOrganizations != null)
return SurveyOrganizations;
#endregion
try
{
SurveyOrganizations = Service.GetSurveyOrganization(surveyId);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(SurveyOrganizations, "GetSurveyOrganization", surveyId);
#endregion
return SurveyOrganizations;
}
public ID Save()
{
base.SetAuditTrailProperties();
return SurveyOrganization.Service.Save(this);
}
public void Delete(ID id)
{
SurveyOrganization.Service.Delete(id);
}
#endregion
}
#region ISurveyOrganization Service
public interface ISurveyOrganizationService
{
SurveyOrganization Get(ID id);
ObjectsTemplate<SurveyOrganization> Get();
ObjectsTemplate<SurveyOrganization> GetSurveyOrganization(ID surveyId);
ObjectsTemplate<SurveyOrganization> Get(EnumStatus status);
ID Save(SurveyOrganization item);
void Delete(ID id);
}
#endregion
}