/// <summary> /// 修改用户 /// </summary> /// <param name="room_id"></param> /// <param name="hotel_room_info"></param> /// <returns></returns> public int updateUser(Merchant_info mer) { int result = 0; try { using (DBC.HotelDBContent db = new DBC.HotelDBContent()) { var merchant = (from m in db.Merchant_infos where m.id == mer.id select m).Single(); if (merchant != null) { //Merchant_info m = new Merchant_info(); // string f = mer.password != "******" ? new help.HotelInfoHelp().Md5(mer.password) : merchant.password; merchant.utime = DateTime.Now; merchant.password = mer.password != "******" ? new help.HotelInfoHelp().Md5(mer.password) : merchant.password; merchant.utime = DateTime.Now; merchant.name = mer.name; merchant.tel = mer.tel; merchant.Sex = mer.Sex; merchant.startTime = mer.startTime; merchant.endTime = mer.endTime; merchant.limit = mer.limit; merchant.limitName = mer.limitName; merchant.limitHotelId = mer.limitHotelId; merchant.limitHotelName = mer.limitHotelName; result = db.SaveChanges() > 0 ? 1 : 0; ; } } } catch (Exception) { result = 0; throw; } return result; }
/// <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; }
/// <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; }
public bool insertStatuBatch(RoomStatus_batch roomStatus) { bool result = false; try { using(DBC.HotelDBContent db=new DBC.HotelDBContent()) { //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.r_s_status = true; roomStatus.HpStatus = 0; roomStatus.AuditDate = DateTime.Now; roomStatus.r_s_utime = DateTime.Now; roomStatus.r_s_ctime = DateTime.Now; db.publicStatuses.Add(roomStatus); result = db.SaveChanges() > 0 ? true : false; if (result) DBhelp.CallProc(roomStatus.room_id, "[proc_hotel_room_ebeds_batch_roomid]"); } } catch (Exception e) { help.DBhelp.log("插入Roombatch" + e.ToString()); result = false; } return result; }
/// <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; }