public Dictionary <int, string> HangKhachHangS() { Dictionary <int, string> dict = new Dictionary <int, string>(); foreach (HangKhachHang hkh in HangKhachHang.LayTatCa()) { dict.Add(hkh.ID, hkh.Ten); } return(dict); }
private void LoadHangKH(int tinhTrangForm) { cboHangKH.Items.Clear(); foreach (HangKhachHang hang in HangKhachHang.LayTatCa()) { nguonHangKH.Add(hang.ID, hang.Ten); } cboHangKH.ValueMember = "ID"; cboHangKH.DisplayMember = "Ten"; cboHangKH.DataSource = null; cboHangKH.DropDownStyle = ComboBoxStyle.DropDownList; switch (tinhTrangForm) { case (int)Ennums.FormState.New: foreach (KeyValuePair <int, string> kv in nguonHangKH) { cboHangKH.Items.Add(kv.Value); cboHangKH.SelectedIndex = 0; } break; } }