public new void EDocumentPictureDelete(EDocumentPicture entity)
        {
            // check permission: admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            FileDataContext fileDataContext = new FileDataContext();
            string ext = Path.GetExtension(entity.PictureUrl).ToLower();
            string fileName = entity.ID.ToString() + ext;
            fileDataContext.EDocumentPictureDelete(entity.EDocumentRef, fileName);
            base.EDocumentPictureDelete(entity);

            BusinessAuditEvent.Success();
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString())
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
 public virtual void EDocumentPictureDelete(EDocumentPicture entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdEDocumentPictureDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
 public virtual void EDocumentPictureUpdate(EDocumentPicture entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdEDocumentPictureUpdate(entity.ID,
     entity.Title,
     entity.PictureUrl,
     entity.EDocumentRef, 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 EDocumentPicture EDocumentPictureSelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     EDocumentPicture result = null;
     DataSet entitySet = m_DataContext.ndihdEDocumentPictureSelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new EDocumentPicture(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
        public new void EDocumentPictureInsert(EDocumentPicture 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("EDocumentPicture.Title", "A képaláírás nincs megadva.");
            if (entity.PictureUrl.Length == 0 || entity.PictureUrl == DBString.Null)
              throw new ArgumentNullException("EDocumentPicture.PictureUrl", "A fájlnév nincs megadva.");

            if (entity.PictureData == null || entity.PictureData.Length == 0)
              throw new ArgumentNullException("EDocumentPicture.PictureData", "A kép nincs megadva.");

            // logical checks:
            string ext = Path.GetExtension(entity.PictureUrl).ToLower();
            if (!(ext.Equals(".gif") || ext.Equals(".jpg") || ext.Equals(".jpeg")))
              throw new ApplicationException("Csak jpeg vagy gif formátumú kép csatolható.");

            FileDataContext fileDataContext = new FileDataContext();
            string fileName = entity.ID.ToString() + ext;
            fileDataContext.EDocumentPictureInsert(entity.EDocumentRef, fileName, entity.PictureData);
            base.EDocumentPictureInsert(entity);

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