private void btnCreate_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(this.tb1.Text) || String.IsNullOrWhiteSpace(this.tb1.Text)) { Message.Show("Заметка не будет создана", MessageTypes.Information); this.tb1.Text = ""; return; } this.Note = DBModel.Instance.AddNote(this.personId, this.tb.Text, this.tb1.Text, DateTime.Now); this.Close(); Message.Show("Заметка создана", MessageTypes.Information); }
public ReadWriteNoteWindow(bool isRead , long perId , note nt = null) { InitializeComponent(); this.personId = perId; if (isRead) { this.btnCreate.Visibility = System.Windows.Visibility.Hidden; this.tb.BorderThickness = new Thickness(3); this.tb.Background = new SolidColorBrush(Colors.Transparent); this.tb.Cursor = Cursors.Arrow; if (nt != null) { this.tb.Text = nt.Subject; this.tb1.Text = nt.Text; } } this.tb.IsReadOnly = isRead; this.tb1.IsReadOnly = isRead; }
/// <summary> /// Deprecated Method for adding a new object to the notes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTonotes(note note) { base.AddObject("notes", note); }
/// <summary> /// Create a new note object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="personId">Initial value of the PersonId property.</param> /// <param name="subject">Initial value of the Subject property.</param> /// <param name="text">Initial value of the Text property.</param> /// <param name="date">Initial value of the Date property.</param> public static note Createnote(global::System.Int64 id, global::System.Int64 personId, global::System.String subject, global::System.String text, global::System.DateTime date) { note note = new note(); note.Id = id; note.PersonId = personId; note.Subject = subject; note.Text = text; note.Date = date; return note; }
public void DeleteNote(note nt) { CheckConnection(); try { lock (locker) { this.db.notes.DeleteObject(nt); this.db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public note AddNote(long perId, string subj, string text, DateTime date) { CheckConnection(); try { lock (locker) { note nt = new note { PersonId = perId, Date = date, Subject = subj, Text = text }; this.db.notes.AddObject(nt); this.db.SaveChanges(); return nt; } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }