public OverdueBooks(DataSet dsOverdue) { InitializeComponent(); ControlForm kontrol = new ControlForm(); Panel[] listPanel = { pnlValue1, pnlValue2, pnlValue3, pnlValue4, pnlValue5 }; PictureBox[] listPbox = { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5 }; List <Peminjaman> listPinjam = new List <Peminjaman>(); int counter = 0; for (int i = 0; i < dsOverdue.Tables["Lendings"].Rows.Count; i++) { Peminjaman temp = new Peminjaman(); temp.username = dsOverdue.Tables["Lendings"].Rows[i]["Username"].ToString(); temp.bookId = dsOverdue.Tables["Lendings"].Rows[i]["BookId"].ToString(); temp.lendId = dsOverdue.Tables["Lendings"].Rows[i]["LendId"].ToString(); temp.strLendDate = dsOverdue.Tables["Lendings"].Rows[i]["LendDate"].ToString(); temp.strDueDate = dsOverdue.Tables["Lendings"].Rows[i]["DueDate"].ToString(); temp.fineCount(); string[] thumbnailList = dsOverdue.Tables["Lendings"].Rows[i]["PicturePath"].ToString().Split('|'); //Done load data peminjaman// if (temp.fine > 0) { kontrol.setFotoBuku(listPbox[counter % 5], thumbnailList[0]); string fine = temp.fine.ToString(); listPanel[counter % 5].Controls.Add(new UcFineValue(fine)); listId.Add(temp.bookId); } } }
private void loadLowStock(ref int counter, PictureBox[] listPbox, DataSet dsOverdue) { ControlForm kontrol = new ControlForm(); for (int i = 0; i < dsOverdue.Tables["LowStock"].Rows.Count && counter <= 4; i++) { string id = dsOverdue.Tables["LowStock"].Rows[i]["BookId"].ToString(); string[] thumbnailList = dsOverdue.Tables["LowStock"].Rows[i]["PicturePath"].ToString().Split('|'); int stock = Convert.ToInt32(dsOverdue.Tables["LowStock"].Rows[i]["Stock"]); if (stock > 0) { kontrol.setFotoBuku(listPbox[counter], thumbnailList[0]); counter += 1; listId.Add(id); } } }
public hotBook(DataSet dsOverdue) { InitializeComponent(); PictureBox[] listPbox = { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5 }; Label[] listLabel = { label2, label3, label4, label5, label6 }; int counter = 0; for (int i = 0; i < dsOverdue.Tables["Hotlist"].Rows.Count && counter <= 4; i++) { string id = dsOverdue.Tables["Hotlist"].Rows[i]["BookId"].ToString(); string[] thumbnailList = dsOverdue.Tables["Hotlist"].Rows[i]["PicturePath"].ToString().Split('|'); int stock = Convert.ToInt32(dsOverdue.Tables["Hotlist"].Rows[i]["Stock"]); kontrol.setFotoBuku(listPbox[counter], thumbnailList[0]); if (stock == 0) { listLabel[counter].Visible = true; } counter += 1; listId.Add(id); } }