public Boolean AddRecord(Object _notesobj) { Boolean flag = false; NotesDoc note = (NotesDoc)_notesobj; try { Note _note = new Note(); if (note.Type!= null) { _note.Type = Convert.ToInt32(note.Type); } if (note.RefID!= null) { _note.RefID = Convert.ToInt64(note.RefID); } if (note.NoteDesc!= null) { _note.NoteDesc = note.NoteDesc; } _note.CreateBy = note.CreateBy; _note.CreateDate = DateTime.Now; if ((note.NoteDesc != null)&&(!String.IsNullOrEmpty(note.NoteDesc))) { flag = DAL.DALNotes.CreateNotes(_note); } } catch (Exception ex) { throw; } return flag; }
public static Boolean CreateNotes(Note _Notes) { Boolean flag = false; using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.Notes.AddObject(_Notes); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); flag = true; } catch (Exception ex) { context.Dispose(); throw; } } } return flag; }
/// <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="isDeleted">Initial value of the IsDeleted property.</param> public static Note CreateNote(global::System.Int32 id, global::System.Int32 isDeleted) { Note note = new Note(); note.ID = id; note.IsDeleted = isDeleted; return note; }