Example #1
0
        /// <summary>
        /// 根据酒店id获取酒店评论
        /// </summary>
        /// <param name="hotelId"></param>
        /// <returns></returns>
        public List <HotelComment> GetHotelCommentsByHotelId(Guid hotelId)
        {
            JXHotelDbContext    dbContext     = this.EFContext.dbContext as JXHotelDbContext;
            List <HotelComment> hotelComments = dbContext.Hotels.Find(hotelId).HotelComments;

            return(hotelComments);
        }
Example #2
0
        /// <summary>
        /// 根据酒店id获取酒店图片
        /// </summary>
        /// <param name="hotelId"></param>
        /// <returns></returns>
        public List <HotelImage> GetHotelImagesByHotelId(Guid hotelId)
        {
            JXHotelDbContext  dbContext   = this.EFContext.dbContext as JXHotelDbContext;
            List <HotelImage> hotelImages = dbContext.Hotels.Find(hotelId).HotelImages;

            return(hotelImages);
        }
Example #3
0
        /// <summary>
        /// 根据酒店评论id获取酒店评论
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public HotelComment GetHotelCommentByKey(Guid hotelId, Guid id)
        {
            JXHotelDbContext dbContext    = this.EFContext.dbContext as JXHotelDbContext;
            HotelComment     hotelComment = dbContext.Hotels.Find(hotelId).HotelComments.Where(account => account.Id.Equals(id)).FirstOrDefault();

            return(hotelComment);
        }
Example #4
0
        /// <summary>
        /// 根据房间id获取房间图片
        /// </summary>
        /// <param name="RoomId"></param>
        /// <returns></returns>
        public List <RoomImage> GetRoomImagesByRoomId(Guid roomId)
        {
            JXHotelDbContext dbContext  = this.EFContext.dbContext as JXHotelDbContext;
            List <RoomImage> roomImages = dbContext.Rooms.Find(roomId).RoomImages;

            return(roomImages);
        }
        /// <summary>
        /// 根据酒店名称获取活动图片
        /// </summary>
        /// <param name="hotelName"></param>
        /// <returns></returns>
        public List <PromotionImage> GetPromotionImagesByHotelName(string hotelName)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;
            Hotel            hotel     = dbContext.Hotels.Find(Specification <Hotel> .Eval(h => h.Name.Equals(hotelName)));

            return(this.Find(Specification <THotelPromotion> .Eval(h => h.HotelId.Equals(hotel.Id))).PromotionImages);
        }
Example #6
0
        /// <summary>
        /// 根据酒店图片id获取酒店图片
        /// </summary>
        /// <param name="hotelId"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public HotelImage GetHotelImageByKey(Guid hotelId, Guid id)
        {
            JXHotelDbContext dbContext  = this.EFContext.dbContext as JXHotelDbContext;
            HotelImage       hotelImage = dbContext.Hotels.Find(hotelId).HotelImages.Where(image => image.Id.Equals(id)).FirstOrDefault();

            return(hotelImage);
        }
Example #7
0
        /// <summary>
        /// 根据房间图片id获取房间图片
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public RoomImage GetRoomImageByKey(Guid roomId, Guid id)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;
            RoomImage        roomImage = dbContext.Rooms.Find(roomId).RoomImages.Where(Image => Image.Id.Equals(id)).FirstOrDefault();

            return(roomImage);
        }
Example #8
0
        /// <summary>
        /// 删除酒店图片
        /// </summary>
        /// <param name="id">需要删除的酒店图片id值</param>
        public void DeleteHotelImage(Guid hotelId, List <string> ids)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;
            Hotel            hotel     = dbContext.Hotels.Find(hotelId);

            hotel.HotelImages.RemoveAll(item => ids.Contains(item.Id.ToString()));
            this.Context.RegisterModify <Hotel>(hotel);
            this.Context.Commit();
        }
