Beispiel #1
0
 partial void UpdateTable_Hotel(Table_Hotel instance);
Beispiel #2
0
 partial void DeleteTable_Hotel(Table_Hotel instance);
Beispiel #3
0
 partial void InsertTable_Hotel(Table_Hotel instance);
Beispiel #4
0
    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");

        }
    }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             Room = dbc.GetRoomByHotelId(Convert.ToInt32(Request["hotelId"]));
             hotel = dbc.GetHotelById(Convert.ToInt32(Request["hotelId"]));
             price = dbc.GetHotelPrice(Convert.ToInt32(Request["hotelId"]));
             var q = from s in data.Table_Comment
                     where s.HotelId == hotel.Id
                     select s;
             comment = q.ToList();
             AvaRating = 0;
             if (comment.Count != 0)
             {
                 foreach (Table_Comment c in comment)
                     AvaRating += c.Score;
                 AvaRating /= comment.Count;
             }
             AvaRatingString = Rating(AvaRating);
             CheckIn = Request["CheckIn"];
             CheckOut = Request["CheckOut"];
             RoomNum = Convert.ToInt32(Request["RoomNum"]);
             GuestNum = Convert.ToInt32(Request["GuestNum"]);
             TotalRoomNum = 0;
             foreach (Table_Room r in Room)
             {
                 TotalRoomNum += r.TotalNumber;
             }
         }
         catch (Exception) { }
         Calendar1.SelectedDate = System.DateTime.Now;
         Calendar2.SelectedDate = System.DateTime.Now.AddDays(1);
         Button2.Text = Calendar1.SelectedDate.ToString("yyyy/MM/dd");
         Button3.Text = Calendar2.SelectedDate.ToString("yyyy/MM/dd");
         Label1.Text = CheckIn;
         Label2.Text = CheckOut;
         Label3.Text = RoomNum.ToString() + "Room," + GuestNum.ToString() + "Guest";
     }
 }
Beispiel #6
0
 //添加新酒店
 public void AddHotel(Table_Hotel hotel)
 {
     data.Table_Hotel.InsertOnSubmit(hotel);
     data.SubmitChanges();
 }
Beispiel #7
0
    //更新酒店信息
    public void UpdateHotel(Table_Hotel hotel)
    {
        var q = from s in data.Table_Hotel
                where s.Id==hotel.Id
                select s;
        foreach (Table_Hotel c in q)
        {
            c.Address = hotel.Address;
            c.ContactNumber = hotel.ContactNumber;
            c.ImageUrl = hotel.ImageUrl;
            c.Name = hotel.Name;
            c.StarLevel = hotel.StarLevel;

        }
        data.SubmitChanges();
    }