예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length == 0)
     {
         MessageBox.Show("Mã mượn trả không được trống");
         return;
     }
     if (docGiaBLL.TraSach(Int32.Parse(textBox1.Text)) == 1)
     {
         MessageBox.Show("Đã trả sách thành công");
         Close();
     }
     else if (docGiaBLL.TraSach(Int32.Parse(textBox1.Text)) == 0)
     {
         MessageBox.Show("Sách này chưa được mượn");
     }
     else
     {
         MessageBox.Show("Sách đã được trả");
     }
 }
 private void onClickTraSach(object sender, EventArgs e)
 {
     if (listViewSachDangMuon.SelectedItems.Count > 0)
     {
         ListViewItem lvi          = listViewSachDangMuon.SelectedItems[0];
         SachDangMuon sachDangMuon = lvi.Tag as SachDangMuon;
         if (docGiaBLL.TraSach(sachDangMuon.maSach))
         {
             //Huynh load lại sach da tra
             LoadThongTinChiTietDocGia();
         }
         else
         {
             MessageBox.Show("Trả sách thất bại");
         }
     }
     else
     {
         MessageBox.Show("Bạn phải chọn 1 độc giả");
     }
 }
 private void TrasachKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (docGiaBLL.KiemTraXemSachCoTonTaikhong(txtBoxTraSach.Text))
         {
             MessageBox.Show("Sách này không tồn tại");
             Close();
             return;
         }
         if (!docGiaBLL.TraSach(txtBoxTraSach.Text))
         {
             MessageBox.Show("Sách này chưa được mượn");
             Close();
         }
         else
         {
             MessageBox.Show("Đã trả sách thành công");
         }
     }
 }