public new void EDocumentAttachmentsDelete(EDocumentAttachments 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.Path).ToLower();
            string fileName = entity.ID.ToString() + ext;
            fileDataContext.EDocumentAttachmentDelete(entity.EDocumentRef, fileName);
            base.EDocumentAttachmentsDelete(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 EDocumentAttachmentsDelete(EDocumentAttachments entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdEDocumentAttachmentsDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
Ejemplo n.º 3
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public EDocumentAttachments(EDocumentAttachments origInstance)
     : base(origInstance)
 {
 }
Ejemplo n.º 4
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="IDVal">Value of 'uID' field</param>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public EDocumentAttachments(DBGuid IDVal,
                         EDocumentAttachments origInstance)
     : base(IDVal, origInstance)
 {
 }
        public new void EDocumentAttachmentsUpdate(EDocumentAttachments entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

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

            BusinessAuditEvent.Success(
              new EventParameter("EDocumentAttachmentsID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("ContinuativeID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
        public new void EDocumentAttachmentsInsert(EDocumentAttachments entity)
        {
            // check permission: admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            // check required fields:
            if (entity.Name.Length == 0)
              throw new ArgumentNullException("EDocumentAttachments.Name", "A csatolt fájl aláírása nincs megadva.");
            if (entity.Path.Length == 0)
              throw new ArgumentNullException("EDocumentAttachments.Path", "A csatolt fájl neve nincs megadva.");
            if (entity.FileData == null || entity.FileData.Length == 0)
              throw new ArgumentNullException("EDocumentAttachments.FileData",
                                          "A csatolt fájl nincs megadva, vagy nem létezik.");

            // logical checks:
            string ext = Path.GetExtension(entity.Path).ToLower();
            FileDataContext fileDataContext = new FileDataContext();
            string fileName = entity.ID.ToString() + ext;
            fileDataContext.EDocumentAttachmentInsert(entity.EDocumentRef, fileName, entity.FileData);
            entity.FileSize = entity.FileData.Length;
            entity.CreatedDate = DateTime.Now;
            base.EDocumentAttachmentsInsert(entity);

            BusinessAuditEvent.Success();
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString())
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Add a NewsPicture to the list.
        /// </summary>
        private void AddFile()
        {
            // Validate controls
              if (txtFilePath.Text.Length == 0)
              {
            MessageBox.Show("A fájl nincs megadva. Válassza ki a kívánt fájlt!",
                        "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information);
            btnFile.Select();
            return;
              }
              if (txtFileTitle.Text.Length == 0)
              {
            MessageBox.Show("A fájlaláírás nincs megadva. Adja meg a fájlaláírást a beviteli mezõben!",
                        "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information);
            txtFileTitle.Select();
            return;
              }

              if (!File.Exists(txtFilePath.Text))
              {
            MessageBox.Show("A fájl nem található. Válassza ki a fájlt képet!",
                        "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information);
            btnFile.Select();
            return;
              }

              try
              {
            // Add to container
            EDocumentAttachments item = new EDocumentAttachments(new DBGuid(Guid.NewGuid()));
            item.EDocumentRef = CurrentID;
            item.Name = txtFileTitle.Text;
            item.Path = Path.GetFileName(txtFilePath.Text);

            // Get picture data
            FileStream stream = new FileStream(txtFilePath.Text, FileMode.Open, FileAccess.Read);
            int fileSize = Convert.ToInt32(stream.Length);
            item.FileData = new byte[fileSize];
            item.FileSize = fileSize;
            item.CreatedDate = DateTime.Now;
            stream.Read(item.FileData, 0, fileSize);
            stream.Close();

            //item.PicturePath = this.m_strPictureUrlOther;
            m_currentDocument.EDocumentAttachments.Add(item);

            // Refresh grid
            FillDatagrid(item.ID);

            txtFileTitle.Text = "";
            txtFilePath.Text = "";
              }
              catch (Exception ex)
              {
            //	---	Log exception
            ExceptionManager.Publish(ex);
            //	---	Display Exception
            ErrorHandler.DisplayError("Nem várt hiba lépett fel a kép hozzáadása során.", ex);
              }
        }
 public virtual void EDocumentAttachmentsUpdate(EDocumentAttachments entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdEDocumentAttachmentsUpdate(entity.ID,
                                                 entity.EDocumentRef,
                                                 entity.Path,
                                                 entity.Name,
                                                 entity.CreatedDate,
                                                 entity.FileSize, 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 EDocumentAttachments EDocumentAttachmentsSelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     EDocumentAttachments result = null;
     DataSet entitySet = m_DataContext.ndihdEDocumentAttachmentsSelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new EDocumentAttachments(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
 public virtual void EDocumentAttachmentsInsert(EDocumentAttachments entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdEDocumentAttachmentsInsert(entity.ID,
                                                 entity.EDocumentRef,
                                                 entity.Path,
                                                 entity.Name,
                                                 entity.CreatedDate,
                                                 entity.FileSize);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }