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 frmKefWebDataEdit()
        {
            //
              // Default constructor (NEW)
              //
              InitializeComponent();

              CurrentID = new DBGuid(Guid.NewGuid());
              m_CurrentKefWebData = new KefWebData(CurrentID);
              m_bNewEntity = true;
              //pHeader.Text2 = "Új hír létrehozása";
              m_UpdateAction = false;
        }
        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;
              }
        }
        // -------------------------------------------------------------------------------------
        /// <summary>
        /// fill edit window controls
        /// </summary>
        // -------------------------------------------------------------------------------------
        private void RetrieveData()
        {
            try
              {
            // Get data
            IKefWebDataService srvKefWebData = ServiceFactory.GetKefWebDataService();
            IKefDownloadService srvKefDownloads = ServiceFactory.GetKefDownloadService();

            m_CurrentKefWebData = srvKefWebData.KefWebDataSelect(CurrentID);
            m_CurrentKefWebData.KefDownloads = srvKefWebData.SelectChildrenByKefWebDataOfKefDownload(CurrentID);

            foreach (KefDownload file in m_CurrentKefWebData.KefDownloads.All)
            {
              KefDownload fileData = srvKefDownloads.KefDownloadsSelectFile(file.ID);
              file.DownloadData = fileData.DownloadData;
            }

            cmbKefCategory.SelectedValue = m_CurrentKefWebData.KefCategoryRef;

            // Fill the controls
            txtTitle.Text = m_CurrentKefWebData.Title;
            txtSubTitle.Text = m_CurrentKefWebData.SubTitle;
            txtDescription.Text = m_CurrentKefWebData.Description;
            txtLink.Text = m_CurrentKefWebData.Link;
            cbxActivate.Checked = m_CurrentKefWebData.IsActive;
            cbxManual.Checked = m_CurrentKefWebData.IsManual;

            // 2nd page
            FillDatagrid(DBGuid.Null);
            if (m_CurrentKefWebData != null && m_CurrentKefWebData.KefCategoryRef.ToString().Trim() == "AKTUALIS")
            {
              m_isActualitas = true;
            }
            //lvRankDoc.Visible = m_isActualitas;
            //btnUpDoc.Visible = m_isActualitas;
            //btnDownDoc.Visible = m_isActualitas;
            groupBox1.Visible = m_isActualitas;
            FillListViewDoc();
              }
              catch (Exception ex)
              {
            //	---	Log exception
            ExceptionManager.Publish(ex);
            //	---	Display Exception
            ErrorHandler.DisplayError("Hiba lépett fel az adatok lekérdezése során", ex);
            //	---	invisible btnOk button
            btnOk.Visible = false;
              }
        }
        private void FillListView()
        {
            try
              {
            lvRank.Items.Clear();
            IKefWebDataService srvKefWebData = ServiceFactory.GetKefWebDataService();
            DBInt filterOnIsActive;
            if (CurrentID == DBGuid.Null || CurrentID.IsNull)
            {
              filterOnIsActive = 1;
            }
            else
            {
              if (m_CurrentKefWebData == null)
              {
            m_CurrentKefWebData = srvKefWebData.KefWebDataSelect(CurrentID);
              }
              if (m_CurrentKefWebData != null)
              {
            filterOnIsActive = Convert.ToInt32(m_CurrentKefWebData.IsActive);
              }
              else
              {
            filterOnIsActive = 1;
              }
            }
            m_CurrentKefWebDataContainer = srvKefWebData.KefCategoryOfKefWebDataSelectByIsActive("AKTUALIS ", 1);

            foreach (KefWebData item in m_CurrentKefWebDataContainer.Current)
            {
              string uid = item.ID.ToString();

              string[] subitem = { uid, item.Title, item.Description, item.LinkRank.ToString() };
              ListViewItem litem = new ListViewItem(subitem);
              lvRank.Items.Add(litem);
              lvRank.Sorting = SortOrder.Ascending;
            }
            lvRank.ListViewItemSorter = new ListViewItemComparer(3, lvRank.Sorting, true);
              }
              catch (Exception ex)
              {
            //	---	Log exception
            ExceptionManager.Publish(ex);
            //	---	Display Exception
            ErrorHandler.DisplayError("Nem várt hiba a lista frissítése során.", ex);
              }
        }
Exemple #6
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public KefWebData(KefWebData origInstance)
     : base(origInstance)
 {
 }
Exemple #7
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="IDVal">Value of 'uID' field</param>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public KefWebData(DBGuid IDVal,
               KefWebData origInstance)
     : base(IDVal, origInstance)
 {
 }
 public virtual void KefWebDataUpdate(KefWebData entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdKefWebDataUpdate(entity.ID,
                                       entity.KefCategoryRef,
                                       entity.Title,
                                       entity.SubTitle,
                                       entity.ShortDescription,
                                       entity.Description,
                                       entity.Link,
                                       entity.IsActive,
                                       entity.LinkRank,
                                       entity.IsManual,
                                       entity.CreatedDate, out count);
       if (count == 0) throw new ServiceUpdateException();
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
 public virtual KefWebData KefWebDataSelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     KefWebData result = null;
     DataSet entitySet = m_DataContext.ndihdKefWebDataSelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new KefWebData(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
 public virtual void KefWebDataDelete(KefWebData entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdKefWebDataDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }