Esempio n. 1
0
 /// <summary>
 /// 根据房间类型id获取房间类型列表
 /// </summary>
 /// <param name="typeid"></param>
 /// <returns></returns>
 public List <RoomType> GetRoomTypeListByTypeId(int typeid)
 {
     return(hotelService.GetRoomTypeListByTypeId(typeid));
 }
Esempio n. 2
0
        /// <summary>
        /// 入住登记
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public string Add(Customer user)
        {
            string message = string.Empty;

            List <Room> rooms = roomSV.GetRoomDetailByRoomNumber(user.RoomId);

            if (rooms.Count == 0)
            {
                message = "-1";// 房间不存在!
            }
            else
            {
                if (rooms[0].State != "空闲")
                {
                    message = "-2";//当前房间不是空闲状态
                }
                else
                {
                    if (this.GetListIsNoPay(user.RoomId).Count > 0)
                    {
                        message = "-3";//当前房间未结清
                    }
                    else
                    {
                        RoomType roomTypeDetail = roomTypeSV.GetRoomTypeListByTypeId(Convert.ToInt32(rooms[0].TypeID))[0];

                        double roomPrice   = roomTypeDetail.TypePrice;
                        double addBedPrice = roomTypeDetail.AddBedPrice;


                        TimeSpan dateDif = user.CheckoutDate.Subtract(user.CheckinDate);
                        int      days    = dateDif.Days;
                        if (days == 0)
                        {
                            days = 1;
                        }
                        int charge = Convert.ToInt32(days * roomPrice);



                        if (user.IsAddBed == "是")
                        {
                            charge += Convert.ToInt32(days * addBedPrice);
                        }

                        user.Charge = charge;


                        if (curstomerSV.Add(user) > 0)
                        {
                            message = charge.ToString();

                            roomSV.UpdateRoomState(user.RoomId, "入住");
                        }
                        else
                        {
                            message = "0";
                        }
                    }
                }
            }
            return(message);
        }