private void PromptTextASAPList() { if (!PrefC.GetBool(PrefName.WebSchedAsapEnabled) || Appointments.RefreshASAP(0, 0, _appt.ClinicNum, new List <ApptStatus>()).Count == 0 || !MsgBox.Show("Appointment", MsgBoxButtons.YesNo, "Text patients on the ASAP List and offer them this opening?")) { return; } DateTime slotStart = AppointmentL.DateSelected.Date; //Midnight DateTime slotEnd = AppointmentL.DateSelected.Date.AddDays(1); //Midnight tomorrow //Loop through all other appts in the op to find a slot that will not overlap. List <Appointment> listApptsInOp = Appointments.GetAppointmentsForOpsByPeriod(new List <long> { _appt.Op }, _appt.AptDateTime); foreach (Appointment otherAppt in listApptsInOp.Where(x => x.AptNum != _appt.AptNum)) { DateTime dateEndApt = otherAppt.AptDateTime.AddMinutes(otherAppt.Pattern.Length * 5); if (dateEndApt.Between(slotStart, _appt.AptDateTime)) { slotStart = dateEndApt; } if (otherAppt.AptDateTime.Between(_appt.AptDateTime, slotEnd)) { slotEnd = otherAppt.AptDateTime; } } slotStart = ODMathLib.Max(slotStart, _appt.AptDateTime.AddHours(-1)); slotEnd = ODMathLib.Min(slotEnd, _appt.AptDateTime.AddHours(3)); FormASAP formASAP = new FormASAP(_appt.AptDateTime, slotStart, slotEnd, _appt.Op); formASAP.ShowDialog(); }
private void FillGrid() { this.Cursor = Cursors.WaitCursor; /*string order=""; * switch(comboOrder.SelectedIndex) { * case 0: * order="status"; * break; * case 1: * order="alph"; * break; * case 2: * order="date"; * break; * }*/ long provNum = 0; if (comboProv.SelectedIndex != 0) { provNum = ProviderC.ListShort[comboProv.SelectedIndex - 1].ProvNum; } long siteNum = 0; if (!PrefC.GetBool(PrefName.EasyHidePublicHealth) && comboSite.SelectedIndex != 0) { siteNum = SiteC.List[comboSite.SelectedIndex - 1].SiteNum; } long clinicNum = 0; if (comboClinic.SelectedIndex > 0) { clinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum; } ListASAP = Appointments.RefreshASAP(provNum, siteNum, clinicNum); int scrollVal = grid.ScrollValue; grid.BeginUpdate(); grid.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableASAP", "Patient"), 140); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableASAP", "Date"), 65); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableASAP", "Status"), 110); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableASAP", "Prov"), 50); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableASAP", "Procedures"), 150); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableASAP", "Notes"), 200); grid.Columns.Add(col); grid.Rows.Clear(); ODGridRow row; for (int i = 0; i < ListASAP.Count; i++) { row = new ODGridRow(); row.Cells.Add(patientNames[ListASAP[i].PatNum]); if (ListASAP[i].AptDateTime.Year < 1880) //shouldn't be possible. { row.Cells.Add(""); } else { row.Cells.Add(ListASAP[i].AptDateTime.ToShortDateString()); } row.Cells.Add(DefC.GetName(DefCat.RecallUnschedStatus, ListASAP[i].UnschedStatus)); row.Cells.Add(Providers.GetAbbr(ListASAP[i].ProvNum)); row.Cells.Add(ListASAP[i].ProcDescript); row.Cells.Add(ListASAP[i].Note); grid.Rows.Add(row); } grid.EndUpdate(); grid.ScrollValue = scrollVal; Cursor = Cursors.Default; }