public Job_Seeker_Accountview(int JBskId, string user_name) { InitializeComponent(); _db = new Jobapp_dbEntities(); user_name_tb.Text = user_name; var job_seeker = new Jobseeker_details(); Job_seeker_id = JBskId; // MessageBox.Show($"{Job_seeker_id}"); }
private void Register_bt_Click(object sender, EventArgs e) { try { var First_name = textBox_fname.Text; var Last_name = textBox_lname.Text; int age = int.Parse(textBox_age.Text); var User_name = textBox_username.Text; var password = textBox_createpass.Text; var IsValid = true; if (string.IsNullOrWhiteSpace(First_name) || string.IsNullOrWhiteSpace(Last_name) || string.IsNullOrWhiteSpace(User_name) || string.IsNullOrWhiteSpace(password)) { IsValid = false; MessageBox.Show("Error, required fields were not populated"); } if (age <= 0 || age < 18) { IsValid = false; MessageBox.Show("Too young for this application"); } if (IsValid) { var hashed_password = Utils.HashedPassword(password); var jobJobseeker_detail = new Jobseeker_details { First_name = First_name, Last_name = Last_name, User_Name = User_name, Jobseeker_age = age, Password = hashed_password }; _db.Jobseeker_details.Add(jobJobseeker_detail); _db.SaveChanges(); MessageBox.Show("Registration was successful"); } } catch (Exception ex) { MessageBox.Show(ex.Message); // throw; } }