public new void EDocumentPictureInsert(EDocumentPicture entity) { // check permission: admin PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permAdmin.Demand(); TraceCallEnterEvent.Raise(); try { // check required fields: if (entity.Title.Length == 0) throw new ArgumentNullException("EDocumentPicture.Title", "A képaláírás nincs megadva."); if (entity.PictureUrl.Length == 0 || entity.PictureUrl == DBString.Null) throw new ArgumentNullException("EDocumentPicture.PictureUrl", "A fájlnév nincs megadva."); if (entity.PictureData == null || entity.PictureData.Length == 0) throw new ArgumentNullException("EDocumentPicture.PictureData", "A kép nincs megadva."); // logical checks: string ext = Path.GetExtension(entity.PictureUrl).ToLower(); if (!(ext.Equals(".gif") || ext.Equals(".jpg") || ext.Equals(".jpeg"))) throw new ApplicationException("Csak jpeg vagy gif formátumú kép csatolható."); FileDataContext fileDataContext = new FileDataContext(); string fileName = entity.ID.ToString() + ext; fileDataContext.EDocumentPictureInsert(entity.EDocumentRef, fileName, entity.PictureData); base.EDocumentPictureInsert(entity); BusinessAuditEvent.Success(); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()) ); TraceCallReturnEvent.Raise(false); throw; } }