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 SurveyQuestion : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(SurveyQuestion)); #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.Name == "") // { // sErrorString[0] = "Description can not be empty"; // sErrorString[1] = "Description"; // return sErrorString; // } // sErrorString = null; // return sErrorString; //} #endregion public SurveyQuestion() { _surveyID = null; _questionID = 0; } #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 QuestionID : int private int _questionID; public int QuestionID { get { return _questionID; } set { base.OnPropertyChange("QuestionID", _questionID, value); _questionID = value; } } #endregion #region Service Factory IPFTransactionService : IPFTransactionService internal static ISurveyQuestionService Service { get { return Services.Factory.CreateService(typeof(ISurveyQuestionService)); } } #endregion #endregion #region Functions public static ObjectsTemplate GetSurveyQuestion() { #region cache header ObjectsTemplate SurveyQuestions = _cache["GetSurveyQuestion"] as ObjectsTemplate; if (SurveyQuestions != null) return SurveyQuestions; #endregion try { SurveyQuestions = Service.GetSurveyQuestion(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(SurveyQuestions, "GetSurveyQuestion"); #endregion return SurveyQuestions; } public static ObjectsTemplate GetSurveyQuestion(ID surveyId) { #region Cache Header ObjectsTemplate SurveyQuestions = _cache["GetSurveyQuestion", surveyId] as ObjectsTemplate; if (SurveyQuestions != null) return SurveyQuestions; #endregion try { SurveyQuestions = Service.GetSurveyQuestion(surveyId); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(SurveyQuestions, "GetSurveyQuestion", surveyId); #endregion return SurveyQuestions; } public ID Save() { base.SetAuditTrailProperties(); return SurveyQuestion.Service.Save(this); } public void Delete(ID id) { SurveyQuestion.Service.Delete(id); } #endregion } #region ISurveyQuestion Service public interface ISurveyQuestionService { ObjectsTemplate GetSurveyQuestion(ID surveyId); ObjectsTemplate GetSurveyQuestion(); ID Save(SurveyQuestion item); void Delete(ID id); } #endregion }