private void btnChon_Click(object sender, EventArgs e) { if (lookUpEditKhachHang.EditValue != null) { DataTable tblKH = null; tblKH = DonHangController.LayDonHangConNo_KhachHang(lookUpEditKhachHang.EditValue.ToString()); tblKH.Columns.Add(new DataColumn("Chon", typeof(bool))); foreach (DataRow item in tblKH.Rows) { item["Chon"] = false; } gridControl1.DataSource = tblKH; //----------------- KhachHang iKhachHang = null; iKhachHang = KhachHangController.GetItem(lookUpEditKhachHang.EditValue.ToString()); if (iKhachHang != null) { txtKhachHangID.Text = iKhachHang.KhachHangID; txtTenKhachHang.Text = iKhachHang.TenKhachHang; calcEditTongTien.Value = iKhachHang.TongTienHang; calcEditConNo.Value = iKhachHang.CongNo; txtSoDienThoai.Text = iKhachHang.SoDienThoai; } strTrangThai = "add"; DieuKhienTrangThai(); } }
private void gridView1_DoubleClick(object sender, EventArgs e) { int intRow = gridView1.FocusedRowHandle; if (intRow >= 0) { string strKhachHangID = gridView1.GetRowCellValue(intRow, "KhachHangID").ToString(); KhachHang item = KhachHangController.GetItem(strKhachHangID); if (item != null) { frmAddKhachHang f = new frmAddKhachHang(); f.frmMode = "edit"; f.EditItem = item; f.ShowDialog(this); gridControl1.DataSource = KhachHangController.GetList(); gridView1.FocusedRowHandle = intRow; } } }