Exemplo n.º 1
0
 protected void btnModify_Click(object sender, EventArgs e)
 {
     m_Job = m_srvJob.JobOfferSelect(m_JobId);
       if (m_Job.Sender.Equals(Context.User.Identity.Name))
       {
     Response.Redirect("JobOfferModify.aspx?jobId=" + m_Job.ID);
       }
 }
Exemplo n.º 2
0
        public void JobOfferInactivateExpired()
        {
            TraceCallEnterEvent.Raise();
              try
              {
            // Save data
            //m_DataContext.ndihdJobOfferSetStatus(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
            JobOffer filter = new JobOffer(Guid.Empty);
            filter.Status = JobStatusEnum.ACT;
            filter.Expiredate = DateTime.Now;

            JobOfferContainer offers = JobOfferSelectFiltered(filter);

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

            foreach (JobOffer offer in offers.All)
            {
              offer.LastModified = DateTime.Now;
              offer.Status = JobStatusEnum.EXP;
              JobOfferSetStatus(offer); //inaktiváljuk
              //küldünk egy levelet a barátunknak
              string bodynew;
              bodynew = body.Replace("<FULL_USER_NAME>", offer.ContactName);
              bodynew = bodynew.Replace("<JOB_REFID>", offer.RefId.ToString());
              bodynew = bodynew.Replace("<JOB_DESCRIPTION>", offer.Description);
              bodynew = bodynew.Replace("<JOB_TYPE>", "állásajánlat");

              SendMailToSender(EmailCategory.JobExpired, bodynew, subject, offer, false);
            }

            BusinessAuditEvent.Success();
            TraceCallReturnEvent.Raise("JobOfferInactivateExpired");
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail("JobOfferInactivateExpired",
              new EventParameter("Exception", ex.ToString()));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Exemplo n.º 3
0
        protected void btnInactivate_Click(object sender, EventArgs e)
        {
            m_Job = m_srvJob.JobOfferSelect(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.JobOfferSetStatus(m_Job);
              Response.Redirect("JobOffers.aspx");
        }
Exemplo n.º 4
0
        public void JobOfferSetStatus(JobOffer 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
            JobOffer selected = base.JobOfferSelect(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.ndihdJobOfferSetStatus(entity.ID, entity.Status);

            BusinessAuditEvent.Success(
              new EventParameter("JobOfferID", entity.ID.ToString()),
              new EventParameter("JobOfferStatus", entity.Status),
              new EventParameter("JobOfferLogin", entity.Sender)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("JobOfferID", entity.ID.ToString()),
              new EventParameter("JobOfferStatus", entity.Status),
              new EventParameter("JobOfferLogin", entity.Sender)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Exemplo n.º 5
0
        public JobOfferContainer JobOfferSelectFiltered(JobOffer 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
              {
            JobOfferContainer result = new JobOfferContainer();
            DataSet entitySet = m_DataContext.ndihdJobOfferSelectFiltered(filter.FilterOnRefId, filter.ID, filter.Sender, filter.Description, filter.Message,
              filter.Requirements,
              filter.City,
                                                                     filter.RegionRef, filter.QualificationMinRef, filter.Status,
                                                                     filter.FilterOnActivityPrevention,
                                                                     filter.FilterOnActivityResearch,
                                                                     filter.FilterOnActivityRehabilitation,
                                                                     filter.FilterOnActivityOther,
                                                                     filter.FilterOnNotificationsent, filter.Expiredate, filter.NotificationDate, filter.ExpireDatexpired);
            result = new JobOfferContainer(entitySet.Tables[0]);
            TraceCallReturnEvent.Raise();
            return result;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Exemplo n.º 6
0
        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;
              }
        }
Exemplo n.º 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.JobOfferList");

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

              JobOfferContainer jobSelectedAll = m_JobSrv.JobOfferSelectFiltered(filter);
              JobOfferContainer jobSelected = new JobOfferContainer();

              if (cmbAll.SelectedValue != "" && cmbAll.SelectedValue != "0")
              {
            foreach (JobOffer 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();
        }
Exemplo n.º 8
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.JobOfferList");

              // Get query result from database
              JobOffer filter = new JobOffer(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.QualificationMinRef = cmbQualification.SelectedValue;

              //filter.FilterOnIsactive = 1;

              //JobOfferContainer jobSelectedAll = m_JobSrv.JobOfferSelectFiltered(filter);

              JobOfferContainer jobSelected = m_JobSrv.JobOfferSelectFiltered(filter);
              //foreach (JobOffer 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();
        }
Exemplo n.º 9
0
 public virtual JobOffer JobOfferSelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     JobOffer result = null;
     DataSet entitySet = m_DataContext.ndihdJobOfferSelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new JobOffer(entitySet);
     }
     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(" - Állásajánlatra 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.GetJobOfferService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobOfferSelect(m_JobId);

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

            #region Attachement grid feltöltése

            ShowAttachementGrid();

            #endregion
              }
        }
Exemplo n.º 11
0
        /// <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.JobOfferSelect(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();
            SetQualificationCombo();
            SetClientScripts();
              }
        }
Exemplo n.º 12
0
        /// <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.GetJobOfferService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobOfferSelect(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.OFF, 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;
              }
            }
              }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
              SetTitle(" -Állásajánlatra 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.GetJobOfferService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobOfferSelect(m_JobId);
              m_JobAnswer = m_srvJobAnswer.JobAnswerSelect(m_JobId, JobAnswerTypeEnum.OFF, 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;

              }
              else
              {
            btnModify.Visible = true;

              }
        }
