Example #1
0
        public void AddNote(Note note)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                note.NoteId = 0;

                context.Notes.Add(note);
                context.SaveChanges();
            }
        }
Example #2
0
        private void add_Click(object sender, EventArgs e)
        {
            if (currentDateTime.Checked)
            {
                noteMoment.Value = DateTime.Now;
            }

            var newNote = new Note
            {
                Text = noteText.Text,
                Moment = noteMoment.Value,
                TargetComputer = TargetComputer.Text
            };

            _uoRepo.AddNote(newNote);

            RefreshView();
        }
Example #3
0
 public static string ViewFromNote(Note note)
 {
     return note.Text + "@" +
            note.Moment.ToString(Format);
 }
Example #4
0
 public bool ContainsNote(Note note)
 {
     using (var context = new UchOtdContext(ConnectionString))
     {
         return context.Notes.FirstOrDefault(n =>
             n.Moment == note.Moment &&
             n.TargetComputer == note.TargetComputer &&
             n.Text == note.Text) != null;
     }
 }
Example #5
0
        public void UpdateNote(Note note)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                var curNote = GetNote(note.NoteId);

                curNote.Text = note.Text;
                curNote.Moment = note.Moment;
                curNote.TargetComputer = note.TargetComputer;

                context.SaveChanges();
            }
        }