internal IResult <Note> Execute(INotebookKey notebookKey, DateTime timestamp, ICreateNoteParameters parameters) { if (notebookKey == null) { throw new ArgumentNullException("notebookKey"); } if (timestamp == null) { throw new ArgumentNullException("timestamp"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } var employeeResult = new GetEmployeeCommand(_notebookUnitOfWork).GetEmployee(parameters); if (!employeeResult.Success) { return(employeeResult.ConvertTo((Note)null)); } var notebookKeyFind = new NotebookKey(notebookKey); var notebook = _notebookUnitOfWork.NotebookRepository.FindByKey(notebookKeyFind); if (notebook == null) { return(new InvalidResult <Note>(null, string.Format(UserMessages.NotebookNotFound, notebookKeyFind))); } return(Execute(notebook, timestamp, employeeResult.ResultingObject, parameters.Text)); }
public Note ToNote(INotebookKey notebookKey = null, int sequence = 0) { var note = new Note { EmployeeId = new EmployeeKey().Parse(EmployeeKey).EmployeeKey_Id, TimeStamp = TimeStamp, Text = Text }; if (notebookKey != null) { note.NotebookDate = notebookKey.NotebookKey_Date; note.NotebookSequence = notebookKey.NotebookKey_Sequence; } note.Sequence = sequence; return(note); }
internal static Note SetNote(this Note note, INotebookKey notebookKey, string text = null) { if (note == null) { throw new ArgumentNullException("note"); } if (notebookKey != null) { note.Notebook = null; note.NotebookDate = notebookKey.NotebookKey_Date; note.NotebookSequence = notebookKey.NotebookKey_Sequence; } if (text != null) { note.Text = text; } return(note); }
public static NotebookKey ToNotebookKey(this INotebookKey k) { return(new NotebookKey(k)); }
public static Expression <Func <Contract, bool> > ContractByCommentsNotebook(INotebookKey notebookKey) { return(c => c.CommentsDate == notebookKey.NotebookKey_Date && c.CommentsSequence == notebookKey.NotebookKey_Sequence); }
public static List <Note> ToNotes(this IEnumerable <SerializableNote> serializableNotes, INotebookKey notebookKey) { return(serializableNotes != null?serializableNotes.Select((note, i) => note.ToNote(notebookKey, i + 1)).ToList() : new List <Note>()); }
public static Contract GetContractForSynch(this IRepository <Contract> contractRepository, INotebookKey commentsNotebookKey) { return(contractRepository.FindBy(Expressions.ContractByCommentsNotebook(commentsNotebookKey), Expressions.SynchContractPaths)); }