public new void EmailAttachmentInsert(EmailAttachment entity) { // check permission: admin PrincipalPermission permReg = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Registered"); PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permReg.Union(permAdmin).Demand(); TraceCallEnterEvent.Raise(); try { // check required fields: if (entity.Name.Length == 0) throw new ArgumentNullException("EmailAttachment.Name", "A csatolt fájl aláírása nincs megadva."); if (entity.Path.Length == 0) throw new ArgumentNullException("EmailAttachment.Path", "A csatolt fájl neve nincs megadva."); if (entity.FileData == null || entity.FileData.Length == 0) throw new ArgumentNullException("EmailAttachment.FileData", "A csatolt fájl nincs megadva, vagy nem létezik."); // logical checks: string ext = Path.GetExtension(entity.Path).ToLower(); FileDataContext fileDataContext = new FileDataContext(); string fileName = entity.ID.ToString() + ext; fileDataContext.EmailAttachmentInsert(entity.EmailRef, fileName, entity.FileData); entity.FileSize = entity.FileData.Length; entity.CreatedDate = DateTime.Now; base.EmailAttachmentInsert(entity); BusinessAuditEvent.Success(); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()) ); TraceCallReturnEvent.Raise(false); throw; } }