public string GetEmailAddress() { DataManager dataManager = new DataManager(); DataTable profileTable = new DataTable(); profileTable = dataManager.GetAllProfiles(); string emailAddress = null; string displayName = ProfileComboBox.SelectedItem.ToString(); DataRow[] foundRows = profileTable .AsEnumerable() .Where(row => row.Field<string>("DisplayName") == displayName) .ToArray(); for (int i = 0; i < foundRows.Length; i++) { emailAddress = foundRows[i][0].ToString(); } return emailAddress; }
public void GetProfileDisplayNames() { DataManager dataManager = new DataManager(); DataTable profileTable = new DataTable(); profileTable = dataManager.GetAllProfiles(); string[] displayNames = profileTable .AsEnumerable() .Select(row => row.Field<string>("DisplayName")) .ToArray(); ProfileComboBox.DataSource = displayNames; }