/// <summary> /// Creates an application on behalf of the currently logged in user, then /// redirects to that application /// </summary> /// <remarks>Checks to make sure the logged in user has an applicant account</remarks> protected void btnPositionApply_Click(object sender, EventArgs e) { Applicant loggedInUser = ApplicantBLL.GetCurrent(); //Make sure the loggedInUser has an Applicant account if (loggedInUser == null) { Trace.Warn("Not Logged Is As Member"); FormsAuthentication.SignOut(); //Causes the user to sign out and redirect FormsAuthentication.RedirectToLoginPage(Request.Url.AbsolutePath); //Make the user log in return; } //If the applicant already has an application for this position, redirect to the app page foreach (Application app in loggedInUser.MainProfile.Applications) { if (app.AppliedPosition == currentPosition) { Response.Redirect(string.Format("{0}?ApplicationID={1}", "Applicant/App.aspx", app.ID)); } } //Now we have a valid applicant, so create the application Application newApplication = new Application(); newApplication.AppliedPosition = currentPosition; newApplication.AssociatedProfile = loggedInUser.MainProfile; newApplication.Email = loggedInUser.Email; newApplication.LastUpdated = DateTime.Now; using (var ts = new TransactionScope()) { //Now save the new application get get back the ID ApplicationBLL.EnsurePersistent(newApplication); ts.CommitTransaction(); } //Redirect to the newly created application Response.Redirect(string.Format("{0}?ApplicationID={1}", "Applicant/App.aspx", newApplication.ID.ToString())); }
public string GetNullSafeFullName(string fullName) { return(ApplicantBLL.GetNullSafeFullName(fullName)); }