using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using CareersOnlineLibrary; using CareersOnlineLibrary.Entity; using CareersOnlineLibrary.Controller; using System.IO; namespace WebApplication1.Account { public partial class Register : System.Web.UI.Page { TRAProfile traUser = new TRAProfile(); protected void Page_Load(object sender, EventArgs e) { //RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"]; InitialisePage(); } protected void RegisterUser_CreatedUser(object sender, EventArgs e) { //FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */); //string continueUrl = RegisterUser.ContinueDestinationPageUrl; //if (String.IsNullOrEmpty(continueUrl)) //{ // continueUrl = "~/"; //} //Response.Redirect(continueUrl); } private void InitialisePage() { if (!IsPostBack) { NameIDEntityCollection gender = new NameIDEntityCollection(); NameIDEntityCollection location = new NameIDEntityCollection(); CareersOnlineController controller = new CareersOnlineController(); gender = controller.GetGender(); location = controller.GetCountries(); Gender.DataSource = gender; Gender.DataBind(); Country.DataSource = location; Country.DataBind(); controller = null; } } protected void CreateUserButton_Click(object sender, EventArgs e) { traUser.FirstName = UserName.Text; traUser.LastName = LastName.Text; traUser.Gender = Gender.SelectedItem.Text; traUser.Email = Email.Text; traUser.ContactNumber = PhoneNumber.Text; traUser.Country = Country.SelectedItem.Text; traUser.Password = Password.Text; //Insert user details into the job seeker profile table CareersOnlineController controller = new CareersOnlineController(); int traUserID = controller.CreateTRAProfile(traUser); /*if (jobSeekerID > 0) { string fileName = Path.GetFileName( Resume.PostedFile.FileName); string fileLocation = Server.MapPath("~/Resumes/" + jobSeekerID.ToString() + "_" + fileName); Resume.SaveAs(fileLocation); //Insert link to resume in Resume Document table int affectedRows = controller.CreateResumeDocument(fileLocation, jobSeekerID); //Redirect user to the Login page for auto authentication Response.Redirect("~/Account/Login.aspx?autoLogin=true&userID=" + jobSeekerID.ToString()); } else { //inform user that profile cannot be created }*/ controller = null; traUser = null; Response.Redirect("~/Account/Login.aspx"); } } }