private void btnAdd_Click(object sender, EventArgs e) { var addFrm = new AddBorrowForm(); addFrm.AddBorrow += AddFrm_AddBorrow; this.Hide(); addFrm.ShowDialog(); this.Show(); }
private void btnUpdate_Click(object sender, EventArgs e) { if (gvBorrows.SelectedRows.Count > 0) { BorrowDTO br = new BorrowDTO(); br.BorrowID = (string)gvBorrows.SelectedRows[0].Cells["maphieumuon"].Value; br.ReaderID = (string)gvBorrows.SelectedRows[0].Cells["madocgia"].Value; br.BookID = (string)gvBorrows.SelectedRows[0].Cells["masach"].Value; br.BorrowedDate = (DateTime)gvBorrows.SelectedRows[0].Cells["ngaymuon"].Value; br.ReturnDate = (DateTime)gvBorrows.SelectedRows[0].Cells["hantra"].Value; var addFrm = new AddBorrowForm(); addFrm.update = true; addFrm.borrow = br; addFrm.AddBorrow += AddFrm_AddBorrow; this.Hide(); addFrm.ShowDialog(); this.Show(); } else { MessageBox.Show("Select a row to update, pls!"); } }