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 { #region MarketSurveyCompany [Serializable] public class MarketSurveyCompany : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(MarketSurveyCompany)); #endregion #region Constructor public MarketSurveyCompany() { _code = string.Empty; _name = string.Empty; _address = string.Empty; _status = EnumStatus.Active; } #endregion #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 #region Properties #region code : string private string _code; public string Code { get { return _code; } set { base.OnPropertyChange("code", _code, value); _code = value; } } #endregion #region name : string private string _name; public string Name { get { return _name; } set { base.OnPropertyChange("name", _name, value); _name = value; } } #endregion #region address : string private string _address; public string Address { get { return _address; } set { base.OnPropertyChange("address", _address, value); _address = value; } } #endregion #region Service Factory IMarketSurveyCompanyService : IMarketSurveyCompanyService internal static IMarketSurveyCompanyService Service { get { return Services.Factory.CreateService(typeof(IMarketSurveyCompanyService)); } } #endregion #endregion #region Functions public static MarketSurveyCompany Get(ID nID) { MarketSurveyCompany oMarketSurveyCompany = null; #region Cache Header oMarketSurveyCompany = (MarketSurveyCompany)_cache["Get", nID]; if (oMarketSurveyCompany != null) return oMarketSurveyCompany; #endregion oMarketSurveyCompany = MarketSurveyCompany.Service.Get(nID); #region Cache Footer _cache.Add(oMarketSurveyCompany, "Get", nID); #endregion return oMarketSurveyCompany; } public static ObjectsTemplate Get(EnumStatus status) { #region Cache Header ObjectsTemplate MarketSurveyCompanys = _cache["Get",status] as ObjectsTemplate; if (MarketSurveyCompanys != null) return MarketSurveyCompanys; #endregion try { MarketSurveyCompanys = Service.Get(status); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(MarketSurveyCompanys, "Get",status); #endregion return MarketSurveyCompanys; } public ID Save() { this.SetAuditTrailProperties(); return MarketSurveyCompany.Service.Save(this); } public void Delete(ID id) { MarketSurveyCompany.Service.Delete(id); } #endregion } #endregion #region IMarketSurveyCompany Service public interface IMarketSurveyCompanyService { MarketSurveyCompany Get(ID id); ObjectsTemplate Get(EnumStatus status); ID Save(MarketSurveyCompany item); void Delete(ID id); } #endregion }