예제 #1
0
 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;
 }
예제 #2
0
       /// <summary>
       /// 插入价格
       /// </summary>
       /// <param name="p"></param>
       /// <returns></returns>
        public bool InsertPriceBatch(hotel_room_RP_price_info p)
        {
            bool result = false;
            try
            {
                using (DBC.HotelDBContent db = new DBC.HotelDBContent())
                {
                    Hotel_room_RP_info rp = new Hotel_room_RP_info();
                    rp.h_room_rp_name_cn = "标准价";
                    rp.hotel_id = p.hotel_id;
                    Hotel_room_RP_price_batch pBacth = new Hotel_room_RP_price_batch();
                    pBacth.Addbed = -1;
                    pBacth.HpStatus = 0;
                    pBacth.Room_rp_id = help.HotelInfoHelp.getRatePlanId(rp);
                    DateTime start = p.room_rp_start_time; DateTime end = p.room_rp_end_time;
                    pBacth.Room_rp_start_time = start;
                    pBacth.Room_rp_end_time = end;
                    pBacth.Room_id = p.room_id;
                    pBacth.Hotel_id = p.hotel_id;
                    pBacth.Price = p.room_rp_price;
                    pBacth.Idate = DateTime.Now;
                    pBacth.Hpdate = DateTime.Now;
                    pBacth.AuditDate = DateTime.Now;
                    db.publicPrices.Add(pBacth);
                    result=db.SaveChanges()>0?true:false;
                     //DBhelp.CallProc(p.room_id, "proc_hotel_room_RP_price_batch_roomid");

                }

            }
            catch (Exception e)
            {
                result = false;
                
            }
        return result;
        }
예제 #3
0
        public int priceSubmit(hotel_room_RP_price_info hotel_room_rp_price_info)
        {
            //Hotel_room_RP_price_batch pBacth = new Hotel_room_RP_price_batch();
            //pBacth.Addbed = -1;
            //pBacth.HpStatus = 0;
            //pBacth.Room_rp_id = help.HotelInfoHelp.getRatePlanId(hotel_room_rp_price_info);
            //DateTime start = DateTime.Now.Date; DateTime end = DateTime.Now.AddYears(1).Date;
            //pBacth.Room_rp_start_time = start;
            //pBacth.Room_rp_end_time = end;
            //pBacth.Room_id = p.room_id;
            //pBacth.Hotel_id = p.hotel_id;
            //pBacth.Price = p.room_rp_price;
            //pBacth.Idate = DateTime.Now;
            //pBacth.Hpdate = DateTime.Now;
            //pBacth.AuditDate = DateTime.Now;

            //if (DBhelp.ExcuteTableBySQL(sql) > 0)
            //    return 1;
            //else
            //    return 0;
            //if (ModelState.IsValid)
            //{
            //    //db.Entry(hotel_room_rp_price_info).State = EntityState.Modified;
            //    db.SaveChanges();
            //    return RedirectToAction("Index");
            //}
            //return View(hotel_room_rp_price_info);
            return 0;
        }
예제 #4
0
        //修改房价
        public int uPrice(string id, string roomId, string startDate, string EndDate, string value)
        {

            int Id, room_id, count = 0; decimal price;  decimal.TryParse(value, out price); int.TryParse(id, out Id);  int.TryParse(roomId, out room_id); DateTime.TryParse(startDate, out start);  DateTime.TryParse(EndDate, out end);
            hotel_room_RP_price_info p = new hotel_room_RP_price_info();
            using (db = new HotelDBContent())
            {
                count = (from r in db.rooms where r.hotel_id == Id && r.room_id == room_id select r).Count();
            }
            if (count > 0)
             result = new Hotel_room_RP_price_batch().InsertPriceBatch(new hotel_room_RP_price_info() { hotel_id = Id, room_id = room_id, room_rp_start_time = start, room_rp_end_time = end, room_rp_price = price }) == true && DBhelp.CallProc(room_id, "proc_hotel_room_RP_price_batch_roomid") == true ? 1 : 0;
            //  result = new Hotel_room_RP_price_batch().InsertPriceBatch(new hotel_room_RP_price_info() { hotel_id = Id, room_id = room_id, room_rp_start_time = start, room_rp_end_time = end, room_rp_price = price }) == true && DBhelp.CallProc(room_id, "proc_hotel_room_RP_price_batch_roomid") == true ? 1 : 0;
              
            return result;
           // return View("MyPrix", getData(id, startDate, EndDate));
        }
예제 #5
0
        /// <summary>
        /// 房态首次数据插入
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public bool insertStatuBatch(hotel_room_RP_price_info p)
        {
            bool result = false;
  
            try
            {
              using(DBC.HotelDBContent db=new DBC.HotelDBContent())
              {
                RoomStatus_batch roomStatus = new RoomStatus_batch();
                roomStatus.r_s_time = p.room_rp_start_time;
                roomStatus.EndDate = p.room_rp_end_time;
                roomStatus.room_id = p.room_id;
                roomStatus.hotel_id = p.hotel_id;
                roomStatus.OverBooking = true;
                roomStatus.HpStatus = 0;
                roomStatus.r_s_status = true;
                roomStatus.r_s_utime = DateTime.Now;
                roomStatus.r_s_ctime = DateTime.Now;
                string number = (from r in db.rooms where r.room_id == p.room_id select r.h_r_house_number).SingleOrDefault(); int roomNubmer; int.TryParse(number, out roomNubmer);
                roomStatus.r_s_number = roomNubmer;
                roomStatus.eBeds = roomNubmer;
                db.publicStatuses.Add(roomStatus);
                result = db.SaveChanges() > 0 ? true : false;
               
                 // DBhelp.CallProc(roomStatus.room_id, "[proc_hotel_room_ebeds_batch_roomid]");
              //}
             }

            }
            catch (Exception e)
            {
                help.DBhelp.log("插入Roombatch" + e.ToString());
                result = false;
            }
            return result;          
        }