protected void btnModify_Click(object sender, EventArgs e)
 {
     m_Job = m_srvJob.JobFindSelect(m_JobId);
       if (m_Job.Sender.Equals(Context.User.Identity.Name))
       {
     Response.Redirect("JobFindModify.aspx?jobId=" + m_Job.ID);
       }
 }
        /// <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 void JobFindInactivateExpired()
        {
            TraceCallEnterEvent.Raise();
              try
              {
            // Save data
            //m_DataContext.ndihdJobFindSetStatus(entity.ID, entity.Status);

            //ki kell keresni azokat az aktív hirdetéseket, amiknek a lejárati dátuma már eljött, de még aktívak
            JobFind filter = new JobFind(Guid.Empty);
            filter.Status = JobStatusEnum.ACT;
            filter.Expiredate = DateTime.Now;

            JobFindContainer finds = JobFindSelectFiltered(filter);

            string body = "";
            string subject = "";
            EmailTemplateService srvTemplate = new EmailTemplateService();
            srvTemplate.GetEmailTemplateByCode(ref subject, ref body, EmailCategory.JobExpired);

            UserService srvUser = new UserService();

            foreach (JobFind find in finds.All)
            {
              string bodynew;
              User sender = srvUser.UserSelect(find.Sender);
              find.LastModified = DateTime.Now;
              find.Status = JobStatusEnum.EXP;
              JobFindSetStatus(find); //inaktiváljuk
              //küldünk egy levelet a barátunknak
              bodynew = body.Replace("<FULL_USER_NAME>", sender == null ? find.Sender : sender.Name);
              bodynew = bodynew.Replace("<JOB_REFID>", find.RefId.ToString());
              bodynew = bodynew.Replace("<JOB_DESCRIPTION>", find.Description);
              bodynew = bodynew.Replace("<JOB_TYPE>", "álláskeresés");
              if (sender == null)
            break;
              SendMailToSender(EmailCategory.JobExpired, bodynew, subject, sender.Email, false, find.ID);
            }

            BusinessAuditEvent.Success();
            TraceCallReturnEvent.Raise("JobFindInactivateExpired");
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail("JobFindInactivateExpired",
              new EventParameter("Exception", ex.ToString()));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
        protected void btnInactivate_Click(object sender, EventArgs e)
        {
            m_Job = m_srvJob.JobFindSelect(m_JobId);

              if (!m_Job.Sender.Equals(Context.User.Identity.Name))
            return;
              if (m_Job.Status.Equals(JobStatusEnum.ACT))
              {
            m_Job.Status.Value = JobStatusEnum.INA;
              }
              else
              {
            if (m_Job.Status.Equals(JobStatusEnum.INA))
            {
              m_Job.Status.Value = JobStatusEnum.ACT;
            }
              }
              m_srvJob.JobFindSetStatus(m_Job);
              Response.Redirect("JobFinds.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
              SetTitle(" - Keresés hirdetés jelentkezés adatai");
              SetDefaultControls("btnModify","");
              // Check permission: anybody can use this page
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();
              string jobId = Request["jobId"];
              m_sender = Request["sender"];
              m_subscriber = Request["subscriber"];

              if (jobId == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");
              if (m_sender == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");
              if (m_subscriber == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");

              if (m_subscriber != Context.User.Identity.Name && m_sender != Context.User.Identity.Name)
              {
            if (m_subscriber != Context.User.Identity.Name)
            {
              throw new SecurityException("Nem az ön jelentkezése, nem tekintheti meg az adatokat.");
            }
            if (m_sender != Context.User.Identity.Name)
            {
              throw new SecurityException("Nem az ön hirdetése, nem tekintheti meg az adatokat.");
            }
              }
              m_srvJob = ServiceFactory.GetJobFindService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobFindSelect(m_JobId);
              m_JobAnswer = m_srvJobAnswer.JobAnswerSelect(m_JobId, JobAnswerTypeEnum.FIN, m_subscriber,m_sender);
              if (!Page.IsPostBack)
              {
            RetreiveData();

            #region Egyéb dokumentumok grid feltöltése

            ShowAttachementGrid();

            #endregion
              }
              if (m_JobAnswer.SenderNameRef == Context.User.Identity.Name)
              {
            btnModify.Visible = false;
            tdUser.InnerHtml = "<BR/>Jelentkező adatai:";
              }
              else
              {
            btnModify.Visible = true;
            tdUser.InnerText = "Állást kereső személy adatai:";
              }
        }
        /// <summary>
        /// Handles the Load event of the Page 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 Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
              SetTitle(" - Keresés hirdetés módosítása");
              SetDefaultControls("btnModify", "txtDescription");

              string jobId = Request["jobId"];

              // Check permission: anybody can use this page
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();

              if (jobId == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobFindSelect(m_JobId);

              if (!m_Job.Sender.Equals(Context.User.Identity.Name))
              {
            throw new SecurityException("Ez nem az ön hirdetése. Nincs jogosultsága módosítani.");
              }
              if (!IsPostBack)
              {
            RetreiveData();
            ShowUserGrid(gridUser, 0, "Name", "Ascending");
            // Fill combos
            SetRegionCombo();
            SetClientScripts();
              }
        }
Beispiel #7
0
        /// <summary>
        /// Shows the grid.
        /// </summary>
        /// <param name="dataGrid">The data grid.</param>
        /// <param name="index">The index.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="order">The order.</param>
        protected void ShowGrid(DataGrid dataGrid,
                            int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.JobFindList");

              // Get query result from database
              JobFind filter = new JobFind(Guid.Empty);
              filter.Description = Helpers.CreateLikeSearchText(txtName.Text);
              if(txtRefId.Text.Length >0)
            filter.FilterOnRefId = Convert.ToInt32(txtRefId.Text);
              filter.RegionRef = cmbRegion.SelectedValue;
              if (cbxPrevention.Checked) filter.FilterOnActivityPrevention = 1;
              if (cbxResearch.Checked) filter.FilterOnActivityResearch = 1;
              if (cbxRehabilitation.Checked) filter.FilterOnActivityRehabilitation = 1;
              if (cbxOther.Checked) filter.FilterOnActivityOther = 1;
              filter.Status = JobStatusEnum.ACT;
              filter.City = Helpers.CreateLikeSearchText(txtCity.Text);
              filter.Qualification = cmbQualification.SelectedValue;

              //filter.FilterOnIsactive = 1;

              //JobFindContainer jobSelectedAll = m_JobSrv.JobFindSelectFiltered(filter);

              JobFindContainer jobSelected = m_JobSrv.JobFindSelectFiltered(filter);
              //foreach (JobFind job in jobSelectedAll.All)
              //{
              //  if(job.LoginNameRef!= Context.User.Identity.Name)
              //  {
              //    jobSelected.Add(job);

              //  }
              //}
              if (jobSelected.AllCount > 0)
              {
            gridJob.Visible = true;
            lblNotFound.Visible = false;
              }
              else
              {
            gridJob.Visible = false;
            lblNotFound.Visible = true;
              }
              ArrayList sortableList;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = jobSelected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = jobSelected.All.SortBy(sort, true);
            }
            else sortableList = String.Compare(order, "Descending", true) == 0 ? jobSelected.All.SortBy(sort, false) : jobSelected.All.SortBy(sort);
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentPageIndex = jobSelected.AllCount <= dataGrid.PageSize*dataGrid.CurrentPageIndex ? 0 : index;

              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
 public virtual JobFind JobFindSelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     JobFind result = null;
     DataSet entitySet = m_DataContext.ndihdJobFindSelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new JobFind(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
Beispiel #9
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="IDVal">Value of 'uID' field</param>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public JobFind(DBGuid IDVal,
            JobFind origInstance)
     : base(IDVal, origInstance)
 {
 }
Beispiel #10
0
        public new void JobFindUpdate(JobFind entity)
        {
            // check permission: Writer or 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.Description.Length == 0)
              throw new ArgumentNullException("JobFind.Description", "A hirdetés leírása nincs megadva.");

            // Logical checks
            JobFind selected = base.JobFindSelect(entity.ID);
            if (selected == null)
              throw new ApplicationException("A megadott azonosítóval nem létezik hirdetés.");

            // Save data
            selected.Description = entity.Description;
            selected.City = entity.City;
            selected.RegionRef = entity.RegionRef;
            selected.Status = entity.Status;

            selected.ActivityPrevention = entity.ActivityPrevention;
            selected.ActivityResearch = entity.ActivityResearch;
            selected.ActivityRehabilitation = entity.ActivityRehabilitation;
            selected.ActivityOther = entity.ActivityOther;
            selected.Expiredate = entity.Expiredate;
            selected.NotificationSend = entity.NotificationSend;

            selected.NotificationDate = entity.NotificationDate;

            selected.LastModified = DateTime.Now;
            selected.JobFindAttachments = entity.JobFindAttachments;

            JobFindAttachmentService attSrv = new JobFindAttachmentService(m_DataContext);

            // Clear old files:
            //JobFindAttachmentContainer oldFiles = base.SelectChildrenByAttachmentOfJobFind(entity.ID);
            //foreach (JobFindAttachment oldFile in oldFiles.All)
            //{
            //  if (oldFile.FileData.Length == 0)
            //  {
            //    attSrv.JobFindAttachmentDelete(oldFile);
            //  }
            //}
            JobFindAttachment newFile;
            // EDocumentAttachments - insert:
            foreach (JobFindAttachment file in selected.JobFindAttachments.Current)
            {
              if (file.FileData.Length == 0)
              {
            newFile = attSrv.JobFindAttachmentSelectFile(file.ID);
              }
              else
              {
            newFile = file;
              }
              newFile.JobFindRef = selected.ID;
              newFile.Name = file.Name;
              newFile.Description = file.Description;
              newFile.CreatedDate = DateTime.Now;

              if (attSrv.JobFindAttachmentSelect(newFile.ID) != null)
              {
            attSrv.JobFindAttachmentUpdate(newFile);
              }
              else
              {
            attSrv.JobFindAttachmentInsert(newFile);
              }
            }

            base.JobFindUpdate(selected);

            BusinessAuditEvent.Success(
              new EventParameter("JobFindID", entity.ID.ToString()),
              new EventParameter("JobFindLogin", entity.Sender)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("JobFindID", entity.ID.ToString()),
               new EventParameter("JobFindLogin", entity.Sender)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Beispiel #11
0
        public void JobFindSetStatus(JobFind 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
              {
            // Logical checks
            JobFind selected = base.JobFindSelect(entity.ID);
            if (selected == null)
              throw new ApplicationException("A megadott azonosítóval nem létezik hirdetés.");

            selected.LastModified = DateTime.Now;
            // Save data
            m_DataContext.ndihdJobFindSetStatus(entity.ID, entity.Status);

            BusinessAuditEvent.Success(
              new EventParameter("JobFindID", entity.ID.ToString()),
              new EventParameter("JobFindStatus", entity.Status),
              new EventParameter("JobFindLogin", entity.Sender)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("JobFindID", entity.ID.ToString()),
              new EventParameter("JobFindStatus", entity.Status),
              new EventParameter("JobFindLogin", entity.Sender)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Beispiel #12
0
        public JobFindContainer JobFindSelectFiltered(JobFind filter)
        {
            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
              {
            JobFindContainer result = new JobFindContainer();
            DataSet entitySet = m_DataContext.ndihdJobFindSelectFiltered(filter.FilterOnRefId, filter.ID, filter.Sender, filter.Description, filter.City,
                                                                     filter.RegionRef, filter.Status,
                                                                     filter.FilterOnActivityPrevention,
                                                                     filter.FilterOnActivityResearch,
                                                                     filter.FilterOnActivityRehabilitation,
                                                                     filter.FilterOnActivityOther,
                                                                     filter.FilterOnNotificationsent, filter.Expiredate, filter.NotificationDate, filter.ExpireDatexpired, filter.Qualification);
            result = new JobFindContainer(entitySet.Tables[0]);
            TraceCallReturnEvent.Raise();
            return result;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
              SetTitle(" - Keresés hirdetés jelentkezés rögzítése");
              SetDefaultControls("btnCreate", "txtMotivation");
              // Check permission: anybody can use this page
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();

              string jobId = Request["jobId"];
              m_sender = Request["sender"];
              if (jobId == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");

              m_srvJob = ServiceFactory.GetJobFindService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobFindSelect(m_JobId);

              if (!Page.IsPostBack)
              {
            RetreiveData();

            #region Attachement grid feltöltése

            ShowAttachementGrid();

            #endregion
              }
        }
        /// <summary>
        /// Handles the Load event of the Page 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 Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
              SetTitle(" - Keresés hirdetés jelentkezés módosítása");
              SetDefaultControls("btnModify", "txtMotivation");
              // Check permission: anybody can use this page
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();

              string jobId = Request["jobId"];
              m_sender = Request["sender"];
              m_subscriber = Request["subscriber"];

              if (jobId == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");
              if (m_sender == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");
              if (m_subscriber == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");

              if (!m_subscriber.Equals(Context.User.Identity.Name))
              {
            throw new SecurityException("Ez nem az ön jelentkezése. Nincs jogosultsága módosítani.");
              }

              m_srvJob = ServiceFactory.GetJobFindService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobFindSelect(m_JobId);
              m_JobAnswer = m_srvJobAnswer.JobAnswerSelect(m_JobId, JobAnswerTypeEnum.FIN, Context.User.Identity.Name, m_Job.Sender);
              if (!Page.IsPostBack)
              {
            RetreiveData();

            #region Egyéb dokumentumok grid feltöltése

            ShowAttachementGrid();

            #endregion
              }
        }
 public virtual void JobFindUpdate(JobFind entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdJobFindUpdate(entity.ID,
     entity.RefId,
     entity.Description,
     entity.City,
     entity.RegionRef,
     entity.Status,
     entity.ActivityPrevention,
     entity.ActivityResearch,
     entity.ActivityRehabilitation,
     entity.ActivityOther,
     entity.Sender,
     entity.NotificationSend,
     entity.NotificationDate,
     entity.Expiredate,
     entity.LastModified,
     entity.Created, 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 new void JobOfferInsert(JobOffer entity)
        {
            // check permission: Writer or 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();
              m_DataContext.BeginNestedTran();
              try
              {
            // check required fields:
            if (entity.Description.Length == 0)
              throw new ArgumentNullException("JobOffer.Description", "A hirdetés leírása nincs megadva.");

            entity.Sender = Thread.CurrentPrincipal.Identity.Name;
            entity.Status = JobStatusEnum.ACT;
            entity.NotificationSend = false;
            entity.LastModified = DateTime.Now;
            entity.Created = DateTime.Now;
            base.JobOfferInsert(entity);

            JobOfferAttachmentService attSrv = new JobOfferAttachmentService(m_DataContext);

            // EDocumentAttachments - insert:
            foreach (JobOfferAttachment file in entity.JobOfferAttachments.Current)
            {
              file.JobOfferRef = entity.ID;
              file.IsActive = true;
              file.CreatedDate = DateTime.Now;
              attSrv.JobOfferAttachmentInsert(file);
            }
            m_DataContext.CommitNested();

            #region Találati mail
            entity = JobOfferSelect(entity.ID); // a refid miatt kell

            //Ellenõrizni kell, hogy van-epárja megye, végzettség szerint. Ha van levelet kell küldeni
            //a pár feladójának
            JobFindService srvJobFind = new JobFindService();
            JobFind filter = new JobFind(Guid.Empty);
            filter.RegionRef = entity.RegionRef;
            filter.Qualification = entity.QualificationMinRef;
            filter.Status = JobStatusEnum.ACT;
            //filter.Expiredate = DateTime.Now;
            QualificationService srvQualification = new QualificationService();
            UserService srvUser = new UserService();

            JobFindContainer finds = srvJobFind.JobFindSelectFiltered(filter);
            //Van pár
            foreach (JobFind find in finds.All)
            {
              //Itt meg kell nézni azt is, hogy nem õ-e a másik hirdetés feladója
              if (find.Sender != entity.Sender)
              {

            //értesítjük a feladót, hogy valaki válaszolt a hirdetésére
            //set mail:
            Email mail = new Email(Guid.NewGuid());
            //Subject és body lekérdezése
            string body = "";
            string subject = "";
            EmailTemplateService srvTemplate = new EmailTemplateService();
            srvTemplate.GetEmailTemplateByCode(ref subject, ref body, EmailCategory.JobFindMatchCreated);
            mail.Category = EmailCategory.JobFindMatchCreated;
            mail.Subject = subject;

            User findSender = srvUser.UserSelect(find.Sender);
            if (findSender != null)
            {
              mail.To = findSender.Email;
              body = body.Replace("<FULL_USER_NAME>", findSender.Name);
              body = body.Replace("<JOB_REFID>", entity.RefId.ToString());
              body = body.Replace("<JOB_DESCRIPTION>", entity.Description);
              body = body.Replace("<SENDER_NAME>", entity.ContactName);
              body = body.Replace("<SENDER_MAIL>", entity.ContactEmail);
            }
            mail.MailBody = body;

            if (mail.MailBody != null && mail.To != null && mail.Subject != null)
            {
              // Save data to database
              EmailService emailSrv = new EmailService(m_DataContext);
              m_DataContext.BeginNestedTran();
              try
              {
                emailSrv.EmailInsert(mail);
                m_DataContext.CommitNested();
              }
              catch
              {
                m_DataContext.RollbackNested();
                throw;
              }

              // Sending mail:
              try
              {
                emailSrv.EmailSend(mail.ID);
              }
              catch (Exception ex)
              {
                ExceptionManager.Publish(ex);
                return;
              }
            }
              }
            }

            #endregion
            BusinessAuditEvent.Success(
              new EventParameter("JobOfferID", entity.ID.ToString()),
              new EventParameter("JobOfferLogin", entity.Sender)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            m_DataContext.RollbackNested();
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("JobOfferID", entity.ID.ToString()),
              new EventParameter("JobOfferLogin", entity.Sender)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Beispiel #17
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public JobFind(JobFind origInstance)
     : base(origInstance)
 {
 }
        /// <summary>
        /// Handles the Load event of the Page 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 Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
              SetTitle(" - Keresés hirdetés adatai");
              SetDefaultControls("btnModify", "");
              string jobId = Request["jobId"];
              m_sender = Request["sender"];

              // Check permission: anybody can use this page
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();

              if (jobId == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");

              m_srvJob = ServiceFactory.GetJobFindService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobFindSelect(m_JobId);

              if (!Page.IsPostBack)
              {
            RetreiveData();

            #region Egyéb dokumentumok grid feltöltése

            ShowAttachementGrid();

            #endregion

            ShowUserGrid(gridUser, 0, "Name", "Ascending");
              }

              if (!m_Job.Sender.Equals(Context.User.Identity.Name))
              {
            btnModify.Visible = false;
            btnInactivate.Visible = false;
            IJobAnswerService srvAnswer = ServiceFactory.GetJobAnswerService();
            JobAnswer answer = srvAnswer.JobAnswerSelect(m_JobId, JobAnswerTypeEnum.FIN, Context.User.Identity.Name, m_Job.Sender);
            if (answer == null)
            {
              btnSusbscribe.Text = "Jelentkezés";
              btnSusbscribe.CommandName = "subscribe";
            }
            else
            {
              btnSusbscribe.Text = "Lejelentkezés";
              btnSusbscribe.CommandName = "unsubscribe";
              const string script = "return confirm('Biztosan lejelentkezik a hirdetésről?');";
              btnSusbscribe.Attributes.Add("OnClick", script);
            }
              }
              else
              {
            btnSusbscribe.Visible = false;
            if (m_Job.Status.Equals(JobStatusEnum.ACT))
            {
              btnInactivate.Text = "Inaktiválás";
            }
            else
            {
              if (m_Job.Status.Equals(JobStatusEnum.INA))
              {
            btnInactivate.Text = "Aktiválás";
              }
              else
              {
            btnInactivate.Visible = false;
              }
            }
              }
        }
        /// <summary>
        /// Shows the grid.
        /// </summary>
        /// <param name="dataGrid">The data grid.</param>
        /// <param name="index">The index.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="order">The order.</param>
        protected void ShowGrid(DataGrid dataGrid,
                            int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.JobFindList");

              // Get query result from database
              JobFind filter = new JobFind(Guid.Empty);
              filter.Sender = Context.User.Identity.Name;
              filter.Status = JobStatusEnum.ACT;

              JobFindContainer jobSelectedAll = m_JobSrv.JobFindSelectFiltered(filter);
              JobFindContainer jobSelected = new JobFindContainer();

              if (cmbAll.SelectedValue != "" && cmbAll.SelectedValue != "0")
              {
            foreach (JobFind job in jobSelectedAll.All)
            {
              int answerCount = 0;
              foreach (JobAnswer answer in m_answers.All)
              {
            if (answer.JobRef == job.ID)
            {
              answerCount++;
            }
              }
              if (cmbAll.SelectedValue == "1" && answerCount == 0) // nincs jelentkező
              {
            jobSelected.Add(job);
              }
              if (cmbAll.SelectedValue == "2" && answerCount > 0) //van
              {
            jobSelected.Add(job);
              }
            }
              }
              else
              {
            jobSelected = jobSelectedAll;
              }
              if (jobSelected.AllCount > 0)
              {
            gridJob.Visible = true;
            lblNotFound.Visible = false;
              }
              else
              {
            gridJob.Visible = false;
            lblNotFound.Visible = true;
              }
              ArrayList sortableList;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = jobSelected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = jobSelected.All.SortBy(sort, true);
            }
            else sortableList = String.Compare(order, "Descending", true) == 0 ? jobSelected.All.SortBy(sort, false) : jobSelected.All.SortBy(sort);
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentPageIndex = jobSelected.AllCount <= dataGrid.PageSize*dataGrid.CurrentPageIndex ? 0 : index;

              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
 public virtual void JobFindDelete(JobFind entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdJobFindDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }