private void button1_Click(object sender, EventArgs e) { fac.Clear(); if (poolYes.Checked) { Facility f1 = new Facility(1, "Pool", true); fac.Add(f1); } if (saunaYes.Checked) { Facility f1 = new Facility(2, "Sauna", true); fac.Add(f1); } if (jakuziYes.Checked) { Facility f1 = new Facility(1, "Jacuzi", true); fac.Add(f1); } if (lockerYes.Checked) { Facility f1 = new Facility(1, "Lockers", true); fac.Add(f1); } if (radioButton1.Checked) { branch = new Branch(1, "Johar Town"); } if (radioButton2.Checked) { branch = new Branch(2, "DHA"); } refId = comboBox1.SelectedIndex; did = comboBox2.SelectedIndex; exid = comboBox3.SelectedIndex; if (feedbackTextField.Text == "") { var myForm = new Views.ErrorPop(); myForm.Show(); return; } Member m = new Member(Convert.ToInt32(textBox1.Text), textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, textBox7.Text, Convert.ToDouble(textBox8.Text), Convert.ToDouble(textBox9.Text), textBox10.Text, textBox11.Text, textBox12.Text, refId, did, exid, fac, branch); FileManager fm = new FileManager(); Admin admin = fm.ReadFromJsonFile <Admin>(Constants.Constants.adminFileName); admin.addMember(m); // Set FeedBack Feedback f = new Feedback(DateTime.Now, feedbackTextField.Text, m.ID); admin.setFeedback(f); // Set Medical History MedicalHistory mh = new MedicalHistory(m.ID, DateTime.Now, textBox10.Text, m.ID); admin.setMedicalHistory(mh); }
public void setMedicalHistory(MedicalHistory mh) { Constants.Constants.medical.Add(mh); fm.WriteToJsonFile(Constants.Constants.medicalFileName, Constants.Constants.medical); }