/// <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; }
//修改房价 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)); }