Exemple #1
0
        public static OpenHouse GetByID(int OpenHouseID, IEnumerable <string> includeList = null)
        {
            OpenHouse obj = null;
            string    key = cacheKeyPrefix + OpenHouseID + GetCacheIncludeText(includeList);

            OpenHouse tmpClass = null;

            if (Cache.IsEnabled)
            {
                if (Cache.IsEmptyCacheItem(key))
                {
                    return(null);
                }
                tmpClass = Cache[key] as OpenHouse;
            }

            if (tmpClass != null)
            {
                obj = tmpClass;
            }
            else
            {
                using (Entities entity = new Entities())
                {
                    IQueryable <OpenHouse> itemQuery = AddIncludes(entity.OpenHouse, includeList);
                    obj = itemQuery.FirstOrDefault(n => n.OpenHouseID == OpenHouseID);
                }
                Cache.Store(key, obj);
            }

            return(obj);
        }
Exemple #2
0
 public OpenHouse(OpenHouse objectToCopy)
 {
     BeginDate      = objectToCopy.BeginDate;
     EndDate        = objectToCopy.EndDate;
     OpenHouseID    = objectToCopy.OpenHouseID;
     ShowcaseItemID = objectToCopy.ShowcaseItemID;
 }
            public Dictionary <string, object> GetCustomFilterList()
            {
                filterList = GetFilterList();
                if (AddressLat != null)
                {
                    filterList.Add("@AddressLat", AddressLat.ToString());
                }
                if (AddressLong != null)
                {
                    filterList.Add("@AddressLong", AddressLong.ToString());
                }
                if (MinDistance != null)
                {
                    filterList.Add("@MinDistance", MinDistance.ToString());
                }
                if (MaxDistance != null)
                {
                    filterList.Add("@MaxDistance", MaxDistance.ToString());
                }
                if (OpenHouse != null)
                {
                    filterList.Add("@OpenHouse", OpenHouse.ToString());
                }
                if (!String.IsNullOrWhiteSpace(SearchText))
                {
                    filterList.Add("@SearchText", SearchText);
                }

                if (!String.IsNullOrWhiteSpace(FilterPropertyType))
                {
                    filterList.Add("@FilterPropertyType", FilterPropertyType);
                }
                if (FilterListPriceMin.HasValue)
                {
                    filterList.Add("@FilterListPriceMin", FilterListPriceMin);
                }
                if (FilterListPriceMax.HasValue)
                {
                    filterList.Add("@FilterListPriceMax", FilterListPriceMax);
                }
                if (FilterBeginDate.HasValue)
                {
                    filterList.Add("@FilterBeginDate", FilterBeginDate);
                }
                if (FilterEndDate.HasValue)
                {
                    filterList.Add("@FilterEndDate", FilterEndDate);
                }
                if (NewHomesOnly.HasValue)
                {
                    filterList.Add("@NewHomesOnly", NewHomesOnly);
                }
                if (ShowLotsLand.HasValue)
                {
                    filterList.Add("@ShowLotsLand", ShowLotsLand);
                }
                return(filterList);
            }