/// <summary> /// Handles the SelectedIndexChanged event of the Conditions_List control. The record id of the selected condition is found, the item is loaded into the form and the editing buttons are enabled /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void Conditions_ListSelectedIndexChanged(object sender, EventArgs e) //TODO: ASK IF SAVE IS NEEDED FIXME { if (conditions_List.SelectedIndex == -1) { return; } condition_Text.Text = conditions_List.SelectedItem.ToString(); openCondition = dbb.ConditionId(conditions_List.SelectedItem.ToString()); FormState = true; }
/// <summary> /// Handles the Click event of the OK_Button control. Returns an error if no record is selected otherwise adds the selected condition to the patient and closes /// </summary> /// <param name = "sender">The source of the event.</param> /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param> private void OK_ButtonClick(object sender, EventArgs e) { errorProvider1.Clear(); if (condition_List.SelectedIndex == -1) { errorProvider1.SetError(condition_List, "No record has been selected"); return; } dbb.AttachCondition(PatientInfo.PatientID, dbb.ConditionId(condition_List.SelectedItem.ToString())); DialogResult = DialogResult.OK; Close(); }