public new void DesignerDrogAttachmentInsert( DesignerDrogAttachment 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( "DesignerDrogAttachment.Name", "A csatolt fájl aláírása nincs megadva." ); if (entity.Path.Length == 0) throw new ArgumentNullException( "DesignerDrogAttachment.Path", "A csatolt fájl neve nincs megadva." ); if (entity.FileData == null || entity.FileData.Length == 0) throw new ArgumentNullException( "DesignerDrogAttachment.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.DesignerDrogAttachmentInsert( entity.ItemRef, fileName, entity.FileData ); entity.FileSize = entity.FileData.Length; entity.CreatedDate = DateTime.Now; base.DesignerDrogAttachmentInsert( entity ); BusinessAuditEvent.Success(); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish( ex ); BusinessAuditEvent.Fail( new EventParameter( "Exception", ex.ToString() ) ); TraceCallReturnEvent.Raise( false ); throw; } }