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

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

            DesignerDrogCategoryContainer cont = DesignerDrogCategorySelectAll();
            foreach (DesignerDrogCategory cat in cont.All)
            {
                if (cat.IsActive && cat.Rank > maxRank)
                {
                    maxRank = cat.Rank;
                }
            }

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

            BusinessAuditEvent.Success(
              new EventParameter( "DesignerDrogCategoryID", entity.ID )
              );
            TraceCallReturnEvent.Raise();
            return;
            }
            catch (Exception ex)
            {
            ExceptionManager.Publish( ex );
            BusinessAuditEvent.Fail(
              new EventParameter( "Exception", ex.ToString() ),
              new EventParameter( "DesignerDrogCategoryID", entity.ID ) );
            TraceCallReturnEvent.Raise( false );
            throw;
            }
        }
 public virtual void DesignerDrogCategoryUpdate(DesignerDrogCategory entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdDesignerDrogCategoryUpdate(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 DesignerDrogCategory DesignerDrogCategorySelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     DesignerDrogCategory result = null;
     DataSet entitySet = m_DataContext.ndihdDesignerDrogCategorySelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new DesignerDrogCategory(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
 public virtual void DesignerDrogCategoryDelete(DesignerDrogCategory entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdDesignerDrogCategoryDelete(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 DesignerDrogCategoryUpdate( DesignerDrogCategory entity )
        {
            //check permission: Admin
            PrincipalPermission permAdm = new PrincipalPermission( Thread.CurrentPrincipal.Identity.Name, "Administrator" );
            permAdm.Demand();

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

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