示例#1
0
 private void cboLuaChonTra_SelectedValueChanged(object sender, EventArgs e)
 {
     if (cboLuaChonTra.SelectedValue == null)
     {
         return;
     }
     if (this.user.LoaiTaiKhoan == 1)
     {
         dt = BUS_OBJ.loadTTPhieuMuonTheoMaTheVaMaSach(txtMaThe.Text, cboLuaChonTra.SelectedValue.ToString());
     }
     else
     {
         dt = BUS_OBJ.loadTTPhieuMuonTheoMaTheVaMaSach(user.TenDangNhap, cboLuaChonTra.SelectedValue.ToString());
     }
     if (dt.Rows.Count != 0)
     {
         lbSoPhieu.Text = dt.Rows[0].Field <Int32>(0).ToString();
         lbMaThe.Text   = dt.Rows[0].Field <string>(1).ToString();
         lbMaSach.Text  = dt.Rows[0].Field <string>(2).ToString();
         try
         {
             string   chuoiNgayMuon = dt.Rows[0].Field <DateTime>(3).ToString();
             DateTime ngayMuon      = new DateTime();
             DateTime.TryParse(chuoiNgayMuon, out ngayMuon);
             dtpNgayMuon.Value = ngayMuon;
         }
         catch (Exception ex)
         {
             MetroFramework.MetroMessageBox.Show(this, ex.Message);
         }
         try
         {
             string   chuoiNgayTra = dt.Rows[0].Field <DateTime>(4).ToString();
             DateTime ngayTra      = new DateTime();
             DateTime.TryParse(chuoiNgayTra, out ngayTra);
             dtpNgayTra.Value = ngayTra;
         }
         catch (Exception ex)
         {
             MetroFramework.MetroMessageBox.Show(this, ex.Message);
         }
         cboTinhTrang.SelectedItem = dt.Rows[0].Field <string>(5).ToString();
         rtbGhiChu.Text            = dt.Rows[0].Field <string>(6).ToString();
         try
         {
             tltTenSach.SetToolTip(lbMaSach, BUS_OBJ.layTenSach(lbMaSach.Text));
             tltTenChuThe.SetToolTip(lbMaThe, BUS_OBJ.layTenDocGia(lbMaThe.Text));
         }
         catch (Exception ex)
         {
             MetroFramework.MetroMessageBox.Show(this, ex.Message);
         }
     }
 }