private void btn_OK_Click(object sender, EventArgs e) { Studies st = new Studies(); st.Show(); this.Hide(); }
private void btnSaveParents_Click(object sender, EventArgs e) { if (PersonalInformation.Worker) { Job j = new Job(); j.Show(); this.Hide(); } if (PersonalInformation.Student) { Studies st = new Studies(); st.Show(); this.Hide(); } if (PersonalInformation.unemployed) { Dashboard d = new Dashboard(); d.Show(); this.Hide(); } }
private void btnSaveParents_Click(object sender, EventArgs e) { try { con.Open(); //insert into father's table SqlCommand cmd1 = new SqlCommand("insert into Father(FirstName,Birthday,RespiratoryDiseases,CardiovascularDiseases,Diabetes,Cancer,FamilyDr,UserName)values(@FirstName,@Birthday,@RespiratoryDiseases,@CardiovascularDiseases,@Diabetes,@Cancer,@FamilyDr,@UserName)", con); cmd1.CommandType = CommandType.Text; cmd1.Parameters.AddWithValue("@FirstName", txt_firstnameFather.Text); cmd1.Parameters.AddWithValue("@Birthday", birthdayFather.Value.ToString()); cmd1.Parameters.AddWithValue("@RespiratoryDiseases", RD_F); cmd1.Parameters.AddWithValue("@CardiovascularDiseases", CV_F); cmd1.Parameters.AddWithValue("@Diabetes", D_F); cmd1.Parameters.AddWithValue("@Cancer", C_F); cmd1.Parameters.AddWithValue("@FamilyDr", txt_docFamily.Text); cmd1.Parameters.AddWithValue("@UserName", Home.FK); cmd1.ExecuteNonQuery(); //insert into mother's table SqlCommand cmd2 = new SqlCommand("insert into Mother(FirstName,Birthday,RespiratoryDiseases,CardiovascularDiseases,Diabetes,Cancer,FamilyDr,UserName)values(@FirstName,@Birthday,@RespiratoryDiseases,@CardiovascularDiseases,@Diabetes,@Cancer,@FamilyDr,@UserName)", con); cmd2.CommandType = CommandType.Text; cmd2.Parameters.AddWithValue("@FirstName", txt_firstnameMother.Text); cmd2.Parameters.AddWithValue("@Birthday", birthdayMother.Value.ToString()); cmd2.Parameters.AddWithValue("@RespiratoryDiseases", RD_M); cmd2.Parameters.AddWithValue("@CardiovascularDiseases", CV_M); cmd2.Parameters.AddWithValue("@Diabetes", D_M); cmd2.Parameters.AddWithValue("@Cancer", C_M); cmd2.Parameters.AddWithValue("@FamilyDr", txt_docFamily.Text); cmd2.Parameters.AddWithValue("@UserName", Home.FK); cmd2.ExecuteNonQuery(); MessageBox.Show("success"); //passage entre les interfaces if (PersonalInformation.Worker) { Job j = new Job(); j.Show(); this.Hide(); } if (PersonalInformation.Student) { Studies st = new Studies(); st.Show(); this.Hide(); } if (PersonalInformation.unemployed) { Dashboard d = new Dashboard(); d.Show(); this.Hide(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (con.State == ConnectionState.Open) { con.Close(); } } }