Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
        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);
                    }
                }
            }
        }
Esempio n. 7
0
        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;
        }