partial void DeleteTable_Room(Table_Room instance);
private void detach_Table_Room(Table_Room entity) { this.SendPropertyChanging(); entity.Table_Hotel = null; }
partial void UpdateTable_Room(Table_Room instance);
partial void InsertTable_Room(Table_Room instance);
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { reservation = (Table_HotelReservation)Session["Reservation"]; if (reservation.Id != -1) { TextBox1.Text = reservation.name.Substring(0, reservation.name.IndexOf(".", 0)); TextBox2.Text = reservation.name.Substring(reservation.name.IndexOf(".", 0) + 1, reservation.name.Length - reservation.name.IndexOf(".", 0) - 1); TextBox3.Text = reservation.PhoneNum.ToString(); TextBox5.Text = reservation.EmailAddress; if (reservation.sex == "male") DropDownList1.SelectedIndex = 0; else DropDownList1.SelectedIndex = 1; } //如果用户已经登陆则textbox1-5依次填入用户信息。 else if (Session["Customer"] != null) { Table_Customer customer = dbc.GetCustomer(Session["Customer"].ToString()); TextBox1.Text = customer.FirstName; TextBox2.Text = customer.LastName; TextBox3.Text = customer.PhoneNumber; TextBox5.Text = customer.EmailAddress; if (customer.Sex == "male") DropDownList1.SelectedIndex = 0; else DropDownList1.SelectedIndex = 1; TextBox1.Enabled = TextBox2.Enabled = TextBox3.Enabled = TextBox5.Enabled = false; DropDownList1.Enabled = false; } //如果用户没有登陆,则textbook1-5为空 //加载右边订单信息 hotel = dbc.GetHotelById(reservation.HotelId); room = dbc.GetRoomByHotelIdAndRoomType(reservation.HotelId, reservation.RoomType); TimeSpan t=reservation.CheckOut-reservation.CheckIn; // Label10.Text = "$" + room.FullRate.ToString(); Label1.Text = t.Days.ToString(); Label2.Text = reservation.RoomNum.ToString(); Label3.Text = reservation.GuestNum.ToString(); Label4.Text = "$" + reservation.Value.ToString(); Label_cost.InnerText = "$" + reservation.Value.ToString(); Label5.Text = hotel.Name; Label6.Text = hotel.Address; Label7.Text = reservation.RoomType; Label8.Text = reservation.CheckIn.ToString("yyyy/MM/dd"); Label9.Text = reservation.CheckOut.ToString("yyyy/MM/dd"); } }
//添加新房间 public void AddRoom(Table_Room room) { data.Table_Room.InsertOnSubmit(room); data.SubmitChanges(); }
//更新房间信息 public void UpdateRoom(Table_Room room) { var q = from s in data.Table_Room where s.HotelId == room.HotelId && s.RoomType == room.RoomType select s; foreach (Table_Room c in q) { c.Capacity = room.Capacity; c.FullRate = room.FullRate; c.TotalNumber = room.TotalNumber; } data.SubmitChanges(); }