Beispiel #1
0
		public static Link[] GetAllLinks()
		{
            List<Link> alist = new List<Link>();
		
			SqlConnection conn = Connection.Open();

			string sql;
			sql = SqlFormat.Format("SELECT description, whocreated, url FROM LINKS ORDER BY id ASC");

			SqlCommand cmd = new SqlCommand(sql, conn);

            using (SqlDataReader reader = cmd.ExecuteReader())
            {

                while (reader.Read())
                {
                    Link l = new Link();
                    l.Description = reader["description"].ToString();
                    l.SubmitterName = reader["whocreated"].ToString();
                    l.Url = reader["url"].ToString();

                    alist.Add(l);
                }

                return alist.ToArray();
            }
		}
Beispiel #2
0
        public AddLinkDialog(Link link)
        {
            InitializeComponent();

            this.Link = link;
            this.DataContext = link;

            FocusManager.SetFocusedElement(this, this.mDescriptionTextbox);  // not working, annoying!!!
        }
Beispiel #3
0
        private static void LoadLinksIntoViewModel(Link[] links, TriviaViewModel viewModel)
        {
            if (links == null)
            {
                return;
            }

            if (viewModel.Links.Count > 0)
            {
                return;  // We've already got them
            }

            foreach (Link link in links)
            {
                viewModel.Links.Add(link);
            }
        }