public new void JobFindAttachmentDelete(JobFindAttachment entity)
        {
            // check permission: admin
              PrincipalPermission permReg = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Registered");
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permReg.Union(permAdmin).Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            FileDataContext fileDataContext = new FileDataContext();
            string ext = Path.GetExtension(entity.Path).ToLower();
            string fileName = entity.ID.ToString() + ext;
            fileDataContext.JobFindAttachmentDelete(entity.JobFindRef, fileName);
            base.JobFindAttachmentDelete(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 JobFindAttachmentDelete(JobFindAttachment entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdJobFindAttachmentDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
Пример #3
0
        /// <summary>
        /// Handles the Click event of the btnCreate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            try
              {
            if (!Page.IsValid)
            {
              return;
            }

            Guid jobFindGuid = Guid.NewGuid();
            JobFind job = new JobFind(jobFindGuid);
            job.Description = txtDescription.Text;
            job.City = txtCity.Text;

            job.RegionRef = cmbRegion.SelectedValue;
            job.ActivityPrevention = cbxPrevention.Checked;
            job.ActivityResearch = cbxResearch.Checked;
            job.ActivityRehabilitation = cbxRehabilitation.Checked;
            job.ActivityOther = cbxOther.Checked;
            job.Expiredate = Convert.ToDateTime(txtExpiredate.Text);
            job.NotificationDate = job.Expiredate.AddDays(-1*Convert.ToInt32(txtNotificationDate.Text));

            IJobFindService jobSrv = ServiceFactory.GetJobFindService();
            //akar feltölteni önéletrajzot

            #region önéletrajz feltöltés

            //kiválasztott egy file-t
            if (fileUpload.PostedFile != null && fileUpload.PostedFile.ContentLength != 0)
            {
              Guid attachmentID = Guid.NewGuid();
              JobFindAttachment attachment = new JobFindAttachment(attachmentID);
              attachment.Name = txtFileName.Text.Length == 0 ? attachmentID.ToString() : txtFileName.Text;
              attachment.Description = txtFileDesc.Text.Length == 0 ? "" : txtFileDesc.Text;
              string fileName = Path.GetFileName(fileUpload.PostedFile.FileName);
              attachment.Path = fileName;

              BinaryReader reader = new BinaryReader(fileUpload.PostedFile.InputStream);
              byte[] buffer = new byte[fileUpload.PostedFile.ContentLength];
              reader.Read(buffer, 0, fileUpload.PostedFile.ContentLength);
              attachment.FileData = buffer;

              job.JobFindAttachments.Add(attachment);
            }

            #endregion

            jobSrv.JobFindInsert(job);

            Response.Redirect(string.Format("JobFindData.aspx?jobId={0}&sender={1}", job.ID, Context.User.Identity.Name));
              }
              catch (Exception ex)
              {
            errorPanel.Exception = ex;
              }
        }
 public virtual void JobFindAttachmentUpdate(JobFindAttachment entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdJobFindAttachmentUpdate(entity.ID,
     entity.JobFindRef,
     entity.Path,
     entity.Name,
     entity.Description,
     entity.CreatedDate,
     entity.FileSize,
     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 JobFindAttachment JobFindAttachmentSelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     JobFindAttachment result = null;
     DataSet entitySet = m_DataContext.ndihdJobFindAttachmentSelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new JobFindAttachment(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
        public new void JobFindAttachmentUpdate(JobFindAttachment entity)
        {
            // check permission: admin
              PrincipalPermission permReg = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Registered");
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permReg.Union(permAdmin).Demand();

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

            BusinessAuditEvent.Success(
              new EventParameter("JobFindAttachmentID", 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 JobFindAttachmentInsert(JobFindAttachment entity)
        {
            // check permission: admin
              PrincipalPermission permReg = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Registered");
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permReg.Union(permAdmin).Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            // check required fields:
            if (entity.Name.Length == 0)
              throw new ArgumentNullException("JobFindAttachment.Name", "A csatolt fájl aláírása nincs megadva.");
            if (entity.Path.Length == 0)
              throw new ArgumentNullException("JobFindAttachment.Path", "A csatolt fájl neve nincs megadva.");
            if (entity.FileData == null || entity.FileData.Length == 0)
              throw new ArgumentNullException("JobFindAttachment.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.JobFindAttachmentInsert(entity.JobFindRef, fileName, entity.FileData);
            entity.FileSize = entity.FileData.Length;
            entity.CreatedDate = DateTime.Now;
            base.JobFindAttachmentInsert(entity);

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