Example #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;
        }
Example #2
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;
        }
Example #3
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;
        }