/// <summary>
        /// This gets run everytime you select something new in the listView
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listViewFriend_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var lvi = (sender as ListView).SelectedItem;

            if (lvi != null)
            {
                ClassFriend cv = lvi as ClassFriend;

                MessageBox.Show(cv.FriendData.fornavn.ToString() + " " + cv.FriendData.efternavn.ToString() + "\n" +
                                cv.FriendData.adresse.ToString() + "\n" +
                                cv.FriendData.postNr.ToString() + " " + cv.FriendData.PostByTabel.byNavn.ToString() + "\n" +
                                cv.FriendNewPhone[0].strPhoneNr.ToString() + " " + cv.FriendNewPhone[0].strPhoneType.ToString());
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets all friend from the database, and adds them to "friend"
        /// </summary>
        public void UpdateFriend()
        {
            string strSql = "Select * from MainVenneTabel";

            using (var ctx = new FriendsEntities())
            {
                var myVen = ctx.MainVenneTabels.SqlQuery(strSql);
                foreach (MainVenneTabel i in myVen)
                {
                    ClassFriend cf = new ClassFriend(i);
                    cf.FriendData = i;
                    friend.Add(cf);
                }
            }
        }