public override void LoadData() { base.LoadData(); //Add some applications Profile profile = ProfileBLL.GetByID(StaticProperties.ExistingProfileID); Application application = new Application(); application.AppliedPosition = PositionBLL.GetByID(StaticProperties.ExistingPositionID); application.AssociatedProfile = profile; application.Email = StaticProperties.ExistingApplicantEmail; application.LastUpdated = DateTime.Now; profile.Applications = new List <Application> { application }; using (var ts = new TransactionScope()) { ApplicationBLL.EnsurePersistent(application); ProfileBLL.EnsurePersistent(profile); ts.CommitTransaction(); } }
private void createProfileForUser(string email) { Applicant newUser = ApplicationBLL.GetByEmail(email); if (newUser == null) { Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH)); return; } //Create a blank profile for the logged in user Profile blankProfile = new Profile(); blankProfile.AssociatedApplicant = newUser; blankProfile.FirstName = string.Empty; blankProfile.LastName = string.Empty; blankProfile.Address1 = string.Empty; blankProfile.City = string.Empty; blankProfile.State = string.Empty; blankProfile.LastUpdated = null; using (var ts = new TransactionScope()) { ProfileBLL.EnsurePersistent(blankProfile); ts.CommitTransaction(); } }