public int FilishedRoom(hotel_room_info r)
 {
     DateTime start = DateTime.Now.Date; DateTime end = DateTime.Now.AddYears(1).Date; bool re = false;
     //var rooms = (from h in db.rooms where h.hotel_id == hotelId && h.DefaultPrice > 0 select h).ToList();
     //foreach (var r in rooms)
     //{
         hotel_room_RP_price_info p = new hotel_room_RP_price_info() { room_rp_start_time = start, room_rp_end_time = end,room_rp_price=r.DefaultPrice,hotel_id=r.hotel_id,room_id=r.room_id};
         if (new Hotel_room_RP_price_batch().InsertPriceBatch(p) && new RoomStatus_batch().insertStatuBatch(p))
         {
             re = true; ;// DBhelp.CallProc(p.room_id, "proc_hotel_room_ebeds_batch_roomid"); DBhelp.CallProc(p.room_id, "proc_hotel_room_RP_price_batch_roomid");
         }
         result = re == true ? 1 : 0;
         return result;
 }
Example #2
0
        public void GetData(string hotelId)
        {

            int hotel_id;
            int.TryParse(hotelId, out hotel_id);
            string u_id = "test1";
           // GetData();
            //所有酒店列表
            ViewData["rooms"] = new hotel_room_info().getRoomsByHoltelId(hotel_id);
            //所有酒店对应的房型列表
            
            // ViewData["drrModes"] = help.HotelInfoHelp.getDrrModeList(u_id);
            ViewData["drrs"] = new DrrRules().getDrrsByHoltelId(hotel_id);
            ViewBag.Id = hotel_id;

        }
 public void getRooms(int hotel_id)
 {
     //List<hotel_room_info> roomsList = (from r in db.room where r.hotel_id == hotel_id select r).ToList();
     ViewData["rooms"] = DBhelp.getRooms(hotel_id);
     ViewData["bedTypes"] = new hotel_room_info().getBedType();
 }
        public ActionResult RoomSubmit(hotel_room_info hotel_room_info)
        {

            int sign = 0;
            string guid=Guid.NewGuid().ToString();
            if (hotel_room_info.room_id > 0)
            {

                sign = hotel_room_info.updateRoom(hotel_room_info) == true ? 1 : 0; ;

            }
            else
            {

                hotel_room_info.h_r_id = guid;
                hotel_room_info.h_r_utime = DateTime.Now;
                hotel_room_info.h_r_ctime = DateTime.Now;
                hotel_room_info.h_r_state = true;
                hotel_room_info.h_r_reserve = 3;
                var errors = ModelState.Values.SelectMany(v => v.Errors);
                db.rooms.Add(hotel_room_info);
                sign = db.SaveChanges() > 0 ? 1 : 0;
                sign=sign > 0 ? FilishedRoom((from r in db.rooms where r.h_r_id==guid select r).SingleOrDefault()) : 0;
                
            }

           
            ViewBag.sign = 2;
            ViewBag.Tag = "增加房型";
            helpData(hotel_room_info.hotel_id);
            return View("Room", new hotel_room_info());
        }
        /// <summary>
        /// //匹配房型
        /// </summary>
        /// <param name="roomId"></param>
        /// <param name="name"></param>
        /// <param name="hotelId"></param>
        /// <returns></returns>
        public ActionResult selectedRoom(string roomId, string name, string hotelId)
        {
            int room_id = 0; int.TryParse(roomId, out room_id);//   int hotel_id = Convert.ToInt32(hotelId);
            int hotel_Id = 0; int.TryParse(hotelId, out hotel_Id);
            hotel_room_info room = new hotel_room_info();
            using (db = new HotelDBContent())
            {

                room = (from r in db.rooms where r.room_id == room_id select r).SingleOrDefault();
                //var tempRoom = ((from o in db.rooms where o.h_r_name_cn == name.Trim() && o.hotel_id == hotel_Id select o).Count());
                //ViewBag.exit = tempRoom > 0 ? 1 : 0;

            }

            helpData(hotel_Id);
            if (room != null)
                return View("MyRoom", room);
            else
                return View("MyRoom", new hotel_room_info());
        }
Example #6
0
        public ActionResult Create(hotel_room_info hotel_room_info)
        {

            int sign = 0;
            if ( hotel_room_info.room_id> 0)
            {

                sign = hotel_room_info.updateRoom(hotel_room_info) == true ? 1 : 0; ;
                
            }
            else
            {
                hotel_room_info.h_r_id = "004";
                hotel_room_info.h_r_utime = DateTime.Now;
                hotel_room_info.h_r_ctime = DateTime.Now;            
                hotel_room_info.h_r_state = true;
                hotel_room_info.h_r_reserve = 3;
                var errors = ModelState.Values.SelectMany(v => v.Errors);
                db.rooms.Add(hotel_room_info);
                sign = db.SaveChanges()>0? 1 : 0; ;
            }
           
            getfacilities();
            getRooms(hotel_room_info.hotel_id);
            ViewBag.HoltelId = hotel_room_info.hotel_id;
            ViewBag.Tag = "增加房型";
            getRooms(hotel_room_info.hotel_id);
            ViewBag.sign = sign;
          
            return View(new hotel_room_info());
        }
