private static JobApplication FillApplication(DataRow applicationRow, DataRow[] documentRows, DataRow[] propertyRows) { var jobApplication = new JobApplication { ApplicationId = (int)applicationRow["ApplicationId"], JobId = (int)applicationRow["JobId"], UserId = applicationRow["UserId"] as int?, AppliedForDate = (DateTime)applicationRow["AppliedDate"], SalaryRequirement = applicationRow["SalaryRequirement"] as string, ApplicantName = applicationRow["ApplicantName"] as string, ApplicantEmail = applicationRow["ApplicantEmail"] as string, ApplicantPhone = applicationRow["ApplicantPhone"] as string, Message = applicationRow["Message"] as string, StatusId = applicationRow["StatusId"] as int? }; if (documentRows != null && propertyRows != null) { jobApplication.SetDocuments(documentRows); jobApplication.SetApplicationProperties(propertyRows); } return(jobApplication); }
private static JobApplication FillApplication(DataRow applicationRow, DataRow[] documentRows, DataRow[] propertyRows) { var jobApplication = new JobApplication { ApplicationId = (int)applicationRow["ApplicationId"], JobId = (int)applicationRow["JobId"], UserId = applicationRow["UserId"] as int?, AppliedForDate = (DateTime)applicationRow["AppliedDate"], SalaryRequirement = applicationRow["SalaryRequirement"] as string, ApplicantName = applicationRow["ApplicantName"] as string, ApplicantEmail = applicationRow["ApplicantEmail"] as string, ApplicantPhone = applicationRow["ApplicantPhone"] as string, Message = applicationRow["Message"] as string, StatusId = applicationRow["StatusId"] as int? }; if (documentRows != null && propertyRows != null) { jobApplication.SetDocuments(documentRows); jobApplication.SetApplicationProperties(propertyRows); } return jobApplication; }
/// <summary> /// Handles the <see cref="LinkButton.Click"/> event of the <see cref="ApplyButton"/> control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void ApplyButton_Click(object sender, EventArgs e) { this.InitializeApplicantInfoSection(); this.Page.Validate("apply"); if (!this.Page.IsValid) { return; } var isNewApplication = this.JobApplication == null; if (this.JobId != null && (this.UserId == -1 || (!isNewApplication && this.JobApplication.UserId == this.UserId) || !JobApplication.HasAppliedForJob(this.JobId.Value, this.UserId))) { string resumeFileName = string.Empty; string resumeContentType = string.Empty; if (this.ResumeUpload.PostedFile != null) { resumeFileName = Path.GetFileName(this.ResumeUpload.PostedFile.FileName); resumeContentType = this.ResumeUpload.PostedFile.ContentType; } string coverLetterFileName = string.Empty; string coverLetterContentType = string.Empty; if (this.CoverLetterUpload.PostedFile != null) { coverLetterFileName = Path.GetFileName(this.CoverLetterUpload.PostedFile.FileName); coverLetterContentType = this.CoverLetterUpload.PostedFile.ContentType; } int?leadId = null; int value; if (int.TryParse(this.LeadDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out value)) { leadId = value; } int?userId = (this.UserId == -1) ? (int?)null : this.UserId; var resumeBytes = this.ResumeUpload.FileBytes; var coverLetterBytes = this.CoverLetterUpload.FileBytes; var documentIds = isNewApplication ? JobApplication.Apply( this.JobId.Value, userId, resumeFileName, resumeContentType, resumeBytes, coverLetterFileName, coverLetterContentType, coverLetterBytes, GetTextIfVisible(this.SalaryTextBox), GetTextIfVisible(this.ApplicationMessageTextBox), GetTextIfVisible(this.ApplicantNameTextBox), GetTextIfVisible(this.ApplicantEmailTextBox), GetTextIfVisible(this.ApplicantPhoneTextBox), leadId) : JobApplication.UpdateApplication( this.ApplicationId.Value, userId, resumeFileName, resumeContentType, resumeBytes, coverLetterFileName, coverLetterContentType, coverLetterBytes, GetTextIfVisible(this.SalaryTextBox), GetTextIfVisible(this.ApplicationMessageTextBox), GetTextIfVisible(this.ApplicantNameTextBox), GetTextIfVisible(this.ApplicantEmailTextBox), GetTextIfVisible(this.ApplicantPhoneTextBox), leadId); Debug.Assert(this.CurrentJob != null, "this.CurrentJob must not be null when sending notification about a new application"); string notificationEmailAddress = Engage.Utility.HasValue(this.CurrentJob.NotificationEmailAddress) ? this.CurrentJob.NotificationEmailAddress : this.DefaultNotificationEmailAddresses; this.SendNotificationEmail( GetDocument(documentIds.First, DocumentType.Resume, resumeFileName, resumeContentType, resumeBytes), GetDocument(documentIds.Second, DocumentType.CoverLetter, coverLetterFileName, coverLetterContentType, coverLetterBytes), isNewApplication, notificationEmailAddress, true, "ApplicationSubject", "AnonymousApplicationSubject", "ApplicationUpdateSubject", "NotificationEmailBody.Format"); var applicantEmail = this.GetTextWithFallback(this.ApplicantEmailTextBox, this.UserInfo.Email); if (applicantEmail != null) { this.SendNotificationEmail( documentIds.First, isNewApplication, applicantEmail, false, "ApplicationAutoRespondSubject", "ApplicationUpdateAutoRespondSubject", "ReceiptEmailBody.Format"); } } this.SuccessLabel.Visible = true; this.SuccessLabel.Text = this.Localize("ApplicationSent"); this.ApplicantInfoSection.Visible = false; }
private static JobApplication FillApplication(IDataRecord reader) { var jobApplication = new JobApplication { ApplicationId = (int)reader["ApplicationId"], JobId = (int)reader["JobId"], UserId = reader["UserId"] as int?, AppliedForDate = (DateTime)reader["AppliedDate"], SalaryRequirement = reader["SalaryRequirement"] as string, ApplicantName = reader["ApplicantName"] as string, ApplicantEmail = reader["ApplicantEmail"] as string, ApplicantPhone = reader["ApplicantPhone"] as string, Message = reader["Message"] as string, StatusId = reader["StatusId"] as int? }; return jobApplication; }