Example #9
0
        public void DeleteCustomerAccount(Guid userId, List <CustomerAccount> customerAccounts)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;
            Customer         customer  = dbContext.Customer.Find(userId);

            customer.CustomerAccount.RemoveAll(item => customerAccounts.Select(a => a.Id).Contains(item.Id));
            this.Context.RegisterModify <Customer>(customer);
            this.Context.Commit();
        }
Example #10
0
        public void AddCustomerAccount(Guid userId, List <CustomerAccount> customerAccounts)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;
            Customer         customer  = dbContext.Customer.Find(userId);

            customer.CustomerAccount.AddRange(customerAccounts);
            this.Context.RegisterModify <Customer>(customer);
            this.Context.Commit();
        }
Example #11
0
        /// <summary>
        /// 删除房间图片
        /// </summary>
        /// <param name="ids">需要删除的房间图片id值</param>
        public void DeleteRoomImage(Guid roomId, List <string> ids)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;
            Room             room      = dbContext.Rooms.Find(roomId);

            room.RoomImages.RemoveAll(item => ids.Contains(item.Id.ToString()));
            this.Update(room);
            this.Context.Commit();
        }
        /// <summary>
        /// 删除活动图片
        /// </summary>
        /// <param name="ids">需要删除的活动图片id值</param>
        public void DeletePromotionImage(Guid PromotionId, List <string> ids)
        {
            JXHotelDbContext dbContext      = this.EFContext.dbContext as JXHotelDbContext;
            HotelPromotion   hotelPromotion = dbContext.HotelPromotions.Find(PromotionId);

            hotelPromotion.PromotionImages.RemoveAll(item => ids.Contains(item.Id.ToString()));
            this.Context.RegisterModify <HotelPromotion>(hotelPromotion);
            this.Context.Commit();
        }
Example #13
0
        /// <summary>
        /// 根据酒店Id获取预定信息
        /// </summary>
        /// <param name="hotelId"></param>
        /// <returns></returns>
        public List <Reservation> GetReservationsForHotel(Guid hotelId)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;

            var query = from r in dbContext.Rooms
                        join res in dbContext.Reservations on r.Id equals res.RoomId

                        where r.HotelId.Equals(hotelId)
                        select res;

            return(query.ToList());
        }
Example #14
0
        /// <summary>
        /// 更新酒店图片
        /// </summary>
        /// <param name="hotelImages"></param>
        /// <returns></returns>
        public List <HotelImage> UpdateHotelImage(Guid hotelId, List <HotelImage> hotelImages)
        {
            JXHotelDbContext  dbContext      = this.EFContext.dbContext as JXHotelDbContext;
            Hotel             hotel          = dbContext.Hotels.Find(hotelId);
            List <HotelImage> listHotelImage = hotel.HotelImages;

            foreach (HotelImage updatehotelImage in hotelImages)
            {
                for (int i = 0; i < listHotelImage.Count; i++)
                {
                    if (listHotelImage[i].Id.Equals(updatehotelImage.Id))
                    {
                        listHotelImage[i] = updatehotelImage;
                    }
                }
            }
            this.Context.RegisterModify <Hotel>(hotel);
            this.Context.Commit();
            return(hotelImages);
        }
Example #15
0
        public List <CustomerAccount> UpdateCustomerAccount(Guid userId, List <CustomerAccount> customerAccounts)
        {
            JXHotelDbContext       dbContext           = this.EFContext.dbContext as JXHotelDbContext;
            Customer               customer            = dbContext.Customer.Find(userId);
            List <CustomerAccount> listCustomerAccount = customer.CustomerAccount;

            foreach (CustomerAccount updatecustomerAccount in customerAccounts)
            {
                for (int i = 0; i < customerAccounts.Count; i++)
                {
                    if (customerAccounts[i].Id.Equals(updatecustomerAccount.Id))
                    {
                        customerAccounts[i] = updatecustomerAccount;
                    }
                }
            }
            this.Context.RegisterModify <Customer>(customer);
            this.Context.Commit();
            return(customerAccounts);
        }
        /// <summary>
        /// 更新活动图片
        /// </summary>
        /// <param name="PromotionImage"></param>
        /// <returns></returns>
        public List <PromotionImage> UpdatePromotionImage(Guid PromotionId, List <PromotionImage> PromotionImages)
        {
            JXHotelDbContext      dbContext          = this.EFContext.dbContext as JXHotelDbContext;
            HotelPromotion        hotelPromotion     = dbContext.HotelPromotions.Find(PromotionId);
            List <PromotionImage> listPromotionImage = hotelPromotion.PromotionImages;

            foreach (PromotionImage updatePromotionImage in PromotionImages)
            {
                for (int i = 0; i < listPromotionImage.Count; i++)
                {
                    if (listPromotionImage[i].Id.Equals(updatePromotionImage.Id))
                    {
                        listPromotionImage[i] = updatePromotionImage;
                    }
                }
            }
            this.Context.RegisterModify <HotelPromotion>(hotelPromotion);
            this.Context.Commit();
            return(PromotionImages);
        }
