private void sbtnSuaDG_Click(object sender, EventArgs e) { if (str == "1") { PhieuMuon pm = new PhieuMuon(); pm.ma = grvDocGia.GetFocusedRowCellValue("Mã phiếu").ToString(); pm.docgiama = grvDocGia.GetFocusedRowCellValue("Mã độc giả").ToString(); pm.ngaymuon = DateTime.Parse(grvDocGia.GetFocusedRowCellValue("Ngày mượn").ToString()); pm.hantra = DateTime.Parse(grvDocGia.GetFocusedRowCellValue("Hạn trả").ToString()); pm.phathong = 0; pm.phatmat = 0; pm.phatquahan = 0; pm.ngaytra = DateTime.Now; string str1 = pm.ma + "_" + pm.docgiama + "_" + pm.ngaymuon + "_" + pm.ngaytra + "_" + pm.hantra + "_" + pm.phathong + "_" + pm.phatmat + "_" + pm.phatquahan; frmUpdate frm = new frmUpdate(str1); frm.ShowDialog(); grcDSDocGia.DataSource = da.Query("DanhSachPhieuMuon"); } else { DocGia docgia = new DocGia(); docgia.ma = grvDocGia.GetFocusedRowCellValue("ma").ToString(); docgia.ten = grvDocGia.GetFocusedRowCellValue("ten").ToString(); docgia.ngaysinh = DateTime.Parse(grvDocGia.GetFocusedRowCellValue("ngaysinh").ToString()); if (bool.Parse(grvDocGia.GetFocusedRowCellValue("gioitinh").ToString()) == true) { docgia.gioitinh = true; } //sach.tinhtrang = true; else { docgia.gioitinh = false; } docgia.diachi = grvDocGia.GetFocusedRowCellValue("diachi").ToString(); docgia.ngaylamthe = DateTime.Parse(grvDocGia.GetFocusedRowCellValue("ngaylamthe").ToString()); docgia.ngayhethan = DateTime.Parse(grvDocGia.GetFocusedRowCellValue("ngayhethan").ToString()); if (bool.Parse(grvDocGia.GetFocusedRowCellValue("hoatdong").ToString()) == true) { docgia.hoatdong = true; } //sach.tinhtrang = true; else { docgia.hoatdong = false; } EditReader editreader = new EditReader(docgia); editreader.ShowDialog(); listDocGia = controller.getListDocGia(); grcDSDocGia.DataSource = listDocGia; } }
private void ReaderDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { String selectedList = GetCheckedRefPeople(); if (selectedList != null) { EditReader editReader = new EditReader(selectedList); editReader.DataContext = ReaderDataGrid.SelectedItem; editReader.ShowDialog(); } else { //DeleteButton.IsEnabled = false; MessageBox.Show("id is null"); } //editReader.txtName.Text = Convert.ToString(this.name); //editReader.txtPhone.Text = Convert.ToString(this.phone); //editReader.txtDescription.Text = Convert.ToString(this.description); }
private void Click_Button2(object sender, RoutedEventArgs e) { EditReader wind = new EditReader(); wind.Show(); }