コード例 #1
0
ファイル: RoomList.cs プロジェクト: xuanvinhtd/MotelManage
        private void btAdd_Click(object sender, EventArgs e)
        {
            Room newRoom = new Room();

            this.Hide();

            RoomEdit editform = new RoomEdit(newRoom, 2);
            editform.Show();
        }
コード例 #2
0
ファイル: RoomList.cs プロジェクト: xuanvinhtd/MotelManage
        private void btEdit_Click(object sender, EventArgs e)
        {
            if (gridRoomList.Rows.Count > 1)
            {
                rowIndex = this.gridRoomList.CurrentCell.RowIndex;

                if ((rowIndex < gridRoomList.RowCount - 1) && (rowIndex >= 0))
                {

                    Room editRoom = new Room();

                    editRoom.Id = gridRoomList.Rows[rowIndex].Cells[0].Value.ToString();
                    editRoom.Name = gridRoomList.Rows[rowIndex].Cells[1].Value.ToString();

                    editRoom.StatusID = gridRoomList.Rows[rowIndex].Cells[2].Value.ToString();
                    editRoom.RoomType = gridRoomList.Rows[rowIndex].Cells[3].Value.ToString();

                    this.Hide();

                    RoomEdit editform = new RoomEdit(editRoom, 1);
                    editform.Show();
                }
            }else
             {
                 MessageBox.Show("No row selected!");
             }
        }