private void BtHistory_Click(object sender, EventArgs e) { if (isHistory == false) { FHistory f = new FHistory(UKEY, Position, 1); DialogResult re = f.ShowDialog(); if (re == DialogResult.OK) //Xem chi tiết { hoaDon = f.getOrder(); if (hoaDon.ListCTHD != null) { var CTHDList = new BindingList <CTHD>(hoaDon.ListCTHD); // <-- BindingList dGVOrders.DataSource = CTHDList; dGVOrders.Columns["NGNHAP"].Visible = false; labelMaDon.Text = Convert.ToString(hoaDon.MaHD); tBDoiTac.ForeColor = Color.Black; tBDoiTac.Text = hoaDon.TenDoiTac; tBDoiTac.ReadOnly = true; tBLienHe.ForeColor = Color.Black; tBLienHe.Text = hoaDon.LienHe; tBLienHe.ReadOnly = true; dTPTime.Value = hoaDon.ThoiGian; dTPTime.Enabled = false; labelThanhTien.Text = hoaDon.GiaTri; isHistory = true; isSaved = false; BtHistory.IconChar = FontAwesome.Sharp.IconChar.ArrowCircleLeft; BtHistory.Text = "Quay lại"; setAccessButton(true, false, false, false, false, true); BtHistory.Click += new EventHandler(BtCreateOrder_Click); } else { hoaDon.ListCTHD = new List <CTHD>(); hoaDon.ThoiGian = DateTime.Now.Date; } } this.Show(); } else { BtHistory.IconChar = FontAwesome.Sharp.IconChar.History; BtHistory.Text = "Lịch sử"; isHistory = false; hoaDon.ThoiGian = DateTime.Now.Date; BtHistory.Click -= new EventHandler(BtCreateOrder_Click); } }
void History_dGV() { FHistory f = new FHistory(UKey, Position, 0); f.ShowDialog(); Stock stockDef = f.getStockDefine(); if (stockDef != null) { dGVStock.DataSource = controller.Load_Search("Mã Hàng", stockDef.MAHANG, stockDef.UKEY1); //Load các hàng hóa có mã trùng nhau } this.Show(); }