public SlotWithAttachment AddAttachment(AttachmentReference attachmentReference, AttachmentSlot slot) { if (AttachmentsBySlot == null) { AttachmentsBySlot = new List <SlotWithAttachment>(); } else if (AttachmentsBySlot.Any(x => x.SlotId == slot.Id && x.Attachment != null)) { log.Dump( LogLevel.Error, new { slot, attachmentReference }, "Slot is not free"); throw new ApplicationException(string.Format("Slot `{0}` is not free", slot.Id)); } else { AttachmentsBySlot.RemoveAll(x => x.Attachment == null); } var added = new SlotWithAttachment() { Date = DateTime.Now, Attachment = attachmentReference, SlotId = slot.Id }; AttachmentsBySlot.Add(added); return(added); }
public void AddGeneralNote(string note, AttachmentReference attachment = null) { AddNote(new NoteWithAttachment() { Note = note, RealDate = DateTime.Now, RegisterDate = DateTime.Now, Attachment = attachment }); }
public void AddGeneralNote(string note, AttachmentReference attachment = null) { AddNote(new ApplicantNote() { Note = note, NoteType = ApplicantNoteType.GeneralNote, RealDate = DateTime.Now, RegisterDate = DateTime.Now, Attachment = attachment }); }
private static void QuickAttachToNotes(Employee employee, AttachmentReference[] attachments) { var notes = attachments.Select(x => new NoteWithAttachment() { Attachment = x, Note = "QuickAttachment!", RealDate = DateTime.Now, RegisterDate = DateTime.Now }); if (employee.Notes == null) { employee.Notes = notes.ToList(); } else { employee.Notes.AddRange(notes); } }
public SlotWithAttachment AddAttachment(AttachmentReference attachmentReference, AttachmentSlot slot) { if (AttachmentsBySlot == null) { AttachmentsBySlot = new List<SlotWithAttachment>(); } else if (AttachmentsBySlot.Any(x => x.SlotId == slot.Id && x.Attachment != null)) { log.Dump( LogLevel.Error, new { slot, attachmentReference }, "Slot is not free"); throw new ApplicationException(string.Format("Slot `{0}` is not free", slot.Id)); } else { AttachmentsBySlot.RemoveAll(x => x.Attachment == null); } var added = new SlotWithAttachment() { Date = DateTime.Now, Attachment = attachmentReference, SlotId = slot.Id }; AttachmentsBySlot.Add(added); return added; }