Example #1
0
        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);
        }
Example #2
0
 public void AddGeneralNote(string note, AttachmentReference attachment = null)
 {
     AddNote(new NoteWithAttachment()
     {
         Note         = note,
         RealDate     = DateTime.Now,
         RegisterDate = DateTime.Now,
         Attachment   = attachment
     });
 }
Example #3
0
 public void AddGeneralNote(string note, AttachmentReference attachment = null)
 {
     AddNote(new NoteWithAttachment()
     {
         Note = note,
         RealDate = DateTime.Now,
         RegisterDate = DateTime.Now,
         Attachment = attachment
     });
 }
Example #4
0
 public void AddGeneralNote(string note, AttachmentReference attachment = null)
 {
     AddNote(new ApplicantNote()
     {
         Note = note,
         NoteType = ApplicantNoteType.GeneralNote,
         RealDate = DateTime.Now,
         RegisterDate = DateTime.Now,
         Attachment = attachment
     });
 }
Example #5
0
 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);
            }
        }
Example #7
0
        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;
        }