public new void JobAnswerDelete(JobAnswer entity) { PrincipalPermission permReg = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Registered"); PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permReg.Union(permAdmin).Demand(); base.JobAnswerDelete(entity); }
public virtual void JobAnswerDelete(JobAnswer entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { m_DataContext.ndihdJobAnswerDelete(entity.JobRef, entity.Type, entity.SubscriberNameRef, entity.SenderNameRef); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
/// <summary> /// Handles the ItemCommand event of the gridJobFind control. /// </summary> /// <param name="source">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param> protected void gridJob_ItemCommand(object source, DataGridCommandEventArgs e) { try { string[] args = e.CommandArgument.ToString().Split('#'); if (args.Length != 2) return; string jobId = args[0]; string sender = args[1]; Guid jobGuid = new Guid(jobId); if (e.CommandName.ToLower().Equals("linktojob")) { Response.Redirect(string.Format("JobFindData.aspx?jobId={0}&sender={1}", jobId, sender)); } if (e.CommandName.ToLower().Equals("view")) { Response.Redirect(string.Format("JobFindData.aspx?jobId={0}&sender={1}", jobId, sender)); } if (e.CommandName.ToLower().Equals("modify")) { Response.Redirect("JobFindModify.aspx?jobId=" + jobId); } if (e.CommandName.ToLower().Equals("unsubscribe")) { IJobAnswerService srvJobAnswer = ServiceFactory.GetJobAnswerService(); JobAnswer jobAnswer = srvJobAnswer.JobAnswerSelect(jobGuid, JobAnswerTypeEnum.FIN, Context.User.Identity.Name,sender); if (jobAnswer != null) srvJobAnswer.JobAnswerDelete(jobAnswer); JobAnswer filter = new JobAnswer(Guid.Empty, JobAnswerTypeEnum.FIN,"",""); filter.FilterOnIsActive = 1; m_answers = m_srvAnswer.JobAnswerSelectFiltered(filter); } if (e.CommandName.ToLower().Equals("subscribe")) { Response.Redirect(string.Format("JobFindAnswerCreate.aspx?jobId={0}&sender={1}", jobId, sender)); } if (e.CommandName.ToLower().Equals("inactivate")) { JobFind job = m_JobSrv.JobFindSelect(jobGuid); job.Status = JobStatusEnum.INA; m_JobSrv.JobFindSetStatus(job); } ShowGrid(gridJob, 0, "Description", "Ascending"); } catch (Exception ex) { errorPanel.Exception = ex; } }
/// <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 { JobAnswer answer = new JobAnswer(m_JobId, JobAnswerTypeEnum.OFF, Context.User.Identity.Name, m_Job.Sender); answer.Motivation = txtMotivation.Text; answer.Expiredate = Convert.ToDateTime(txtExpiredate.Text); IJobAnswerService srvJobAnswer = ServiceFactory.GetJobAnswerService(); srvJobAnswer.JobAnswerInsert(answer); Response.Redirect("JobOffers.aspx"); } catch (Exception ex) { errorPanel.Exception = ex; } }
public virtual JobAnswer JobAnswerSelect(DBGuid JobRefVal, DBString TypeVal, DBString SubscriberNameRefVal, DBString SenderNameRefVal) { TraceCallEnterEvent.Raise(); try { JobAnswer result = null; DataSet entitySet = m_DataContext.ndihdJobAnswerSelect(JobRefVal, TypeVal, SubscriberNameRefVal, SenderNameRefVal); if (entitySet.Tables[0].Rows.Count != 0) { result = new JobAnswer(entitySet); } TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); 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(" - Saját állás keresés hirdetéseim"); SetDefaultControls("btnFilter", "cmbAll"); // Check permission: anybody can use this page PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered"); permReg.Demand(); JobAnswer filter = new JobAnswer(Guid.Empty, JobAnswerTypeEnum.FIN, "", Context.User.Identity.Name); filter.FilterOnIsActive = 1; m_answers = m_srvAnswer.JobAnswerSelectFiltered(filter); if (!Page.IsPostBack) { // Fill the JobFind grid ShowGrid(gridJob, 0, "Description", "Ascending"); } }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="JobRefVal">Value of 'uJobRef' field</param> /// <param name="TypeVal">Value of 'cType' field</param> /// <param name="SubscriberNameRefVal">Value of 'cSubscriberNameRef' field</param> /// <param name="SenderNameRefVal">Value of 'cSenderNameRef' field</param> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public JobAnswer(DBGuid JobRefVal, DBString TypeVal, DBString SubscriberNameRefVal, DBString SenderNameRefVal, JobAnswer origInstance) : base(JobRefVal, TypeVal, SubscriberNameRefVal, SenderNameRefVal, origInstance) { }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public JobAnswer(JobAnswer origInstance) : base(origInstance) { }
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:"; } }
protected void ShowUserGrid(DataGrid dataGrid, int index, string sort, string order) { dataGrid.PageSize = Helpers.GetPageSize("PageSize.UserList"); UserContainer selected = new UserContainer(); JobAnswer filter = new JobAnswer(m_JobId, JobAnswerTypeEnum.FIN, "", Context.User.Identity.Name); filter.FilterOnIsActive = 1; IJobAnswerService srvJobAnswer = ServiceFactory.GetJobAnswerService(); IUserService srvUser = ServiceFactory.GetUserService(); JobAnswerContainer answers = srvJobAnswer.JobAnswerSelectFiltered(filter); foreach (JobAnswer answer in answers.All) { User user = srvUser.UserSelect(answer.SubscriberNameRef); selected.Add(user); } if (selected.AllCount > 0) { dataGrid.Visible = true; lblNotFoundUser.Visible = false; } else { dataGrid.Visible = false; lblNotFoundUser.Visible = true; return; } ArrayList sortableList; // Sort if necessary if (sort == null) { sortableList = selected.All.Items; } else { if (String.Compare(order, "Ascending", true) == 0) { sortableList = selected.All.SortBy(sort, true); } else sortableList = String.Compare(order, "Descending", true) == 0 ? selected.All.SortBy(sort, false) : selected.All.SortBy(sort); } // Bind list to datagrid control dataGrid.CurrentPageIndex = index; dataGrid.CurrentSortExpression = sort; dataGrid.CurrentSortOrder = order; dataGrid.DataSource = sortableList; dataGrid.DataBind(); }
/// <summary> /// Sends the mail to subscriber. /// </summary> /// <param name="category">The category.</param> /// <param name="body">The body.</param> /// <param name="subject">The subject.</param> /// <param name="emailTo">The email to.</param> /// <param name="mustUpdate">if set to <c>true</c> [must update].</param> /// <param name="answer">The id.</param> private void SendMailToSender(string category, string body, string subject, string emailTo, bool mustUpdate, JobAnswer answer) { //set mail: Email mail = new Email(Guid.NewGuid()); mail.Category = category; mail.Subject = subject; mail.To = emailTo; 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); JobAnswerService srv = new JobAnswerService(m_DataContext); JobAnswer job = srv.JobAnswerSelect(answer.JobRef, answer.Type, answer.SubscriberNameRef, answer.SenderNameRef); if (job != null) { if (mustUpdate) { job.IsActive = false; } else { job.SenderNotificationSend = true; } srv.JobAnswerUpdate(job); } m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } // Sending mail: try { emailSrv.EmailSend(mail.ID); } catch (Exception ex) { ExceptionManager.Publish(ex); return; } } }
public JobAnswerContainer JobAnswerSelectFiltered(JobAnswer 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 { JobAnswerContainer result = new JobAnswerContainer(); DataSet entitySet = m_DataContext.ndihdJobAnswerSelectFiltered(filter.JobRef,filter.Type, filter.SenderNameRef, filter.SubscriberNameRef, filter.FilterOnSenderNotificationSend, filter.FilterOnSubscriberNotificationSend, filter.Expiredate, filter.FilterOnIsActive); result = new JobAnswerContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public new void JobAnswerInsert(JobAnswer entity) { try { PrincipalPermission permReg = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Registered"); PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permReg.Union(permAdmin).Demand(); JobAnswer ja = base.JobAnswerSelect(entity.JobRef, entity.Type, entity.SubscriberNameRef, entity.SenderNameRef); if(ja != null) { if(ja.IsActive) throw new ApplicationException("Erre a hirdetésre már válaszolt."); } //entity.SubscriberNameRef = Thread.CurrentPrincipal.Identity.Name; entity.Created = DateTime.Now; entity.IsActive = true; if (ja == null) { base.JobAnswerInsert(entity); } else { ja = entity; base.JobAnswerUpdate(ja); } //é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.JobAnswerCreated); mail.Category = EmailCategory.JobAnswerCreated; mail.Subject = subject; UserService srvUser = new UserService(); User subscriber = srvUser.UserSelect(entity.SubscriberNameRef); //Ha keresés hirdetésre jelentkezett valaki if (entity.Type == JobAnswerTypeEnum.FIN) { User sender = srvUser.UserSelect(entity.SenderNameRef); if (sender != null && sender.Email.Length > 0) { JobFindService srvJob = new JobFindService(); JobFind find = srvJob.JobFindSelect(entity.JobRef); mail.To = sender.Email; body = body.Replace("<FULL_USER_NAME>", sender.Name); if (find != null) { body = body.Replace("<JOB_REFID>", find.RefId.ToString()); body = body.Replace("<JOB_DESCRIPTION>", find.Description); } } } else { //ajánlat JobOfferService srvJob = new JobOfferService(); JobOffer offer = srvJob.JobOfferSelect(entity.JobRef); if (offer != null && offer.ContactEmail.Length > 0) { mail.To = offer.ContactEmail; body = body.Replace("<FULL_USER_NAME>", offer.ContactName); body = body.Replace("<JOB_REFID>", offer.RefId.ToString()); body = body.Replace("<JOB_DESCRIPTION>", offer.Description); } } if (subscriber != null) { body = body.Replace("<SUBSCRIBER_NAME>", subscriber.Name); body = body.Replace("<SUBSCRIBER_MAIL>", subscriber.Email); body = body.Replace("<MOTIVATION>", entity.Motivation); } 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; } } // Log success BusinessAuditEvent.Success( new EventParameter("JobRef", entity.JobRef.ToString()), new EventParameter("OrganisationID", Thread.CurrentPrincipal.Identity.Name) ); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("JobRef", entity.JobRef.ToString()), new EventParameter("OrganisationID", Thread.CurrentPrincipal.Identity.Name) ); 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 } }
public virtual void JobAnswerUpdate(JobAnswer entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { int count; m_DataContext.ndihdJobAnswerUpdate(entity.JobRef, entity.Type, entity.SubscriberNameRef, entity.SenderNameRef, entity.Motivation, entity.SenderNotificationSend, entity.SubscriberNotificationSend, entity.Created, entity.IsActive, entity.Expiredate, 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 void JobAnswerInactivateExpired() { TraceCallEnterEvent.Raise(); try { // Save data //m_DataContext.ndihdJobFindSetStatus(entity.ID, entity.Status); // 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 JobAnswer filter = new JobAnswer(Guid.Empty, "", "", ""); filter.FilterOnIsActive = 1; filter.Expiredate = DateTime.Now; //filter.FilterOnSubscriberNotificationSend = 0; JobAnswerContainer answers = JobAnswerSelectFiltered(filter); string body = ""; string subject = ""; EmailTemplateService srvTemplate = new EmailTemplateService(); srvTemplate.GetEmailTemplateByCode(ref subject, ref body, EmailCategory.JobExpired); UserService srvUser = new UserService(); JobFindService srvFind = new JobFindService(); JobOfferService srvOff = new JobOfferService(); foreach (JobAnswer answer in answers.All) { User subscriber = srvUser.UserSelect(answer.SubscriberNameRef); string refId = ""; string description = ""; if (answer.Type == JobAnswerTypeEnum.FIN) { JobFind job = srvFind.JobFindSelect(answer.JobRef); if (job != null) { refId = job.RefId.ToString(); description = job.Description; } } else { JobOffer job = srvOff.JobOfferSelect(answer.JobRef); if (job != null) { refId = job.RefId.ToString(); description = job.Description; } } string bodynew = ""; //küldünk egy levelet a barátunknak bodynew = body.Replace("<FULL_USER_NAME>", subscriber == null ? answer.SubscriberNameRef : subscriber.Name); bodynew = bodynew.Replace("<JOB_REFID>", refId); bodynew = bodynew.Replace("<JOB_DESCRIPTION>", description); bodynew = bodynew.Replace("<JOB_TYPE>", "állásajánlat"); bodynew = bodynew.Replace("<JOB_DATE>", answer.Expiredate.ToShortDateString()); if (subscriber == null) break; SendMailToSender(EmailCategory.JobExpired, bodynew, subject, subscriber.Email, true, answer); } BusinessAuditEvent.Success(); TraceCallReturnEvent.Raise("JobAnswerInactivateExpired"); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail("JobAnswerInactivateExpired", new EventParameter("Exception", ex.ToString())); 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(" - Milyen keresésekre válaszoltam"); // Check permission: anybody can use this page PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered"); permReg.Demand(); JobAnswer filter = new JobAnswer(Guid.Empty, JobAnswerTypeEnum.OFF, Context.User.Identity.Name, ""); filter.FilterOnIsActive = 1; m_answers = m_srvAnswer.JobAnswerSelectFiltered(filter); if (!Page.IsPostBack) { // Fill the JobOffer grid ShowGrid(gridJob, 0, "Description", "Ascending"); } }