Exemplo n.º 1
0
        //GetEventCategoryDetailById
        public EventCategoryDetail GetEventCategoryDetail(long eventcategory_id)
        {
            DataCacheObject dco = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.CATEGORIES, "GETEVENTCATEGORYDETAIL",
                                                      new object[] { eventcategory_id }, CachingExpirationTime.Hours_01);
            EventCategoryDetail ecd = CacheRepository.Get(dco) as EventCategoryDetail;

            if (ecd != null)
            {
                return(ecd);
            }
            ecd = (from p in dataContext.spCategory_View_EventCategoriesDetail(eventcategory_id)
                   select new EventCategoryDetail
            {
                DateEnd = p.DateEnd,
                IsCurrent = p.IsCurrent,
                IsClickable = p.IsClickable,
                Step = p.CloseStep,
                LinkParams = new LinkParams {
                    EventCategory_ID = p.EventCategory_ID, Event_ID = p.Event_ID, MainCategory_ID = p.MainCategory_ID, Category_ID = p.Category_ID, EventTitle = p.EventTitle, MainCategoryTitle = p.MainCategoryTitle, CategoryTitle = p.CategoryTitle
                },
            }).SingleOrDefault();
            if (ecd != null)
            {
                dco.Data = ecd;
                CacheRepository.Add(dco);
            }
            return(ecd);
        }
        //GetEventCategoryDetail
        public EventCategoryDetail GetEventCategoryDetail(long eventcategory_id)
        {
            DataCacheObject     dco    = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.EVENTS, "GETEVENTCATEGORYDETAIL", new object[] { eventcategory_id }, CachingExpirationTime.Days_01);
            EventCategoryDetail result = CacheRepository.Get(dco) as EventCategoryDetail;

            if (result != null)
            {
                return(result);
            }
            result = (from p in dataContext.spEventCategory_Detail(eventcategory_id)
                      select new EventCategoryDetail
            {
                EventCategory_ID = p.EventCategory_ID,
                Category_ID = p.Category_ID,
                CategoryDescription = p.CategoryDescription,
                CategoryTitle = p.CategoryTitle,
                CategoryMap_ID = p.CategoryMap_ID,
                IsActive = p.IsActive,
                Event_ID = p.Event_ID,
                IsTaxable = p.IsTaxable
            }).FirstOrDefault();
            if (result != null)
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }