using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35; using Ease.CoreV35.Model; using Ease.CoreV35.Caching; namespace Payroll.BO { #region class HRJoiningQuestionary [Serializable] public class HRJoiningQuestionary : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(HRJoiningQuestionary)); #endregion #region Constructor public HRJoiningQuestionary() { _questionIndex = 0; _isPrimary = EnumIsPrimary.NO; _description = string.Empty; _questionNo = string.Empty; _ansDatatype = EnumAnswerType.None; } #endregion #region Properties #region QuestionIndex : int private int _questionIndex; public int QuestionIndex { get { return _questionIndex; } set { _questionIndex = value; } } #endregion #region IsPrimary : EnumIsPrimary private EnumIsPrimary _isPrimary; public EnumIsPrimary IsPrimary { get { return _isPrimary; } set { _isPrimary = value; } } #endregion #region Description : string private string _description; public string Description { get { return _description; } set { _description = value; } } #endregion #region QuestionNo : string private string _questionNo; public string QuestionNo { get { return _questionNo; } set { _questionNo = value; } } #endregion #region AnsDatatype : EnumAnswerType private EnumAnswerType _ansDatatype; public EnumAnswerType AnsDatatype { get { return _ansDatatype; } set { _ansDatatype = value; } } #endregion #region Service Factory IHRJoiningQuestionaryService : IHRJoiningQuestionaryService internal static IHRJoiningQuestionaryService Service { get { return Services.Factory.CreateService(typeof(IHRJoiningQuestionaryService)); } } #endregion #endregion #region Input validator public string[] InputValidator() { string[] sErrorString = new string[2]; if (this.QuestionNo == "") { sErrorString[0] = "QuestionNo can not be empty"; sErrorString[1] = "QuestionNo"; return sErrorString; } if (this.Description == "") { sErrorString[0] = "Question Description can not be empty"; sErrorString[1] = "Description"; return sErrorString; } if (this.IsPrimary.ToString() == "") { sErrorString[0] = "IsPrimary can not be empty"; sErrorString[1] = "IsPrimary"; return sErrorString; } if (this.AnsDatatype.ToString() == "") { sErrorString[0] = "AnsDatatype can not be empty"; sErrorString[1] = "AnsDatatype"; return sErrorString; } sErrorString = null; return sErrorString; } #endregion #region Function(s) #region Get public static HRJoiningQuestionary Get(ID nID) { HRJoiningQuestionary oHRJoiningQuestionary = null; #region Cache Header oHRJoiningQuestionary = (HRJoiningQuestionary)_cache["Get", nID]; if (oHRJoiningQuestionary != null) return oHRJoiningQuestionary; #endregion try { oHRJoiningQuestionary = Service.Get(nID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oHRJoiningQuestionary, "Get", nID); #endregion return oHRJoiningQuestionary; } public static ObjectsTemplate Get(EnumStatus status) { ObjectsTemplate oHRJoiningQuestionaries = null; #region Cache Header oHRJoiningQuestionaries = _cache["Get"] as ObjectsTemplate; if (oHRJoiningQuestionaries != null) return oHRJoiningQuestionaries; #endregion try { oHRJoiningQuestionaries = Service.Get(status); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oHRJoiningQuestionaries, "Get"); #endregion return oHRJoiningQuestionaries; } public static ObjectsTemplate GetByQuestionNo(string sQuesNo) { ObjectsTemplate oHRJoiningQuestionaries = null; #region Cache Header oHRJoiningQuestionaries = _cache["Get"] as ObjectsTemplate; if (oHRJoiningQuestionaries != null) return oHRJoiningQuestionaries; #endregion try { oHRJoiningQuestionaries = Service.GetByQuestionNo(sQuesNo); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oHRJoiningQuestionaries, "Get"); #endregion return oHRJoiningQuestionaries; } #endregion #region Save public ID Save() { //SetAuditTrailProperties(); return Service.Save(this); } #endregion #region Delete public void Delete(ID id) { Service.Delete(id); } #endregion #endregion } #endregion #region IHRJoiningQuestionaryService public interface IHRJoiningQuestionaryService { HRJoiningQuestionary Get(ID nID); ObjectsTemplate Get(EnumStatus status); ObjectsTemplate GetByQuestionNo(String sEmpNo); ID Save(HRJoiningQuestionary item); void Delete(ID id); } #endregion }