コード例 #1
0
		private void detach_T_ActivityNotes(T_ActivityNote entity)
		{
			this.SendPropertyChanging();
			entity.T_Note = null;
		}
コード例 #2
0
 partial void DeleteT_ActivityNote(T_ActivityNote instance);
コード例 #3
0
 partial void UpdateT_ActivityNote(T_ActivityNote instance);
コード例 #4
0
 partial void InsertT_ActivityNote(T_ActivityNote instance);
コード例 #5
0
		private void attach_T_ActivityNotes(T_ActivityNote entity)
		{
			this.SendPropertyChanging();
			entity.T_Activity = this;
		}
コード例 #6
0
		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;
			}
		}