private void btAdd_Click(object sender, EventArgs e) { RoomBook newRoomBook = new RoomBook(); this.Hide(); RoomBookEdit editform = new RoomBookEdit(newRoomBook, 2); editform.Show(); }
private void btEdit_Click(object sender, EventArgs e) { //KO cho edit Cai da het han // // // if (gridRoomBook.Rows.Count > 1) { rowIndex = this.gridRoomBook.CurrentCell.RowIndex; if ((rowIndex < gridRoomBook.RowCount - 1) && (rowIndex >= 0)) { RoomBook editRoomBook = new RoomBook(); editRoomBook.Id = gridRoomBook.Rows[rowIndex].Cells[0].Value.ToString(); editRoomBook.Begindate = gridRoomBook.Rows[rowIndex].Cells[1].Value.ToString(); editRoomBook.Enddate = gridRoomBook.Rows[rowIndex].Cells[2].Value.ToString(); editRoomBook.Roomid = gridRoomBook.Rows[rowIndex].Cells[3].Value.ToString(); editRoomBook.Customerid = gridRoomBook.Rows[rowIndex].Cells[4].Value.ToString(); editRoomBook.RoomBookStatusid = gridRoomBook.Rows[rowIndex].Cells[5].Value.ToString(); if (editRoomBook.RoomBookStatusid == "Da het han") { //ko cho edit ......... } editRoomBook.Note = gridRoomBook.Rows[rowIndex].Cells[6].Value.ToString(); editRoomBook.Deposit = Convert.ToDecimal(gridRoomBook.Rows[rowIndex].Cells[7].Value); this.Hide(); RoomBookEdit editform = new RoomBookEdit(editRoomBook, 1); editform.Show(); } } else { MessageBox.Show("Not Select"); } }