205 lines
5.2 KiB
C#
205 lines
5.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 QuestionCategory:BasicBaseObject
|
|
{
|
|
#region Cache Store
|
|
|
|
private static Cache _cache = new Cache(typeof(QuestionCategory));
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
#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.Description == "")
|
|
{
|
|
sErrorString[0] = "Description can not be empty";
|
|
sErrorString[1] = "Description";
|
|
return sErrorString;
|
|
}
|
|
|
|
sErrorString = null;
|
|
return sErrorString;
|
|
}
|
|
#endregion
|
|
|
|
public QuestionCategory()
|
|
{
|
|
_questionCategoryID = null;
|
|
_code = string.Empty;
|
|
_description = string.Empty;
|
|
_status = EnumStatus.Active;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region QuestionCategoryID : ID
|
|
|
|
private ID _questionCategoryID;
|
|
public ID QuestionCategoryID
|
|
{
|
|
get { return _questionCategoryID; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("QuestionCategoryID", _questionCategoryID, value);
|
|
_questionCategoryID = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region code : string
|
|
|
|
private string _code;
|
|
public string Code
|
|
{
|
|
get { return _code; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("code", _code, value);
|
|
_code = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Description : string
|
|
|
|
private string _description;
|
|
public string Description
|
|
{
|
|
get { return _description; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("Description", _description, value);
|
|
_description = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Service Factory IQuestionCategoryService : IQuestionCategoryService
|
|
|
|
internal static IQuestionCategoryService Service
|
|
{
|
|
get { return Services.Factory.CreateService<IQuestionCategoryService>(typeof(IQuestionCategoryService)); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Functions
|
|
|
|
public string GetNextCode()
|
|
{
|
|
return QuestionCategory.Service.GetNextCode();
|
|
}
|
|
|
|
public static QuestionCategory Get(ID nID)
|
|
{
|
|
QuestionCategory oQuestionCategory = null;
|
|
#region Cache Header
|
|
oQuestionCategory = (QuestionCategory)_cache["Get", nID];
|
|
if (oQuestionCategory != null)
|
|
return oQuestionCategory;
|
|
#endregion
|
|
oQuestionCategory = QuestionCategory.Service.Get(nID);
|
|
#region Cache Footer
|
|
_cache.Add(oQuestionCategory, "Get", nID);
|
|
#endregion
|
|
return oQuestionCategory;
|
|
}
|
|
|
|
public static QuestionCategory Get(string sCode)
|
|
{
|
|
QuestionCategory oQuestionCategory = null;
|
|
#region Cache Header
|
|
oQuestionCategory = (QuestionCategory)_cache["Get", sCode];
|
|
if (oQuestionCategory != null)
|
|
return oQuestionCategory;
|
|
#endregion
|
|
oQuestionCategory = QuestionCategory.Service.Get(sCode);
|
|
#region Cache Footer
|
|
_cache.Add(oQuestionCategory, "Get", sCode);
|
|
#endregion
|
|
return oQuestionCategory;
|
|
}
|
|
|
|
public static ObjectsTemplate<QuestionCategory> Get(EnumStatus status)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<QuestionCategory> QuestionCategorys = _cache["Get",status] as ObjectsTemplate<QuestionCategory>;
|
|
if (QuestionCategorys != null)
|
|
return QuestionCategorys;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
QuestionCategorys = Service.Get(status);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(QuestionCategorys, "Get",status);
|
|
|
|
#endregion
|
|
|
|
return QuestionCategorys;
|
|
}
|
|
public ID Save()
|
|
{
|
|
this.SetAuditTrailProperties();
|
|
return QuestionCategory.Service.Save(this);
|
|
}
|
|
|
|
public void Delete(ID id)
|
|
{
|
|
QuestionCategory.Service.Delete(id);
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
#region IQuestionCategory Service
|
|
|
|
public interface IQuestionCategoryService
|
|
{
|
|
QuestionCategory Get(ID id);
|
|
ObjectsTemplate<QuestionCategory> Get(EnumStatus status);
|
|
ID Save(QuestionCategory item);
|
|
void Delete(ID id);
|
|
QuestionCategory Get(string sCode);
|
|
string GetNextCode();
|
|
}
|
|
|
|
#endregion
|
|
}
|