public void load() { ///load sanh sach hàng hóa trong kho PhanBonBUS busPB = new PhanBonBUS(); ThuocBaoVeTVBUS busTBV = new ThuocBaoVeTVBUS(); NongSanBUS busNS = new NongSanBUS(); list.Clear(); list.AddRange(busPB.getListPhanBon()); list.AddRange(busTBV.getListTBV()); list.AddRange(busNS.getListNongSan()); //////// dataGrid.DataSource = list; for (int i = 0; i < list.Count; i++) { var row = dataGrid.Rows[i].Cells["TinhTrang"]; string s = row.Value.ToString(); if (s.Equals("Hết hạn sử dụng")) { row.Style.ForeColor = Color.Red; } } }
private void btnHuy_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn chắc chắn muốn hủy", "Hủy hàng quá hạn", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { PhanBonBUS busPB = new PhanBonBUS(); ThuocBaoVeTVBUS busTBV = new ThuocBaoVeTVBUS(); NongSanBUS busNS = new NongSanBUS(); busPB.setHuySL(listHuy); busTBV.setHuySL(listHuy); busNS.setHuySL(listHuy); load(); btnThongBao.Visible = false; btnHuy.Visible = false; } }