Example #7
0
        /// <summary>
        /// //匹配房型
        /// </summary>
        /// <param name="roomId"></param>
        /// <param name="name"></param>
        /// <param name="hotelId"></param>
        /// <returns></returns>
        public ActionResult selectedRoom(string roomId, string hotelId)
        {
            int room_id = 0; int.TryParse(roomId, out room_id);//   int hotel_id = Convert.ToInt32(hotelId);
            int hotel_Id = 0; int.TryParse(hotelId, out hotel_Id);
            hotel_room_info room = new hotel_room_info();
            using (db = new HotelDBContent())
            {

                room = (from r in db.rooms where r.room_id == room_id select r).SingleOrDefault();
                room.room_id = 0; room.hotel_id = 0;
                string tempBed = string.Empty;
                if (!string.IsNullOrEmpty(room.h_r_bed_type))
                {
                   string []beds= room.h_r_bed_type.Split(',');
                   for (int i = 0; i < beds.Length; i++)
                   {
                       tempBed += beds[i].Contains("|") ? beds[i] : beds[i] + "|" + 1+",";
                   }
                }
                room.h_r_bed_type = tempBed.LastIndexOf(",") != -1 ? tempBed.Substring(0, tempBed.Length - 1) : tempBed;
                var tempRoom = ((from o in db.rooms where o.h_r_name_cn == room.h_r_name_cn.Trim() && o.hotel_id == hotel_Id select o).Count());
                ViewBag.exit = tempRoom > 0 ? 0 : 1;

            }
            helpdata(hotel_Id);
            if(room!=null)
             return View("MyRoom", room);
            else
              return View("MyRoom", new hotel_room_info());
        }
Example #8
0
        public ActionResult Create(hotel_room_info hotel_room_info)
        {
           
            int sign = 0;
            if (hotel_room_info.room_id > 0)
            {
                
                sign = hotel_room_info.updateRoom(hotel_room_info) == true ? 1 : 0; ;

            }
            else
            {
                hotel_room_info.h_r_id = "004";
                hotel_room_info.h_r_utime = DateTime.Now;
                hotel_room_info.h_r_ctime = DateTime.Now;
                hotel_room_info.h_r_state = true;
                hotel_room_info.h_r_reserve = 3;
                var errors = ModelState.Values.SelectMany(v => v.Errors);
                db.rooms.Add(hotel_room_info);
                sign = db.SaveChanges() > 0 ? 1 : 0; ;
            }

            helpdata(hotel_room_info.hotel_id);
           
            ViewBag.sign = 2;

            return View("MyRoom",new hotel_room_info());
        }
Example #9
0
        /// <summary>
        /// 修改房型
        /// </summary>
        /// <param name="room_id"></param>
        /// <param name="hotel_room_info"></param>
        /// <returns></returns>
        public bool updateRoom(hotel_room_info hotel_room_info)
        {
            bool result = false;
            try
            {
                using (DBC.HotelDBContent db = new DBC.HotelDBContent())
                {
                    var room = (from r in db.rooms where r.room_id == hotel_room_info.room_id select r).Single();
                    if (room != null)
                    {
                        room.h_r_name_cn = hotel_room_info.h_r_name_cn;
                        room.h_r_bed_type = hotel_room_info.h_r_bed_type;
                        room.h_r_description_cn = hotel_room_info.h_r_description_cn;
                        room.h_r_floor = hotel_room_info.h_r_floor;
                        room.Comments = hotel_room_info.Comments;
                        room.house_service = hotel_room_info.house_service;

                        room.sitting_room_number = hotel_room_info.sitting_room_number;
                        room.study = hotel_room_info.study;
                        room.h_r_bathroom_number = hotel_room_info.h_r_bathroom_number;
                        room.KitchenNumber = hotel_room_info.KitchenNumber;
                        room.Balcony = hotel_room_info.Balcony;
                       
                        room.h_r_bedroom_number = hotel_room_info.h_r_bedroom_number;

                        room.h_r_utime = DateTime.Now;
                        room.h_r_people_number = hotel_room_info.h_r_people_number;
                        room.h_r_house_number = hotel_room_info.h_r_house_number;
                      
                        room.h_r_acreage = hotel_room_info.h_r_acreage;
                        room.defaultPrice = hotel_room_info.DefaultPrice;
                        result = db.SaveChanges() > 0 ? true : false; ;
                    }
                }
            }
            catch (Exception)
            {
                result = false;
                throw;
            }
            return result;
           
        }