public new void JobOfferAttachmentDelete(JobOfferAttachment 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.JobOfferAttachmentDelete(entity.JobOfferRef, fileName);
            base.JobOfferAttachmentDelete(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 JobOfferAttachmentDelete(JobOfferAttachment entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdJobOfferAttachmentDelete(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 JobOfferAttachmentUpdate(JobOfferAttachment entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdJobOfferAttachmentUpdate(entity.ID,
     entity.JobOfferRef,
     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 JobOfferAttachment JobOfferAttachmentSelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     JobOfferAttachment result = null;
     DataSet entitySet = m_DataContext.ndihdJobOfferAttachmentSelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new JobOfferAttachment(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
        public new void JobOfferAttachmentUpdate(JobOfferAttachment 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.JobOfferAttachmentUpdate(entity);

            BusinessAuditEvent.Success(
              new EventParameter("JobOfferAttachmentID", 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 JobOfferAttachmentInsert(JobOfferAttachment 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("JobOfferAttachment.Name", "A csatolt fájl aláírása nincs megadva.");
            if (entity.Path.Length == 0)
              throw new ArgumentNullException("JobOfferAttachment.Path", "A csatolt fájl neve nincs megadva.");
            if (entity.FileData == null || entity.FileData.Length == 0)
              throw new ArgumentNullException("JobOfferAttachment.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.JobOfferAttachmentInsert(entity.JobOfferRef, fileName, entity.FileData);
            entity.FileSize = entity.FileData.Length;
            entity.CreatedDate = DateTime.Now;
            base.JobOfferAttachmentInsert(entity);

            BusinessAuditEvent.Success();
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString())
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
        /// <summary>
        /// Handles the Click event of the btnModify 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 btnModify_Click(object sender, EventArgs e)
        {
            try
              {
            if (!Page.IsValid)
            {
              return;
            }

            m_Job.Description = txtDescription.Text;
            m_Job.City = txtCity.Text;

            m_Job.RegionRef = cmbRegion.SelectedValue;
            m_Job.ActivityPrevention = cbxPrevention.Checked;
            m_Job.ActivityResearch = cbxResearch.Checked;
            m_Job.ActivityRehabilitation = cbxRehabilitation.Checked;
            m_Job.ActivityOther = cbxOther.Checked;
            m_Job.Expiredate = Convert.ToDateTime(txtExpiredate.Text);
            m_Job.NotificationDate = DateTime.Now.AddDays(Convert.ToInt32(txtNotificationDate.Text));

            m_Job.Requirements = txtRequirements.Text;
            m_Job.QualificationMinRef = cmbQualification.SelectedValue;
            m_Job.IdealEmployee = txtIdealEmployee.Text;
            if (txtEmployeeCount.Text.Length > 0)
              m_Job.EmployeeCount = Convert.ToInt16(txtEmployeeCount.Text);
            m_Job.HomePage = txtHomePage.Text;
            m_Job.ContactName = txtContactName.Text;
            m_Job.ContactPhone = txtContactPhone.Text;
            m_Job.ContactEmail = txtContactEmail.Text;

            IJobOfferService jobSrv = ServiceFactory.GetJobOfferService();
            //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();
              JobOfferAttachment attachment = new JobOfferAttachment(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;

              m_Job.JobOfferAttachments.Add(attachment);
            }

            #endregion

            jobSrv.JobOfferUpdate(m_Job);

            Response.Redirect(string.Format("JobOfferData.aspx?jobId={0}&sender={1}", m_JobId, Context.User.Identity.Name));
              }
              catch (Exception ex)
              {
            errorPanel.Exception = ex;
              }
        }
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public JobOfferAttachment(JobOfferAttachment 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 JobOfferAttachment(DBGuid IDVal,
                       JobOfferAttachment origInstance)
     : base(IDVal, origInstance)
 {
 }