partial void DeleteT_LeadNote(T_LeadNote instance);
partial void UpdateT_LeadNote(T_LeadNote instance);
partial void InsertT_LeadNote(T_LeadNote instance);
private void detach_T_LeadNotes(T_LeadNote entity) { this.SendPropertyChanging(); entity.T_Note = null; }
private void attach_T_LeadNotes(T_LeadNote entity) { this.SendPropertyChanging(); entity.T_Note = this; }
private int SaveNote(Note entity, int leadID) { using (var dc = new EngageCCTDataClassesDataContext()) { T_Note tNote; T_LeadNote tLeadNote; if (!entity.NoteID.HasValue) { tNote = new T_Note(); tLeadNote = new T_LeadNote(); } else { tNote = dc.T_Notes.SingleOrDefault(n => n.NoteID == entity.NoteID); tLeadNote = dc.T_LeadNotes.SingleOrDefault(n => n.NoteID == entity.NoteID); if (tNote == null || tLeadNote == null) { throw new ApplicationException("Note not found"); } } tNote.ntCreated = entity.Created; tNote.ntEdited = entity.Edited; tNote.ntText = entity.Text; dc.T_Notes.InsertOnSubmit(tNote); if (!entity.NoteID.HasValue) { dc.SubmitChanges(); } tLeadNote.NoteID = tNote.NoteID; tLeadNote.LeadID = leadID; dc.T_LeadNotes.InsertOnSubmit(tLeadNote); dc.SubmitChanges(); return tNote.NoteID; } }