Ejemplo n.º 1
0
        public void AddEntry()
        {
            var window = new AddEntryWindow();

            window.Owner = Application.Current.MainWindow;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            var newEntry = new ENTRY();

            window.DataContext = newEntry;

            var result = window.ShowDialog();

            if (result == true)
            {
                _entryList.Add(newEntry);
            }
        }
Ejemplo n.º 2
0
        private void Update()
        {
            SqlConnection  con  = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\rjrjaleco\Documents\Visual Studio 2015\Projects\WpfApplication1\WpfApplication1\Database1.mdf");
            SqlDataAdapter sda2 = new SqlDataAdapter("SELECT * From [TEST]", con);
            DataTable      dt   = new DataTable();

            sda2.Fill(dt);
            con.Close();

            TestingListView.Items.Clear();
            for (int x = 0; x < dt.Rows.Count; x++)
            {
                ENTRY newEntry = new ENTRY();

                newEntry.Id      = Convert.ToInt16(dt.Rows[x]["Id"]);
                newEntry.Name    = dt.Rows[x]["Name"].ToString();
                newEntry.Age     = dt.Rows[x]["Age"].ToString();
                newEntry.Address = dt.Rows[x]["Address"].ToString();
                TestingListView.Items.Add(newEntry);
            }
            con.Close();
        }