Пример #1
0
 public Form4(int guest_id, int room_id)
 {
     this.Guest = Guest.GetById(guest_id);
     this.Room  = Room.GetById(room_id);
     InitializeComponent();
     this.Load += Form4_Load;
 }
Пример #2
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();
        }
Пример #3
0
        private void ReserveRoom(int id)
        {
            MessageBox.Show("reserve");
            Room room = Room.GetById(id);

            if (room.isEmpty)
            {
                Form form3 = new Form3(id);
                form3.Show();
            }
            else
            {
                MessageBox.Show("This room is not empty");
            }
        }
Пример #4
0
        public Room Save()
        {
            Database db = new Database();
            Dictionary <string, string> data = new Dictionary <string, string>();

            data["room_number"]   = Room_Number.ToString();
            data["price_per_day"] = Price_Per_Day.ToString();
            data["room_capacity"] = Room_Capacity.ToString();
            data["floor"]         = Floor.ToString();
            data["is_empty"]      = isEmpty.ToString();
            data["room_type_id"]  = Room_Type.Id.ToString();
            db.Insert(TableName, data);

            //Solve this part more efficient way
            Database  db_1 = new Database();
            DataTable dt   = db_1.Read("SELECT MAX(id) FROM " + TableName);
            int       id   = Convert.ToInt32(dt.Rows[0][0].ToString());

            return(Room.GetById(id));
        }