Esempio n. 1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var form = new SelectFileForm())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    var currentNote = form.SelectedNote;
                    _note = currentNote;

                    textBox1.Text = currentNote.NoteText;
                }
            }
        }
Esempio n. 2
0
        private void buttonLoad_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show("Nothing selected", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var name = listView1.SelectedItems[0].Text;

            _selectedNote = GetData(name);

            DialogResult = DialogResult.OK;
        }
Esempio n. 3
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     textBox1.Text = "";
     _note = null;
 }
Esempio n. 4
0
        public IList<Notes> GetData(string connectionString)
        {
            IList<Notes> listNotes = new List<Notes>();

            using (var connection = new OleDbConnection())
            {
                connection.ConnectionString = connectionString;
                connection.Open();

                var command = new OleDbCommand("SELECT * from Notes", connection);

                var dataReader = command.ExecuteReader();

                while (dataReader != null && dataReader.Read())
                {
                    var note = new Notes
                    {
                        Id = int.Parse(dataReader["Id"].ToString()),
                        NoteName = dataReader["NoteName"].ToString(),
                        NoteText = Decompress(dataReader["NoteText"].ToString()),
                        DateCreated = Convert.ToDateTime(dataReader["DateCreated"].ToString()),
                        DateModified = Convert.ToDateTime(dataReader["DateModified"].ToString())
                    };

                    listNotes.Add(note);
                }
            }

            return listNotes;
        }