Esempio n. 1
0
        private void UpdateRoom(DataGridViewRow row)
        {
            int id = Convert.ToInt32(row.Cells["id"].Value);

            Room room = Room.GetById(id);

            room.Room_Number   = Convert.ToInt32(row.Cells["room_number"].Value);
            room.Room_Capacity = Convert.ToInt32(row.Cells["room_capacity"].Value);
            room.Price_Per_Day = Convert.ToInt32(row.Cells["price_per_day"].Value);
            room.Floor         = Convert.ToInt32(row.Cells["floor"].Value);
            room.Room_Type     = RoomType.GetById(Convert.ToInt32(row.Cells["room_type_id"].Value));
            room.isEmpty       = Convert.ToBoolean(row.Cells["is_empty"].Value);
            room.Update();
        }
Esempio n. 2
0
        public static Room GetById(int id)
        {
            Database  db = new Database();
            DataTable dt = db.Read("Select * from " + TableName + " WHERE id=" + id);

            Room room = new HotelManagement.Room();
            var  data = dt.Rows[0];

            room.Id            = id;
            room.Price_Per_Day = Convert.ToInt32(data["price_per_day"]);
            room.Room_Capacity = Convert.ToInt32(data["room_capacity"]);
            room.Room_Type     = RoomType.GetById(Convert.ToInt32(data["room_type_id"]));
            room.isEmpty       = Convert.ToBoolean(data["is_empty"]);

            return(room);
        }
Esempio n. 3
0
        private void room_save_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Click");
            //Create new room
            Room room = new Room();
            room.Id = Convert.ToInt32(this.room_number.Text);
            room.Room_Capacity = Convert.ToInt32(this.room_capacity.Text);
            room.Room_Number = Convert.ToInt32(this.room_capacity.Text);
            room.Price_Per_Day = Convert.ToInt32(this.price_per_day.Text);
            room.Floor = Convert.ToInt32(this.floor.Text);
            room.Room_Type =RoomType.GetById( Convert.ToInt32(room_types.SelectedValue));
            room.Save();
            //Form2 form2 = new Form2();
           // form2.Show();
            this.Close();


        }