Example #17
0
        /// <summary>
        /// 更新酒店评论
        /// </summary>
        /// <param name="HotelComments"></param>
        /// <returns></returns>
        public List <HotelComment> UpdateHotelComment(Guid hotelId, List <HotelComment> HotelComments)
        {
            JXHotelDbContext    dbContext        = this.EFContext.dbContext as JXHotelDbContext;
            Hotel               hotel            = dbContext.Hotels.Find(hotelId);
            List <HotelComment> listHotelComment = hotel.HotelComments;

            foreach (HotelComment updateHotelComment in HotelComments)
            {
                for (int i = 0; i < listHotelComment.Count; i++)
                {
                    if (listHotelComment[i].Id.Equals(updateHotelComment.Id))
                    {
                        listHotelComment[i] = updateHotelComment;
                    }
                }
            }
            this.Context.RegisterModify <Hotel>(hotel);
            this.Context.Commit();
            return(HotelComments);
        }
Example #18
0
        /// <summary>
        /// 更新房间图片
        /// </summary>
        /// <param name="RoomImages"></param>
        /// <returns></returns>
        public List <RoomImage> UpdateRoomImage(Guid roomId, List <RoomImage> RoomImages)
        {
            JXHotelDbContext dbContext     = this.EFContext.dbContext as JXHotelDbContext;
            Room             room          = dbContext.Rooms.Find(roomId);
            List <RoomImage> listRoomImage = room.RoomImages;

            foreach (RoomImage updateRoomImage in RoomImages)
            {
                for (int i = 0; i < listRoomImage.Count; i++)
                {
                    if (listRoomImage[i].Id.Equals(updateRoomImage.Id))
                    {
                        listRoomImage[i] = updateRoomImage;
                    }
                }
            }
            // this.Context.RegisterModify<Room>(room);
            this.Update(room);
            this.Context.Commit();
            return(RoomImages);
        }
Example #19
0
        public List <Reservation> GetReservationsByUserName(string userName)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;

            return(dbContext.Customer.Where(new UserNameEqualsSpecification <Customer>(userName).GetExpression()).FirstOrDefault().Reservations);
        }
        /// <summary>
        /// 获取所有活动图片
        /// </summary>
        /// <returns></returns>
        public List <PromotionImage> GetPromotionImages(Guid PromotionId)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;

            return(dbContext.HotelPromotions.Find(PromotionId).PromotionImages);
        }
        /// <summary>
        /// 根据活动图片id获取活动图片
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public PromotionImage GetPromotionImageByKey(Guid PromotionId, Guid id)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;

            return(dbContext.HotelPromotions.Find(PromotionId).PromotionImages.Where(a => a.Id.Equals(id)).FirstOrDefault());
        }
Example #22
0
        /// <summary>
        /// 根据房间名称获取预定
        /// </summary>
        /// <param name="roomName"></param>
        /// <returns></returns>
        public List <Reservation> GetReservationsByRoomName(string roomName)
        {
            JXHotelDbContext dbContext = this.EFContext.dbContext as JXHotelDbContext;

            return(dbContext.Rooms.Where(new RoomNameEqualSpecification(roomName).GetExpression()).FirstOrDefault().Reservations);
        }