private void frmHangHoa_Load(object sender, EventArgs e) { if (mode == MODE_ADDNEW) { initThem(); } else { initSua(); } _dtLoaiHang = LoaiHangService.LoadDataTable(); _dtDonViTinh = DonViTinhService.LoadDataTable(); lookUpEditLoaiHang.Properties.DataSource = _dtLoaiHang; lookUpEditLoaiHang.Properties.ValueMember = "MaLoaiHang"; lookUpEditLoaiHang.Properties.DisplayMember = "TenLoaiHang"; lookUpEditLoaiHang.Properties.Columns.Add(new LookUpColumnInfo("MaLoaiHang", "Mã Loại Hàng")); lookUpEditLoaiHang.Properties.Columns.Add(new LookUpColumnInfo("TenLoaiHang", "Tên Loại Hàng")); lookUpEditDonViTinh.Properties.DataSource = _dtDonViTinh; lookUpEditDonViTinh.Properties.ValueMember = "MaDVT"; lookUpEditDonViTinh.Properties.DisplayMember = "TenDVT"; lookUpEditDonViTinh.Properties.Columns.Add(new LookUpColumnInfo("MaDVT", "Mã Đơn Vị Tính")); lookUpEditDonViTinh.Properties.Columns.Add(new LookUpColumnInfo("TenDVT", "Tên Đơn Vị Tính")); }
private void btnThem_Click(object sender, EventArgs e) { frmDonViTinh f = new frmDonViTinh(); f.ShowDialog(); grcDonViTinhSearch.DataSource = DonViTinhService.LoadDataTable(); }
private void reload(object sender, FormClosingEventArgs e) { frmHangHoa f = (frmHangHoa)sender; if (f.isDataChanged == true) { grcHanghoaSearch.DataSource = DonViTinhService.LoadDataTable(); } }
private void btnTimKiem_Click(object sender, EventArgs e) { string key = txtMaDVTSearch.Text; if (key.Trim() != "") { grcDonViTinhSearch.DataSource = DonViTinhService.Search(key); } else { grcDonViTinhSearch.DataSource = DonViTinhService.LoadDataTable(); } }
private void txtMaDVTSearch_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string key = txtMaDVTSearch.Text; if (key.Trim() != "") { grcDonViTinhSearch.DataSource = DonViTinhService.Search(key); } else { grcDonViTinhSearch.DataSource = DonViTinhService.LoadDataTable(); } } }
//Button Lưu Đơn Vị Tính Mới private void btnLuu_Click(object sender, EventArgs e) { var dt = grcDonViTinh.DataSource as DataTable; if (dt == null || dt.GetChanges() == null) { return; } if (DonViTinhService.SaveChanges(dt)) { XtraMessageBox.Show("Lưu thành công", "Lưu", MessageBoxButtons.OK, MessageBoxIcon.Information); grcDonViTinh.DataSource = DonViTinhService.LoadDataTable(); } else { XtraMessageBox.Show("Lưu thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmHangHoaSearch_Load(object sender, EventArgs e) { grcHanghoaSearch.DataSource = HangHoaService.LoadDataTable(); _dtLoaiHang = LoaiHangService.LoadDataTable(); _dtDonViTinh = DonViTinhService.LoadDataTable(); LookUpEditLoaiHang.DataSource = _dtLoaiHang; LookUpEditLoaiHang.ValueMember = "MaLoaiHang"; LookUpEditLoaiHang.DisplayMember = "TenLoaiHang"; LookUpEditLoaiHang.Columns.Add(new LookUpColumnInfo("MaLoaiHang", "Mã Loại Hàng")); LookUpEditLoaiHang.Columns.Add(new LookUpColumnInfo("TenLoaiHang", "Tên Loại Hàng")); LookUpEditDonViTinh.DataSource = _dtDonViTinh; LookUpEditDonViTinh.ValueMember = "MaDVT"; LookUpEditDonViTinh.DisplayMember = "TenDVT"; LookUpEditDonViTinh.Columns.Add(new LookUpColumnInfo("MaDVT", "Mã Đơn Vị Tính")); LookUpEditDonViTinh.Columns.Add(new LookUpColumnInfo("TenDVT", "Tên Đơn Vị Tính")); }
private void frmHangHoa_Load(object sender, EventArgs e) { if (mode == MODE_ADDNEW) { initThem(); } else { initSua(); } tedMaHangHoa.ReadOnly = true; lueLoaiHang.Properties.ValueMember = "MaLoaiHang"; lueLoaiHang.Properties.DisplayMember = "TenLoaiHang"; lueLoaiHang.Properties.Columns.Add(new LookUpColumnInfo("TenLoaiHang", "Tên Loại Hàng")); lueLoaiHang.Properties.DataSource = LoaiHangService.LoadDataTable(); lueDonViTinh.Properties.ValueMember = "MaDVT"; lueDonViTinh.Properties.DisplayMember = "TenDVT"; lueDonViTinh.Properties.Columns.Add(new LookUpColumnInfo("TenDVT", "Tên Đơn Vị Tính")); lueDonViTinh.Properties.DataSource = DonViTinhService.LoadDataTable(); }
private void grcDonViTinh_Load(object sender, EventArgs e) { var dt = DonViTinhService.LoadDataTable(); grcDonViTinh.DataSource = dt; }
//Hàm load dữ liệu private void frmDonViTinh_Load(object sender, EventArgs e) { grcDonViTinh.DataSource = DonViTinhService.LoadDataTable(); gridView.Columns[0].Visible = false; gridView.Columns[1].Caption = @"Tên đơn vị tính"; }
private void frmDonViTinhSearch_Load(object sender, EventArgs e) { grcDonViTinhSearch.DataSource = DonViTinhService.LoadDataTable(); }