public void HienThiPhanCong(ComboBox ctxMaTDV, ComboBox ctxMaDB, ComboBox ctxMaThuoc, DataGridView dg, BindingNavigator bn) { BindingSource bs = new BindingSource(); bs.DataSource = data.LayDSPhanCong(); dg.DataSource = bs; bn.BindingSource = bs; ctxMaTDV.DataBindings.Add("SelectedValue", bs, "MATDV"); ctxMaDB.DataBindings.Add("SelectedValue", bs, "MADB"); ctxMaThuoc.DataBindings.Add("SelectedValue", bs, "MATHUOC"); //Load comboBoxMaTDV TrinhDuocVienCTRL ctrlTDV = new TrinhDuocVienCTRL(); ctrlTDV.HienThiComboBoxMaTDV(ctxMaTDV); dg.Columns.Add(ctrlTDV.LoadComboxMATDV()); dg.Columns.Remove("MATDV"); //Load comboBoxMaDB DiaBanCTRL ctrlDiaBan = new DiaBanCTRL(); ctrlDiaBan.HienThiComboBoxMaDB(ctxMaDB); dg.Columns.Add(ctrlDiaBan.LoadComBoxMaDB()); dg.Columns.Remove("MADB"); //Load comboBoxMaThuoc ThuocCTRL ctrlThuoc = new ThuocCTRL(); ctrlThuoc.HienThiComboBoxMaThuoc(ctxMaThuoc); dg.Columns.Add(ctrlThuoc.LoadComboBoxMaThuoc()); dg.Columns.Remove("MATHUOC"); }
public void HienThiLoThuoc(TextBox txtMaLo, TextBox txtTenLo, DateTimePicker timeNgaySanXuat, DateTimePicker timeNgayHetHan, TextBox txtSoLuong, ComboBox ctxMaThuoc, TextBox txtThanhTien, DataGridView dg, BindingNavigator bn) { BindingSource bs = new BindingSource(); bs.DataSource = data.LayDSLoThuoc(); dg.DataSource = bs; bn.BindingSource = bs; txtMaLo.DataBindings.Add("Text", bs, "MALO"); txtTenLo.DataBindings.Add("Text", bs, "TENLO"); timeNgaySanXuat.DataBindings.Add("Text", bs, "NGAYSX"); timeNgayHetHan.DataBindings.Add("Text", bs, "NGAYHH"); txtSoLuong.DataBindings.Add("Text", bs, "SOLUONG"); ctxMaThuoc.DataBindings.Add("SelectedValue", bs, "MATHUOC"); txtThanhTien.DataBindings.Add("Text", bs, "THANHTIEN"); //Load ComboBoxMaThuoc ThuocCTRL ctrlThuoc = new ThuocCTRL(); ctrlThuoc.HienThiComboBoxMaThuoc(ctxMaThuoc); dg.Columns.Add(ctrlThuoc.LoadComboBoxMaThuoc()); dg.Columns.Remove("MATHUOC"); }