public fThemSimple(bool isAdd = true, CNhomHang nh = null, fNhomHang.sendMessage send = null, float action = 1) { InitializeComponent(); if (isAdd == false && nh == null) { XtraMessageBox.Show("ERROR : Dữ liệu không được cung cấp để thực hiện hành động !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } if (isAdd == true) { table = BUS_HangHoa.LayNhomHang(); Text = "Thêm nhóm hàng"; } else { editNH = nh; Text = "Sửa thông tin nhóm hàng"; } add = isAdd; sendNH = send; flag = 2; InitNH(); }
private void Init() { List <object> list = new List <object> { new { ID = 0, Name = "Hàng hóa" }, new { ID = 1, Name = "Dịch vụ" } }; cbLoaiHH.Properties.DataSource = list; cbLoaiHH.Properties.DisplayMember = "Name"; cbLoaiHH.Properties.ValueMember = "ID"; LookUpColumnInfo col_t = new LookUpColumnInfo("Name", ""); cbLoaiHH.Properties.Columns.Add(col_t); cbLoaiHH.EditValue = 0; leKhoMacDinh.Properties.DataSource = BUS_KhoXuat.LayKhoDonGian(); leKhoMacDinh.Properties.DisplayMember = "STOCK_Name"; leKhoMacDinh.Properties.ValueMember = "STOCK_ID"; LookUpColumnInfo col = new LookUpColumnInfo("STOCK_ID", "Mã"); LookUpColumnInfo col1 = new LookUpColumnInfo("STOCK_Name", "Tên"); leKhoMacDinh.Properties.Columns.Add(col1); leKhoMacDinh.Properties.Columns.Add(col); leKhoMacDinh.EditValue = ((DataTable)leKhoMacDinh.Properties.DataSource).Rows[0]["STOCK_ID"]; leKhoMacDinh.Properties.Buttons[1].Click += btnThemKho_ThemHangHoa_Click; lePhanLoai.Properties.TextEditStyle = TextEditStyles.Standard; lePhanLoai.Properties.DataSource = BUS_HangHoa.LayNhomHang(); lePhanLoai.Properties.DisplayMember = "ProductGroup_Name"; lePhanLoai.Properties.ValueMember = "ProductGroup_ID"; col = new LookUpColumnInfo("ProductGroup_ID", "Mã"); col1 = new LookUpColumnInfo("ProductGroup_Name", "Tên"); lePhanLoai.Properties.Columns.Add(col1); lePhanLoai.Properties.Columns.Add(col); lePhanLoai.EditValue = ((DataTable)lePhanLoai.Properties.DataSource).Rows[0]["ProductGroup_ID"]; lePhanLoai.Properties.Buttons[1].Click += btnThemNhomhang_ThemHangHoa_Click; leDonVi.Properties.TextEditStyle = TextEditStyles.Standard; leDonVi.Properties.DataSource = BUS_DonViTinh.GetDVTDonGian(); leDonVi.Properties.DisplayMember = "UNIT_Name"; leDonVi.Properties.ValueMember = "UNIT_ID"; col = new LookUpColumnInfo("UNIT_ID", "Mã"); col1 = new LookUpColumnInfo("UNIT_Name", "Tên"); leDonVi.Properties.Columns.Add(col1); leDonVi.Properties.Columns.Add(col); leDonVi.EditValue = ((DataTable)leDonVi.Properties.DataSource).Rows[0]["UNIT_ID"]; leDonVi.Properties.Buttons[1].Click += btnThemDV_ThemHangHoa_Click; leNCC.Properties.TextEditStyle = TextEditStyles.Standard; leNCC.Properties.DataSource = BUS_NhaCungCap.LayNhaCC(); leNCC.Properties.DisplayMember = "CustomerName"; leNCC.Properties.ValueMember = "Customer_ID"; col = new LookUpColumnInfo("Customer_ID", "Mã"); col1 = new LookUpColumnInfo("CustomerName", "Tên"); leNCC.Properties.Columns.Add(col1); leNCC.Properties.Columns.Add(col); leNCC.EditValue = ((DataTable)leNCC.Properties.DataSource).Rows[0]["Customer_ID"]; leNCC.Properties.Buttons[1].Click += btnThemNCC_ThemHangHoa_Click; peHinhAnh.Properties.NullText = "Ảnh"; peHinhAnh.Click += PeHinhAnh_Click; txtMa.TextChanged += TxtMa_TextChanged; txtMaVachNSX.TextChanged += TxtMaVachNSX_TextChanged; if (add == true) { phatSinhMa(); } else { LoadDuLieuHH(); } }
private void LoadData() { gcMain.DataSource = BUS_HangHoa.LayNhomHang(); }