Inheritance: System.Data.Objects.DataClasses.EntityObject
 /// <summary>
 /// Deprecated Method for adding a new object to the Notes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToNotes(Note note)
 {
     base.AddObject("Notes", note);
 }
 /// <summary>
 /// Create a new Note object.
 /// </summary>
 /// <param name="noteId">Initial value of the NoteId property.</param>
 /// <param name="body">Initial value of the Body property.</param>
 /// <param name="isArchived">Initial value of the IsArchived property.</param>
 /// <param name="sourceId">Initial value of the SourceId property.</param>
 /// <param name="sourceTypeId">Initial value of the SourceTypeId property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="modifiedBy">Initial value of the ModifiedBy property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Note CreateNote(global::System.Int32 noteId, global::System.String body, global::System.Boolean isArchived, global::System.Int32 sourceId, global::System.Int32 sourceTypeId, global::System.Int32 createdBy, global::System.DateTime createdDate, global::System.Int32 modifiedBy, global::System.DateTime modifiedDate)
 {
     Note note = new Note();
     note.NoteId = noteId;
     note.Body = body;
     note.IsArchived = isArchived;
     note.SourceId = sourceId;
     note.SourceTypeId = sourceTypeId;
     note.CreatedBy = createdBy;
     note.CreatedDate = createdDate;
     note.ModifiedBy = modifiedBy;
     note.ModifiedDate = modifiedDate;
     return note;
 }
        public NoteData Insert(NoteData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                           .GetManager(Database.ApplicationConnection, false))
            {
                var note = new Note();

                DataMapper.Map(data, note);

                ctx.ObjectContext.AddToNotes(note);

                ctx.ObjectContext.SaveChanges();

                data.NoteId = note.NoteId;

                return data;
            }
        }
        private void Fetch(Note note, NoteData noteData)
        {
            DataMapper.Map(note, noteData);

            noteData.Source = new SourceData();
            DataMapper.Map(note.Source, noteData.Source);

            noteData.CreatedByUser = new UserData();
            DataMapper.Map(note.CreatedByUser, noteData.CreatedByUser);

            noteData.ModifiedByUser = new UserData();
            DataMapper.Map(note.ModifiedByUser, noteData.ModifiedByUser);
        }
        public NoteData Update(NoteData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                         .GetManager(Database.ApplicationConnection, false))
            {
                var note =
                    new Note
                    {
                        NoteId = data.NoteId
                    };

                ctx.ObjectContext.Notes.Attach(note);

                DataMapper.Map(data, note);

                ctx.ObjectContext.SaveChanges();

                return data;
            }
        }
Beispiel #6
0
 internal static void Map(NoteData source, Note destination)
 {
     destination.NoteId = source.NoteId;
     destination.Body = source.Body;
     destination.IsArchived = source.IsArchived;
     destination.SourceId = source.SourceId;
     destination.SourceTypeId = source.SourceTypeId;
     destination.CreatedBy = source.CreatedBy;
     destination.CreatedDate = source.CreatedDate;
     destination.ModifiedBy = source.ModifiedBy;
     destination.ModifiedDate = source.ModifiedDate;
 }