///<summary>Returns true if the user switched to a different patient.</summary> public static bool PromptForMerge(Patient patCur, out Patient newPatCur) { newPatCur = patCur; if (patCur == null) { return(false); } List <PatientLink> listMergedPats = PatientLinks.GetLinks(patCur.PatNum, PatientLinkType.Merge); if (!PatientLinks.WasPatientMerged(patCur.PatNum, listMergedPats)) { return(false); } //This patient has been merged before. Get a list of all patients that this patient has been merged into. List <Patient> listPats = Patients.GetMultPats(listMergedPats.Where(x => x.PatNumTo != patCur.PatNum) .Select(x => x.PatNumTo).ToList()).ToList(); //Notify the user that the currently selected patient has been merged before and then ask them if they want to switch to the correct patient. foreach (Patient pat in listPats) { if (pat.PatStatus.In(PatientStatus.Patient, PatientStatus.Inactive) && (MessageBox.Show(Lan.g("ContrAppt", "The currently selected patient has been merged into another patient.\r\n" + "Switch to patient") + " " + pat.GetNameLF() + " #" + pat.PatNum.ToString() + "?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)) { newPatCur = pat; return(true); } } //The user has declined every possible patient that the current patient was merged to. Let them keep the merge from patient selected. return(false); }
private void FillFamily() { PatNumSelected = _patCur.PatNum; //just in case user has selected a different family member _listRecalls = Recalls.GetList(_famCur.ListPats.ToList()); //Appointment[] aptsOnePat; List <PatientLink> listLinks = PatientLinks.GetLinks(_famCur.ListPats.Select(x => x.PatNum).ToList(), PatientLinkType.Merge); listViewFamily.Items.Clear(); ListViewItem item; DateTime dateDue; DateTime dateSched; for (int i = 0; i < _famCur.ListPats.Length; i++) { if (PatientLinks.WasPatientMerged(_famCur.ListPats[i].PatNum, listLinks)) { continue; //Do not include Merged patients in the displayed list. } item = new ListViewItem(_famCur.GetNameInFamFLI(i)); item.Tag = _famCur.ListPats[i]; if (_famCur.ListPats[i].PatNum == _patCur.PatNum) { item.BackColor = Color.Silver; } item.SubItems.Add(_famCur.ListPats[i].Age.ToString()); item.SubItems.Add(_famCur.ListPats[i].Gender.ToString()); dateDue = DateTime.MinValue; dateSched = DateTime.MinValue; bool isdisabled = false; for (int j = 0; j < _listRecalls.Count; j++) { if (_listRecalls[j].PatNum == _famCur.ListPats[i].PatNum && (_listRecalls[j].RecallTypeNum == RecallTypes.PerioType || _listRecalls[j].RecallTypeNum == RecallTypes.ProphyType)) { dateDue = _listRecalls[j].DateDue; dateSched = _listRecalls[j].DateScheduled; isdisabled = _listRecalls[j].IsDisabled; } } if (isdisabled) { item.SubItems.Add(Lan.g(this, "disabled")); } else if (dateDue.Year < 1880) { item.SubItems.Add(""); } else { item.SubItems.Add(dateDue.ToShortDateString()); } if (dateDue <= DateTime.Today) { item.ForeColor = Color.Red; } if (dateSched.Year < 1880) { item.SubItems.Add(""); } else { item.SubItems.Add(dateSched.ToShortDateString()); } listViewFamily.Items.Add(item); } checkDone.Checked = _patCur.PlannedIsDone; textFinUrg.Text = _famCur.ListPats[0].FamFinUrgNote; }
private void FormSubscriberSelect_Load(object sender, System.EventArgs e) { _listMergeLinks = PatientLinks.GetLinks(FamCur.ListPats.Select(x => x.PatNum).ToList(), PatientLinkType.Merge); FillList(); }