private void comboBoxSP_SelectedIndexChanged(object sender, EventArgs e) { try { string id = comboBoxSP.SelectedValue.ToString(); textBoxTenSP.Text = SanPhamBUS.GetSanPhamByID(id).TenSP.ToString(); if (ChiTietSPBUS.GetChiTietSPByIDSP(id).Count != 0) { comboBoxMaKieu.DataSource = ChiTietSPBUS.GetChiTietSPByIDSP(id); comboBoxMaKieu.DisplayMember = "MaKieu"; comboBoxMaKieu.ValueMember = "MaKieu"; } else { comboBoxMaKieu.DataSource = null; } } catch { comboBoxMaKieu.DataSource = null; } }
private void cmBoxSP_SelectedIndexChanged(object sender, EventArgs e) { try { if (ID != null) { string id = cmBoxSP.SelectedValue.ToString(); SanPham sp = SanPhamBUS.GetSanPhamByID(id); cmBoxMaSP.SelectedValue = id; cmBoxSP.SelectedValue = id; txtboxMaSP.Text = sp.MaSP; txtTenSP.Text = sp.TenSP; txtNamSX.Text = sp.NămSX; txtboxCPU.Text = sp.CPU; txtboxGPU.Text = sp.CardManHinh; txtCamera.Text = sp.Camera; txtPort.Text = sp.Port; txtboxRam.Text = sp.Ram; txtboxManHinh.Text = sp.ManHinh; txtboxOS.Text = sp.OS; txtboxSim.Text = sp.Sim; txtboxPin.Text = sp.DungLuongPin; txtBoxTrongLuong.Text = sp.TrongLuong; txtboxBNngoai.Text = sp.BoNhoNgoai; txtboxBNtrong.Text = sp.BoNhoTrong; if (IDMode == "ts") { chiTietSPBindingSource.DataSource = ChiTietSPBUS.GetChiTietSPByIDSP(id); } else { chiTietSPBindingSource.DataSource = ChiTietSPBUS.GetChiTietSPOderByMaCHByIDSP(IDMode, id); } //chiTietSPBindingSource.DataSource = ChiTietSPBUS.GetChiTietSPByIDSP(ID); } } catch { } }