public ShowBookForm(string idbuku) { buku currentBook = new buku(); koneksiSql sql = new koneksiSql(); currentBook = sql.returnBuku(idbuku); InitializeComponent(); txtTitle.Text = currentBook.title; txtAuthor.Text = currentBook.author; string[] temp = currentBook.path.Split('|'); for (int i = 0; i < temp.Count(); i++) { temp[i] = utilitas.strukturFolder("buku") + temp[i]; } listGambar = temp; kontrol.setFoto(pboxGambar, listGambar[0]); }
private void btnReturnBook_Click(object sender, EventArgs e) { koneksiSql koneksi = new koneksiSql(); buku temp = new buku(); temp = koneksi.returnBuku(dgvBooks.SelectedCells[3].Value.ToString()); string fine = lblFineAmount.Text.Substring(4, lblFineAmount.Text.Length - 4); bool yes = koneksi.finishLend(dgvBooks.SelectedCells[0].Value.ToString()); if (fined && yes) { DialogNormal denda = new DialogNormal($"Returned", $"You have been Fined {fine}", 43, 85); denda.ShowDialog(); koneksi.updateFine(Program.userSekarang.user, fine); koneksi.updateStock(temp.bookId, temp.stock, "add"); } else { koneksi.updateFine(Program.userSekarang.user, fine); koneksi.updateStock(temp.bookId, temp.stock, "add"); } isiDgv(Program.userSekarang.user); }
private void dgvBooks_SelectionChanged(object sender, EventArgs e) { try { string idBuku = dgvBooks.SelectedCells[3].Value.ToString(); koneksiSql koneksi = new koneksiSql(); buku bukuTerpilih = koneksi.returnBuku(idBuku); isiBuku(bukuTerpilih); Peminjaman pinjam = koneksi.returnLend(dgvBooks.SelectedCells[1].Value.ToString(), dgvBooks.SelectedCells[0].Value.ToString()); isiPeminjaman(pinjam); if (pinjam.fine > 0) { fined = true; } } catch (Exception) { } btnReturnBook.Enabled = true; }
public FormAddEditBook(string bookId) //Overload Constructor utk Edit { buku currentBook = new buku(); koneksiSql sql = new koneksiSql(); currentBook = sql.returnBuku(bookId); InitializeComponent(); lblWelcome.Text = "Edit Book"; editExisting = true; txtBookId.Enabled = false; txtBookId.Text = currentBook.bookId; txtTitle.Text = currentBook.title; txtAuthor.Text = currentBook.author; txtGenre.Text = currentBook.genre; txtYear.Text = currentBook.year; nudStock.Value = Convert.ToInt32(currentBook.stock); string[] temp = currentBook.path.Split('|'); foreach (string x in temp) { listBoxGambar.Items.Add(x); } }