public new void KefWebDataUpdate(KefWebData 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("KefWebData.Title", "Az oldal címe nincs megadva."); if (entity.KefCategoryRef.Length == 0) throw new ArgumentNullException("KefWebData.KefWebDataRef", "Az oldal típusa nincs megadva."); // Logical checks KefWebData selected = KefWebDataSelect(entity.ID); if (selected == null) throw new ApplicationException("A megadott azonosítóval nem létezik KEF oldal."); // Save data selected.KefCategoryRef = entity.KefCategoryRef; selected.Title = entity.Title; selected.SubTitle = entity.SubTitle; selected.ShortDescription = entity.ShortDescription; selected.Description = entity.Description; selected.Link = entity.Link; selected.IsActive = entity.IsActive; selected.IsManual = entity.IsManual; KefDownloadService srvKefDownload = new KefDownloadService(m_DataContext); FileDataContext fileDataContext = new FileDataContext(); m_DataContext.BeginNestedTran(); try { // Clear old files: KefDownloadContainer oldFiles = base.SelectChildrenByKefWebDataOfKefDownload(entity.ID); foreach (KefDownload oldFile in oldFiles.All) { srvKefDownload.KefDownloadDelete(oldFile); } // NewsPicture - insert: foreach (KefDownload file in entity.KefDownloads.Current) { srvKefDownload.KefDownloadInsert(file); } if (selected.IsManual) //ha KEF kézikönyv akkor minden elõzõt törlünk m_DataContext.ndihdKefWebDataUpdateManual(selected.KefCategoryRef); // News - save base.KefWebDataUpdate(selected); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } BusinessAuditEvent.Success( new EventParameter("NewsID", entity.ID.ToString()), new EventParameter("NewsTitle", entity.Title) ); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()), new EventParameter("NewsID", entity.ID.ToString()), new EventParameter("NewsTitle", entity.Title) ); TraceCallReturnEvent.Raise(false); throw; } }
public new void KefWebDataInsert(KefWebData 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("KefWebData.Title", "Az oldal címe nincs megadva."); if (entity.KefCategoryRef.Length == 0) throw new ArgumentNullException("KefWebData.KefWebDataRef", "Az oldal típusa nincs megadva."); // save data KefDownloadService srvKewDownload = new KefDownloadService(m_DataContext); m_DataContext.BeginNestedTran(); try { // KefWebData base.KefWebDataInsert(entity); // NewsPictures foreach (KefDownload file in entity.KefDownloads.Current) { srvKewDownload.KefDownloadInsert(file); } m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } BusinessAuditEvent.Success( new EventParameter("KefWebDataID", entity.ID.ToString()), new EventParameter("KefWebDataTitle", entity.Title) ); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()), new EventParameter("KefWebDataID", entity.ID.ToString()), new EventParameter("KefWebDataTitle", entity.Title) ); TraceCallReturnEvent.Raise(false); throw; } }