private void cbxHang_SelectedIndexChanged(object sender, EventArgs e) { DataTable hangDT = B_HangHoa.GetAllHangHoa(); AddMultipleColumn(hangDT, "NameAndCode", "MaHang", "TenHangHoa"); KeyToValueOfText(hangDT, cbxHang, "NameAndCode", "TenHangHoa", "DonGiaNhap", txtTenHang, txtDonGia); }
private void frmKhohang_Load(object sender, EventArgs e) { DataTable dt = B_HangHoa.GetAllHangHoa(); dgvHangHoa.DataSource = dt; ds.Tables.Add(dt); }
private void frmTimkiemHoadonNhap_Load(object sender, EventArgs e) { dgvFindResult.DataSource = B_HDNhap.GetDataForSearch(); DataTable t = B_NCC.GetAllNCC(); FillCbo(t, cbxNCC, "TenNCC", "MaNCC"); DataTable hang = B_HangHoa.GetAllHangHoa(); FillCbo(hang, cbxHang, "MaHang", "TenHangHoa"); gbxNgaythang.Visible = false; }
private void frmNhapHang_Load(object sender, EventArgs e) { DataTable cthdn = B_HDNhap.GetAllHDNhap(); dgvHDN.DataSource = cthdn; DataTable t = B_NCC.GetAllNCC(); FillCbo(t, cbxMaNCC, "MaNCC", "TenNCC"); DataTable ts = B_NhanVien.GetAllNhanVien(); FillCbo(ts, cbxMaNV, "MaNV", "TenNV"); DataTable hang = B_HangHoa.GetAllHangHoa(); FillCbo(hang, cbxHang, "MaHang", "TenHangHoa"); txtTongTien.Text = "0"; txtThanhTien.Enabled = false; turnOffBtnUnder(false); }
private void frmBanhang_Load(object sender, EventArgs e) { DataTable cthdb = B_HDBan.GetAllHDBan(); dgvHDB.DataSource = cthdb; #region Instance To List DataTable amountHangDt = removeHangWithNonePriceAndAmount(B_HangHoa.GetAllHangHoa()); amountHang = InstanceHandling.ConvertDataTable <HangHoaEntity>(amountHangDt); #endregion DataTable t = B_KhachHang.GetAllKhachHang(); FillCbo(t, cbxMaKH, "MaKhach", "TenKhach"); DataTable ts = B_NhanVien.GetAllNhanVien(); FillCbo(ts, cbxMaNV, "MaNV", "TenNV"); DataTable hang = removeHangWithNonePriceAndAmount(B_HangHoa.GetAllHangHoa()); FillCbo(hang, cbxMaHang, "MaHang", "TenHangHoa"); txtTongTien.Text = "0"; txtThanhTien.Enabled = false; // setup btn turnOffBtnUnder(false); // loadTextBox(); }
} private void btnThem_Click(object sender, EventArgs e) { HangHoaDTO ob = standardInput(); if (ob != null) { { if (DuplicatedOrNone() == 1) { { MessageBox.Show("Mã Hàng Hóa Trùng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtMaVach.Focus(); return; } } else { B_HangHoa.saveHang(ob, sys.INSERT); MessageBox.Show("Thêm Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dtCheckDupOrNone = B_HangHoa.GetAllHangHoa(); dgvHangHoa.DataSource = dtCheckDupOrNone; } } } }
private void btnXoa_Click(object sender, EventArgs e) { if (DuplicatedOrNone() == 2) { { MessageBox.Show("Không Có Mã Đó Để Thay Đổi Liên Quan", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtMaVach.Text = ""; return; } } else { B_HangHoa.DeleteHangHoa(txtMaVach.Text); MessageBox.Show("Xóa Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dgvHangHoa.DataSource = B_HangHoa.GetAllHangHoa(); dtCheckDupOrNone = B_HangHoa.GetAllHangHoa(); } }
private void btnSua_Click(object sender, EventArgs e) { if (DuplicatedOrNone() == 2) { { MessageBox.Show("Không Có Mã Đó Để Thay Đổi Liên Quan", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtMaVach.Text = ""; return; } } else { HangHoaDTO ob = standardInput(); if (ob != null) { { B_HangHoa.saveHang(ob, sys.UPDATE); MessageBox.Show("Sửa Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dtCheckDupOrNone = B_HangHoa.GetAllHangHoa(); dgvHangHoa.DataSource = dtCheckDupOrNone; } } } }
public partial class frmChitietHanghoa : Form { private const int EM_SETCUEBANNER = 0x1501; [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern Int32 SendMessage(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam); // local var for goods DataTable dtCheckDupOrNone; byte[] currentImg; static SystemConstant sys = new SystemConstant(); public frmChitietHanghoa() { InitializeComponent(); frmChitietHanghoa_Load(null, null); if (frmLogin.session.role == 2) { btnThem.Enabled = btnSua.Enabled = btnXoa.Enabled = btnIn.Enabled = false; } Handling.FormHandling.clearBorderGroupBox(gbxChitiet); Handling.FormHandling.clearBorderGroupBox(gbxChucnang); } private void loadTextBox() { SendMessage(txtMaVach.Handle, EM_SETCUEBANNER, 0, "Nhập Mã"); SendMessage(txtTenHangHoa.Handle, EM_SETCUEBANNER, 0, "Tên"); SendMessage(txtDonGiaNhap.Handle, EM_SETCUEBANNER, 0, "Nhập Số"); SendMessage(txtSoLuong.Handle, EM_SETCUEBANNER, 0, "Nhập Số"); } private void frmChitietHanghoa_Load(object sender, EventArgs e) { DataTable nh = B_NhomHang.GetAllNhomHang(); FillCbo(nh, cbxNhomHang, "MaNhom", "TenNhom"); DataTable tl = B_TheLoai.GetAllTL(); FillCbo(tl, cbxTheLoai, "MaLoai", "TenLoai"); DataTable dv = B_DonViTinh.GetAllDVT(); FillCbo(dv, cbxDonVi, "MaDonVi", "TenDonVi"); DataTable chatLieu = B_ChatLieu.GetAllCL(); FillCbo(chatLieu, cbxChatLieu, "MaChatLieu", "TenChatLieu"); DataTable congDung = B_CongDung.GetAllCD(); FillCbo(congDung, cbxCongDung, "MaCongDung", "TenCongDung"); DataTable noiSX = B_NoiSX.GetAllNSX(); FillCbo(noiSX, cbxNoiSX, "MaNoiSX", "TenNoiSX"); dtCheckDupOrNone = B_HangHoa.GetAllHangHoa(); dgvHangHoa.DataSource = dtCheckDupOrNone; loadTextBox(); } private void btnCreateCode_Click(object sender, EventArgs e)