Exemplo n.º 14
0
        public new void JobOfferUpdate(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();
              try
              {

            // Check required fields:
            if (entity.Description.Length == 0)
              throw new ArgumentNullException("JobOffer.Description", "A hirdetés leírása nincs megadva.");

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

            // Save data

            selected.Requirements = entity.Requirements;
            selected.QualificationMinRef = entity.QualificationMinRef;
            selected.IdealEmployee = entity.IdealEmployee;
            selected.EmployeeCount = entity.EmployeeCount;
            selected.HomePage = entity.HomePage;
            selected.ContactName = entity.ContactName;
            selected.ContactPhone = entity.ContactPhone;
            selected.ContactEmail = entity.ContactEmail;

            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.JobOfferAttachments = entity.JobOfferAttachments;

            JobOfferAttachmentService attSrv = new JobOfferAttachmentService(m_DataContext);

            // Clear old files:
            JobOfferAttachmentContainer oldFiles = base.SelectChildrenByAttachmentOfJobOffer(entity.ID);
            foreach (JobOfferAttachment oldFile in oldFiles.All)
            {
              attSrv.JobOfferAttachmentDelete(oldFile);
            }
            JobOfferAttachment newFile;
            // EDocumentAttachments - insert:
            foreach (JobOfferAttachment file in selected.JobOfferAttachments.Current)
            {
              if (file.FileData.Length == 0)
              {
            newFile = attSrv.JobOfferAttachmentSelectFile(file.ID);
              }
              else
              {
            newFile = file;
              }
              newFile.JobOfferRef = selected.ID;
              newFile.Name = file.Name;
              newFile.Description = file.Description;
              newFile.CreatedDate = DateTime.Now;

              if (attSrv.JobOfferAttachmentSelect(newFile.ID) != null)
              {
            attSrv.JobOfferAttachmentUpdate(newFile);
              }
              else
              {
            attSrv.JobOfferAttachmentInsert(newFile);
              }
            }

            base.JobOfferUpdate(selected);

            BusinessAuditEvent.Success(
              new EventParameter("JobOfferID", entity.ID.ToString()),
              new EventParameter("JobOfferLogin", entity.Sender)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            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;
              }
        }
        /// <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(" - Állásajánlatra 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.GetJobOfferService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobOfferSelect(m_JobId);
              m_JobAnswer = m_srvJobAnswer.JobAnswerSelect(m_JobId, JobAnswerTypeEnum.OFF, Context.User.Identity.Name, m_Job.Sender);
              if (!Page.IsPostBack)
              {
            RetreiveData();

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

            ShowAttachementGrid();

            #endregion
              }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Sends the mail to sender.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="body">The body.</param>
        /// <param name="subject">The subject.</param>
        /// <param name="offer">The offer.</param>
        /// <param name="mustUpdate">if set to <c>true</c> [must update].</param>
        private void SendMailToSender(string category, string body, string subject, JobOffer offer, bool mustUpdate)
        {
            //set mail:
              Email mail = new Email(Guid.NewGuid());

              mail.Category = category;
              mail.Subject = subject;

              mail.To = offer.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);
              if (mustUpdate)
              {

            JobOfferService srv = new JobOfferService(m_DataContext);
            JobOffer job = srv.JobOfferSelect(offer.ID);
            if (job != null)
            {
              job.NotificationSend = true;
              job.LastModified = DateTime.Now;
              srv.JobOfferUpdate(job);
            }

              }
              m_DataContext.CommitNested();
            }
            catch
            {
              m_DataContext.RollbackNested();
              throw;
            }

            // Sending mail:
            try
            {
              emailSrv.EmailSend(mail.ID);
            }
            catch (Exception ex)
            {
              ExceptionManager.Publish(ex);
              return;
            }
              }
        }
Exemplo n.º 17
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public JobOffer(JobOffer origInstance)
     : base(origInstance)
 {
 }
Exemplo n.º 18
0
 public virtual void JobOfferDelete(JobOffer entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdJobOfferDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
Exemplo n.º 19
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="IDVal">Value of 'uID' field</param>
 /// <param name="LoginNameRefVal">Value of 'cLoginNameRef' field</param>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public JobOffer(DBGuid IDVal,
             JobOffer origInstance)
     : base(IDVal, origInstance)
 {
 }
Exemplo n.º 20
0
 public virtual void JobOfferUpdate(JobOffer entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdJobOfferUpdate(entity.ID,
     entity.RefId,
     entity.Description,
     entity.Message,
     entity.Requirements,
     entity.City,
     entity.RegionRef,
     entity.Status,
     entity.QualificationMinRef,
     entity.IdealEmployee,
     entity.ActivityPrevention,
     entity.ActivityResearch,
     entity.ActivityRehabilitation,
     entity.ActivityOther,
     entity.EmployeeCount,
     entity.FreeEmployeeCount,
     entity.HomePage,
     entity.ContactName,
     entity.ContactPhone,
     entity.ContactEmail,
     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;
       }
 }
Exemplo n.º 21
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();
            JobOffer job = new JobOffer(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));

              //job.Message]
            job.Requirements = txtRequirements.Text;
            job.QualificationMinRef = cmbQualification.SelectedValue;
            job.IdealEmployee = txtIdealEmployee.Text;
            if(txtEmployeeCount.Text.Length>0)
            job.EmployeeCount = Convert.ToInt16(txtEmployeeCount.Text);
            job.HomePage = txtHomePage.Text;
            job.ContactName = txtContactName.Text;
            job.ContactPhone = txtContactPhone.Text;
            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;

              job.JobOfferAttachments.Add(attachment);
            }

            #endregion

            jobSrv.JobOfferInsert(job);

            Response.Redirect(string.Format("JobOfferData.aspx?jobId={0}&sender={1}", job.ID, Context.User.Identity.Name));
              }
              catch (Exception ex)
              {
            errorPanel.Exception = ex;
              }
        }