public string GetCarrier() { DataManager dataManager = new DataManager(); DataTable friendTable = new DataTable(); friendTable = dataManager.GetAllFriends(); string carrier = null; string friendsCarrier = null; string friendName = FriendComboBox.SelectedItem.ToString(); DataRow[] foundRows = friendTable .AsEnumerable() .Where(row => row.Field<string>("Name") == friendName) .ToArray(); for (int i = 0; i < foundRows.Length; i++) { carrier = foundRows[i][2].ToString(); } if (carrier == "AT&T") { friendsCarrier = "@txt.att.net"; } if (carrier == "SprintPCS") { friendsCarrier = "@messaging.sprintpcs.com"; } return friendsCarrier; }
private void SaveProfileButton_Click(object sender, EventArgs e) { DataManager dataManager = new DataManager(); string emailAddress = GmailAddressTextBox.Text; string emailPassword = GmailPasswordTextBox.Text; string displayName = DisplayNameTextBox.Text; dataManager.WriteNewProfile(emailAddress, emailPassword, displayName); ShowMessage(emailAddress); ResetForm(); }
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; }
public string GetPhoneNumber() { DataManager dataManager = new DataManager(); DataTable friendTable = new DataTable(); friendTable = dataManager.GetAllFriends(); string phoneNumber = null; string friendName = FriendComboBox.SelectedItem.ToString(); DataRow[] foundRows = friendTable .AsEnumerable() .Where(row => row.Field<string>("Name") == friendName) .ToArray(); for (int i = 0; i < foundRows.Length; i++) { phoneNumber = foundRows[i][1].ToString(); } return phoneNumber; }
public void GetMessages() { DataManager dataManager = new DataManager(); DataTable receivedMessagesTable = new DataTable(); receivedMessagesTable = dataManager.MockCaptureMessages(); DataTable friendsTable = new DataTable(); friendsTable = dataManager.MockGetFriendsNames(); DataSet dataSet = new DataSet(); dataSet.Tables.Add(friendsTable); dataSet.Tables.Add(receivedMessagesTable); dataSet.Relations.Add("children", friendsTable.Columns["PhoneNumber"], receivedMessagesTable.Columns["From"]); if (dataSet.Tables[0].Rows.Count > 0) { ReceivedTreeView.Nodes.Clear(); foreach (DataRow masterRow in dataSet.Tables[0].Rows) { TreeNode masterNode = new TreeNode((string)masterRow["PhoneNumber"]); masterNode.Tag = masterRow["Name"]; ReceivedTreeView.Nodes.Add(masterNode); foreach (DataRow childRow in masterRow.GetChildRows("children")) { TreeNode childNode = new TreeNode((string)childRow["Body"]); masterNode.Nodes.Add(childNode); } } } }
public void GetFriendName() { DataManager dataManager = new DataManager(); DataTable friendTable = new DataTable(); friendTable = dataManager.GetAllFriends(); string[] friendNames = friendTable .AsEnumerable() .Select(row => row.Field<string>("Name")) .ToArray(); FriendComboBox.DataSource = friendNames; }