/// <summary> /// Handles the Click event of the Load_Button control. The record is parsed to find out what type of recall it is. A form is then called based on the selected recall method. The form is then cleared and reloaded once the recall has finished. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void Load_ButtonClick(object sender, EventArgs e) { PatientRecalls rcl = dbb.GetRecallByRclId(loadedrecall); switch ((RecallMethods)rcl.Method) { case RecallMethods.Post: using (PostRecall pr1 = new PostRecall(loadedrecall)) { pr1.ShowDialog(); } ClearRecalls(); break; case RecallMethods.Phone: using (PhoneRecall pr1 = new PhoneRecall(loadedrecall)) { pr1.ShowDialog(); } ClearRecalls(); break; case RecallMethods.Email: using (EmailRecall er1 = new EmailRecall(loadedrecall)) { er1.ShowDialog(); } ClearRecalls(); break; } //RefreshRecalls here }
/// <summary> /// If an outstanding recall has been found the user is prompted for confirmation. If they select to amend the values of the record will be loaded into the form. If they select no then the record will be deleted and replaced when they save. If they cancel the form will close /// </summary> private void HandleOutstandingRecord() { PatientRecalls pr1 = dbb.GetRecall(patientId); DialogResult dr = MessageBox.Show("An outstanding recall was found\nPress yes to load this or no to make a new recall", "Recall Found", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2); if (dr == DialogResult.Yes) { amend = true; datePrefTime_DateTime.Value = pr1.DateAndPrefTime.Value; reason_Text.Text = pr1.Reason; RecallMethods prm2 = (RecallMethods)pr1.Method; if (prm2 == RecallMethods.Post) { method_ComboBox.SelectedItem = "Post"; } else if (prm2 == RecallMethods.Phone) { method_ComboBox.SelectedItem = "Phone"; } else { method_ComboBox.SelectedItem = "Email"; //TODO: whatif recall method has been removed } } else if (dr == DialogResult.Cancel) { DialogResult = DialogResult.Cancel; Close(); } }
/// <summary> /// Initializes a new instance of the <see cref = "PhoneRecall" /> class. Gets the recall record and populates form fields with its values /// </summary> /// <param name = "RecallID">The recall ID.</param> public PhoneRecall(int RecallID) { InitializeComponent(); Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); dbb = new DBBackEnd(); rclrec = dbb.GetRecallByRclId(RecallID); name_Label.Text = rclrec.Patients.Name; telNum_Label.Text = rclrec.Patients.TelNum; reason_Label.Text = rclrec.Reason; cal_Calendar.SelectionStart = DateTime.Today.Date; }
/// <summary> /// Handles the SelectedIndexChanged event of the Recalls_List control. The record ID is parsed from the selected item. The record is then gotten and loaded into the form and the load button is 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 Recalls_ListSelectedIndexChanged(object sender, EventArgs e) { if (recalls_List.SelectedIndex == -1) { return; } string selecteditemstr = recalls_List.SelectedItem.ToString(); this.loadedrecall = int.Parse(selecteditemstr.Substring(0, selecteditemstr.IndexOf("-"))); PatientRecalls rcl = dbb.GetRecallByRclId(loadedrecall); name_Text.Text = rcl.Patients.Name; method_Text.Text = ((RecallMethods)rcl.Method).ToString(); reason_Text.Text = rcl.Reason; datePrefTime_Text.Text = rcl.DateAndPrefTime.Value.ToString(); load_Button.Enabled = true; }