Example #1
0
        /// <summary>
        /// 将活动指向房间分类
        /// </summary>
        /// <param name="hotelPromotionId"></param>
        /// <param name="HotelRoomCategoryID"></param>
        public void AssignHotelRoomCategory(Guid hotelPromotionId, Guid HotelRoomCategoryID)
        {
            HotelPromotion    hotelPromotion    = hotelPromotionRepository.GetByKey(hotelPromotionId);
            HotelRoomCategory hotelRoomCategory = hotelRoomCategoryRepository.GetByKey(HotelRoomCategoryID);

            hotelPromotion.HotelRoomCategorys.Add(hotelRoomCategory);
            hotelPromotionRepository.Update(hotelPromotion);
            repositoryContext.Commit();
        }
        /// <summary>
        /// 将活动指向消费者角色
        /// </summary>
        /// <param name="hotelPromotionId"></param>
        /// <param name="CustomerRoleID"></param>
        public void AssignCustomerRole(Guid hotelPromotionId, Guid CustomerRoleID)
        {
            HotelPromotion hotelPromotion = hotelPromotionRepository.GetByKey(hotelPromotionId);
            CustomerRole   customerRole   = customerRoleRepository.GetByKey(CustomerRoleID);

            hotelPromotion.CustomerRoles.Add(customerRole);
            hotelPromotionRepository.Update(hotelPromotion);
            repositoryContext.Commit();
        }
        /// <summary>
        /// 根据Id值获取酒店优惠活动
        /// </summary>
        /// <param name="Id">id值</param>
        /// <param name="spec">查询方式</param>
        /// <returns></returns>
        public THotelPromotionDataObject GetHotelPromotionByKey(Guid Id, QuerySpec spec)
        {
            TAgregate hotelPromotion;

            if (!spec.Verbose)
            {
                hotelPromotion = hotelPromotionRepository.GetByKey(Id);
            }
            else
            {
                hotelPromotion = hotelPromotionRepository.Find(Specification <TAgregate> .Eval(t => t.Id.Equals(Id)), t => t.CustomerRoles, t => t.HotelRoomCategorys, t => t.PromotionImages);
            }
            return(AutoMapper.Mapper.Map <TAgregate, THotelPromotionDataObject>(hotelPromotion));
        }