private void frmKho_Load(object sender, EventArgs e) { BUSKhoHang um = new BUSKhoHang(); DataTable dt = um.getKho(); gridColumn1.FieldName = "id"; gridColumn2.FieldName = "MaKho"; gridColumn3.FieldName = "TenKho"; gridColumn4.FieldName = "DiaChi"; gridColumn5.FieldName = "NguoiLienHe"; gridColumn6.FieldName = "SODT"; gridColumn7.FieldName = "ConQuanLy"; gridControl1.DataSource = dt; }
private void frmHangHoa_Add_Load(object sender, EventArgs e) { DataTable dt2 = new DataTable(); BUSKhoHang bus = new BUSKhoHang(); dt2 = bus.getKho(); if (dt2.Rows.Count > 0) { foreach (DataRow row in dt2.Rows) { comboBoxEdit1.Properties.Items.Add(row["TenKho"]); } } dt2 = new DataTable(); dt2 = bus.getBangNhomHang(); if (dt2.Rows.Count > 0) { foreach (DataRow row in dt2.Rows) { comboBoxEdit2.Properties.Items.Add(row["TenNH"]); } } dt2 = new DataTable(); dt2 = bus.getBangDonVi(); if (dt2.Rows.Count > 0) { foreach (DataRow row in dt2.Rows) { comboBoxEdit3.Properties.Items.Add(row["TenDV"]); } } dt2 = new DataTable(); BUSDoiTac bus2 = new BUSDoiTac(); dt2 = bus2.getNhaPhanPhoi(); if (dt2.Rows.Count > 0) { foreach (DataRow row in dt2.Rows) { comboBoxEdit7.Properties.Items.Add(row["TenNPP"]); } } //////////////////// if (!isAddForm) { BUSKhoHang b = new BUSKhoHang(); DTOHangHoa dtoHangHoa = b.getHangHoaDetail(gotID); radioButton1.Checked = dtoHangHoa.VatTu; radioButton1.Checked = dtoHangHoa.DichVu; textEdit1.Text = dtoHangHoa.XuatXu; textEdit2.Text = dtoHangHoa.MaHH; textEdit3.Text = dtoHangHoa.MaVachNSX; textEdit4.Text = dtoHangHoa.TENHH; comboBoxEdit1.Text = dtoHangHoa.MaKhoHang; comboBoxEdit2.Text = dtoHangHoa.PhanLoai; comboBoxEdit3.Text = dtoHangHoa.MaDonVi; comboBoxEdit7.Text = dtoHangHoa.MaNhaCungCap; comboBoxEdit4.Text = dtoHangHoa.Thue; comboBoxEdit5.Text = dtoHangHoa.TonKhoToiThieu; comboBoxEdit6.Text = dtoHangHoa.TonKhoHienTai; comboBoxEdit8.Text = dtoHangHoa.GiaMua; comboBoxEdit9.Text = dtoHangHoa.GiaSi; comboBoxEdit10.Text = dtoHangHoa.GiaLe; } else { textEdit2.ReadOnly = false; comboBoxEdit6.Text = "0"; } }