//Get a single patient from the patient table and set name and id to display private void formPersonalHealthRecord_Load(object sender, EventArgs e) { patient = (from patients in entities.PATIENT_TBL select patient).First(); //If there is no patient data load fake data if (patient != null) { txtFirstName.Text = patient.FIRST_NAME; txtIdentityNumber.Text = patient.PATIENT_ID; txtLastName.Text = patient.LAST_NAME; } else { txtIdentityNumber.Text = "0000000001"; txtFirstName.Text = "Devon"; txtLastName.Text = "Lucey"; } }
private void btnRegister_Click(object sender, EventArgs e) { PATIENT_TBL pateint = new PATIENT_TBL() { PATIENT_ID = txtIdNumber.Text, LAST_NAME = txtLastName.Text, FIRST_NAME = txtFirstName.Text, ADDRESS_STREET = string.Empty, ADDRESS_CITY = string.Empty, ADDRESS_STATE = string.Empty, ADDRESS_ZIP = string.Empty, PHONE_HOME = string.Empty, PHONE_MOBILE = string.Empty, PRIMARY_ID = string.Empty }; pchr42563Entities entities = new pchr42563Entities(); entities.PATIENT_TBL.Add(pateint); entities.SaveChanges(); MessageBox.Show("Registration Complete"); this.Close(); }