public void NewsCategoryActivate(NewsCategory entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            int maxRank = 0;

            NewsCategoryContainer cont = NewsCategorySelectAll();
            foreach (NewsCategory cat in cont.All)
            {
              if (cat.IsActive && cat.Rank > maxRank)
              {
            maxRank = cat.Rank;
              }
            }

            entity.IsActive = true;
            entity.Rank = maxRank + 1;
            base.NewsCategoryUpdate(entity);

            BusinessAuditEvent.Success(
              new EventParameter("NewsCategoryID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("NewsCategoryID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
 public virtual void NewsCategoryUpdate(NewsCategory entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdNewsCategoryUpdate(entity.ID,
                                         entity.Name,
                                         entity.Description,
                                         entity.ShowMaxCount,
                                         entity.Rank,
                                         entity.IsActive, 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 NewsCategory NewsCategorySelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     NewsCategory result = null;
     DataSet entitySet = m_DataContext.ndihdNewsCategorySelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new NewsCategory(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
 public virtual void NewsCategoryDelete(NewsCategory entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdNewsCategoryDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
        public new void NewsCategoryUpdate(NewsCategory entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            base.NewsCategoryUpdate(entity);

            BusinessAuditEvent.Success(
              new EventParameter("NewsCategoryID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("NewsCategoryID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Esempio n. 6
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="IDVal">Value of 'uID' field</param>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public NewsCategory(DBGuid IDVal,
                 NewsCategory origInstance)
     : base(IDVal, origInstance)
 {
 }
Esempio n. 7
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public NewsCategory(NewsCategory origInstance)
     : base(origInstance)
 {
 }