private void frmRoomManagement_Load(object sender, EventArgs e) { cboThongTinPhongTang.Items.Add("1"); cboThongTinPhongTang.Items.Add("2"); cboThongTinPhongTang.Items.Add("3"); cboThongTinPhongTang.Items.Add("4"); cboThongTinPhongTang.Items.Add("5"); cboThongTinPhongTang.Items.Add("6"); cboThongTinPhongTang.Items.Add("7"); cboThongTinPhongTang.Items.Add("8"); cboThongTinPhongTang.Items.Add("9"); cboThongTinPhongTang.Items.Add("10"); cboThongTinPhongTang.Items.Add("11"); cboThongTinPhongTang.Items.Add("12"); //load lvw Danh Sách Phòng createColumnsListRoom(lvwDanhSachPhong); room = new clsRoom(); IEnumerable <Room> lstRoom = room.getALLRoom(); LoadRoomLenLvw(lvwDanhSachPhong, lstRoom); //load lvw Danh Sách Loại Phòng createColumnsRoomStyle(lvwDanhSachLoaiPhong); roomstyle = new clsStyleRoom(); IEnumerable <RoomStyle> lstRoomStyle = roomstyle.getALLRoomStyle(); LoadRoomStyleLenLvw(lvwDanhSachLoaiPhong, lstRoomStyle); //autocomlet // txtTimKiemThongTinPhong.AutoCompleteMode = AutoCompleteMode.Suggest; //txtTimKiemThongTinPhong.AutoCompleteSource = AutoCompleteSource.CustomSource; }
//event thêm vào Danh Sách Phòng private void btnThemPhong_Click(object sender, EventArgs e) { IEnumerable <Room> lstRoom = room.getALLRoom(); Room r = createRoom(); foreach (Room item in room.getALLRoom()) { if (txtThongTinPhongID.Text == item.id_Room) { MessageBox.Show("Trùng ID phòng!. Nhập lại", "Thông báo"); return; } } room.insertRoom(r); LoadRoomLenLvw(lvwDanhSachPhong, lstRoom); txtThongTinPhongID.Clear(); txtThongTinPhongSoPhong.Clear(); cboThongTinPhongTang.Text = ""; txtThongTinPhongTrangThai.Clear(); txtThongTinPhongLuuY.Clear(); txtThongTinIDLoaiPhong.Clear(); }