public new void KefDownloadInsert(KefDownload entity) { // check permission: admin PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permAdmin.Demand(); TraceCallEnterEvent.Raise(); try { // check required fields: //if(entity.Name.Length == 0) throw new ArgumentNullException("KefDownload.Title", "A fájlnév nincs megadva."); if (entity.Path.Length == 0 || entity.Path == DBString.Null) throw new ArgumentNullException("KefDownload.PictureUrl", "A fájl útvonal nincs megadva."); if (entity.DownloadData == null || entity.DownloadData.Length == 0) throw new ArgumentNullException("KefDownload.DownloadData", "A file nincs megadva."); if (entity.Description.Length == 0) throw new ArgumentNullException("KefDownload.Description", "A csatolt fájl leírása nincs megadva."); string fileName = entity.ID.ToString() + Path.GetExtension(entity.Path).ToLower(); // save data FileDataContext fileDataContext = new FileDataContext(); fileDataContext.KefDownloadInsert(entity.KefWebDataRef, fileName, entity.DownloadData); entity.CreatedDate = DBDateTime.Now; entity.IsActive = true; entity.FileSize = entity.DownloadData.Length; base.KefDownloadInsert(entity); BusinessAuditEvent.Success( new EventParameter("KefDownloadID", entity.ID.ToString()), new EventParameter("KefDownloadName", entity.Name), new EventParameter("KefWebDataID", entity.KefWebDataRef.ToString()) ); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()) ); TraceCallReturnEvent.Raise(false); throw; } }