private void detach_T_ActivityNotes(T_ActivityNote entity) { this.SendPropertyChanging(); entity.T_Note = null; }
partial void DeleteT_ActivityNote(T_ActivityNote instance);
partial void UpdateT_ActivityNote(T_ActivityNote instance);
partial void InsertT_ActivityNote(T_ActivityNote instance);
private void attach_T_ActivityNotes(T_ActivityNote entity) { this.SendPropertyChanging(); entity.T_Activity = this; }
private int SaveNote(Note entity, int activityID) { using (var dc = new EngageCCTDataClassesDataContext()) { T_Note tNote; T_ActivityNote tActivityNote; if (!entity.NoteID.HasValue) { tNote = new T_Note(); tActivityNote = new T_ActivityNote(); } else { tNote = dc.T_Notes.SingleOrDefault(n => n.NoteID == entity.NoteID); tActivityNote = dc.T_ActivityNotes.SingleOrDefault(n => n.NoteID == entity.NoteID); if (tNote == null || tActivityNote == null) { throw new ApplicationException("Note not found"); } } tNote.ntCreated = entity.Created; tNote.ntEdited = entity.Edited; tNote.ntText = entity.Text; tNote.ntTitle = entity.Title; dc.T_Notes.InsertOnSubmit(tNote); if (!entity.NoteID.HasValue) { dc.SubmitChanges(); } tActivityNote.NoteID = tNote.NoteID; tActivityNote.ActivityID = activityID; dc.T_ActivityNotes.InsertOnSubmit(tActivityNote); dc.SubmitChanges(); return tNote.NoteID; } }