void Load_Room() { flowLayoutPanel_ROOM.Controls.Clear(); List <DTO.RoomDTO> listroom = RoomBUS.GetRooms(); int TableWidth = 370; int TableHeight = 175; try { foreach (DTO.RoomDTO item in listroom) { MetroFramework.Controls.MetroTile titRoom = new MetroFramework.Controls.MetroTile() { Width = TableWidth, Height = TableHeight }; flowLayoutPanel_ROOM.Controls.Add(titRoom); titRoom.Theme = MetroFramework.MetroThemeStyle.Light; titRoom.UseTileImage = true; titRoom.TileImageAlign = System.Drawing.ContentAlignment.MiddleCenter; titRoom.TileTextFontWeight = MetroFramework.MetroTileTextWeight.Regular; string stt = ""; if (item.Status == 0) { stt = "Available"; } else if (item.Status == 1) { stt = "Active"; } else { stt = "Fixing"; } titRoom.Text = item.Name + Environment.NewLine + stt; titRoom.Click += titRoom_Click; titRoom.Tag = item; //luu cai room cua minh vo tag, no la kiiu du lieu obj switch (item.Status) { case 0: titRoom.Style = MetroFramework.MetroColorStyle.Green; titRoom.TileImage = global::Karaoke.Properties.Resources.room; break; case 2: titRoom.Style = MetroFramework.MetroColorStyle.Silver; titRoom.TileImage = global::Karaoke.Properties.Resources.fix; break; default: titRoom.Style = MetroFramework.MetroColorStyle.Orange; titRoom.TileImage = global::Karaoke.Properties.Resources.kara; break; } if (item.Kind_Of_Room == 1) { titRoom.TileImage = global::Karaoke.Properties.Resources.vip; } } } catch (NullReferenceException) { MessageBox.Show("You don't have any room, let's add it now for start using !"); return; } }