///<summary>The main logic that sends Podium invitations. Set isService true only when the calling method is the Open Dental Service.</summary> public static void ThreadPodiumSendInvitations(bool isService) { long programNum = Programs.GetProgramNum(ProgramName.Podium); //Consider blocking re-entrance if this hasn't finished. //Only send invitations if the program link is enabled, the computer name is set to this computer, and eConnector is not set to send invitations if (!Programs.IsEnabled(ProgramName.Podium) || !ODEnvironment.IdIsThisComputer(ProgramProperties.GetPropVal(programNum, PropertyDescs.ComputerNameOrIP)) || ProgramProperties.GetPropVal(programNum, PropertyDescs.UseService) != POut.Bool(isService)) { return; } //Keep a consistant "Now" timestamp throughout this method. DateTime nowDT = MiscData.GetNowDateTime(); if (Podium.DateTimeLastRan == DateTime.MinValue) //First time running the thread. { Podium.DateTimeLastRan = nowDT.AddMilliseconds(-PodiumThreadIntervalMS); } ReviewInvitationTrigger newPatTrigger = PIn.Enum <ReviewInvitationTrigger>(ProgramProperties.GetPropVal(programNum, PropertyDescs.NewPatientTriggerType)); ReviewInvitationTrigger existingPatTrigger = PIn.Enum <ReviewInvitationTrigger>(ProgramProperties.GetPropVal(programNum, PropertyDescs.ExistingPatientTriggerType)); List <Appointment> listNewPatAppts = GetAppointmentsToSendReview(newPatTrigger, programNum, true); foreach (Appointment apptCur in listNewPatAppts) { Podium.SendData(Patients.GetPat(apptCur.PatNum), apptCur.ClinicNum); } List <Appointment> listExistingPatAppts = GetAppointmentsToSendReview(existingPatTrigger, programNum, false); foreach (Appointment apptCur in listExistingPatAppts) { Podium.SendData(Patients.GetPat(apptCur.PatNum), apptCur.ClinicNum); } Podium.DateTimeLastRan = nowDT; }
private void FillForm() { try { checkUseService.Checked = PIn.Bool(_useService.PropertyValue); checkShowCommlogsInChart.Checked = PIn.Bool(_showCommlogsInChartAndAccount.PropertyValue); checkEnabled.Checked = _progCur.Enabled; checkHideButtons.Checked = PIn.Bool(_disableAdvertising.PropertyValue); textApptSetComplete.Text = _apptSetCompleteMins.PropertyValue; textApptTimeArrived.Text = _apptTimeArrivedMins.PropertyValue; textApptTimeDismissed.Text = _apptTimeDismissedMins.PropertyValue; textCompNameOrIP.Text = _compName.PropertyValue; textAPIToken.Text = _apiToken.PropertyValue; if (_dictLocationIDs.ContainsKey(_clinicNumCur)) { textLocationID.Text = _dictLocationIDs[_clinicNumCur].PropertyValue; } else { textLocationID.Text = _dictLocationIDs[0].PropertyValue; //Default to showing the HQ value when filling info for a clinic with no program property. } _existingPatTriggerEnum = PIn.Enum <ReviewInvitationTrigger>(_existingPatTriggerType.PropertyValue); _newPatTriggerEnum = PIn.Enum <ReviewInvitationTrigger>(_newPatTriggerType.PropertyValue); switch (_existingPatTriggerEnum) { case ReviewInvitationTrigger.AppointmentCompleted: radioSetCompleteExistingPat.Checked = true; break; case ReviewInvitationTrigger.AppointmentTimeArrived: radioTimeArrivedExistingPat.Checked = true; break; case ReviewInvitationTrigger.AppointmentTimeDismissed: radioTimeDismissedExistingPat.Checked = true; break; } switch (_newPatTriggerEnum) { case ReviewInvitationTrigger.AppointmentCompleted: radioSetCompleteNewPat.Checked = true; break; case ReviewInvitationTrigger.AppointmentTimeArrived: radioTimeArrivedNewPat.Checked = true; break; case ReviewInvitationTrigger.AppointmentTimeDismissed: radioTimeDismissedNewPat.Checked = true; break; } } catch (Exception) { MsgBox.Show(this, "You are missing a program property from the database. Please call support to resolve this issue."); DialogResult = DialogResult.Cancel; return; } }
private void RadioButton_CheckChanged(object sender, EventArgs e) { if (sender.GetType() != typeof(RadioButton)) { return; } RadioButton radioButtonCur = (RadioButton)sender; if (radioButtonCur.Checked) { switch (radioButtonCur.Name) { case "radioSetCompleteExistingPat": _existingPatTriggerEnum = ReviewInvitationTrigger.AppointmentCompleted; break; case "radioTimeArrivedExistingPat": _existingPatTriggerEnum = ReviewInvitationTrigger.AppointmentTimeArrived; break; case "radioTimeDismissedExistingPat": _existingPatTriggerEnum = ReviewInvitationTrigger.AppointmentTimeDismissed; break; case "radioSetCompleteNewPat": _newPatTriggerEnum = ReviewInvitationTrigger.AppointmentCompleted; break; case "radioTimeArrivedNewPat": _newPatTriggerEnum = ReviewInvitationTrigger.AppointmentTimeArrived; break; case "radioTimeDismissedNewPat": _newPatTriggerEnum = ReviewInvitationTrigger.AppointmentTimeDismissed; break; default: throw new Exception("Unknown Radio Button Name"); } } }
private static List <Appointment> GetAppointmentsToSendReview(ReviewInvitationTrigger trigger, long programNum, bool isNewPatient) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Appointment> >(MethodBase.GetCurrentMethod(), trigger, programNum, isNewPatient)); } string minutesToWaitCompleted = ProgramProperties.GetPropVal(programNum, PropertyDescs.ApptSetCompletedMinutes); string minutesToWaitTimeArrived = ProgramProperties.GetPropVal(programNum, PropertyDescs.ApptTimeArrivedMinutes); string minutesToWaitTimeDismissed = ProgramProperties.GetPropVal(programNum, PropertyDescs.ApptTimeDismissedMinutes); string command = "SELECT * " + "FROM appointment " + "LEFT JOIN securitylog ON securitylog.FKey=appointment.AptNum " + "AND securitylog.PermType=" + POut.Int((int)Permissions.AppointmentEdit) + " AND securitylog.LogText LIKE '%Set Complete%' " + "LEFT JOIN commlog ON commlog.PatNum=appointment.PatNum " + "AND commlog.CommSource=" + POut.Int((int)CommItemSource.ProgramLink) + " " + "AND DATE(commlog.DateTimeEnd)=" + DbHelper.Curdate() + " " + "AND commlog.ProgramNum=" + POut.Long(programNum) + " " + "WHERE ISNULL(commlog.PatNum) AND appointment.AptDateTime BETWEEN " + DbHelper.Curdate() + " AND " + DbHelper.Now() + " + INTERVAL 1 HOUR "//Hard code an hour to allow for appointments that have an early DateTimeArrived + "AND appointment.IsNewPatient=" + POut.Bool(isNewPatient) + " "; if (trigger == ReviewInvitationTrigger.AppointmentCompleted) { command += "AND appointment.AptStatus=" + POut.Int((int)ApptStatus.Complete) + " " + "AND NOT ISNULL(securitylog.PatNum) " + "AND securitylog.LogDateTime + INTERVAL " + minutesToWaitCompleted + " MINUTE <=" + DbHelper.Now() + " "; } else if (trigger == ReviewInvitationTrigger.AppointmentTimeArrived) { command += "AND appointment.AptStatus IN (" + POut.Int((int)ApptStatus.Scheduled) + "," + POut.Int((int)ApptStatus.Complete) + ") " + "AND ((appointment.AptStatus=" + POut.Int((int)ApptStatus.Complete) + " AND NOT ISNULL(securitylog.PatNum) AND securitylog.LogDateTime + INTERVAL " + minutesToWaitCompleted + " MINUTE <=" + DbHelper.Now() + ") " + "OR (appointment.DateTimeArrived>" + DbHelper.Curdate() + " AND appointment.DateTimeArrived + INTERVAL " + minutesToWaitTimeArrived + " MINUTE<=" + DbHelper.Now() + ")) "; } else if (trigger == ReviewInvitationTrigger.AppointmentTimeDismissed) { command += "AND appointment.AptStatus IN (" + POut.Int((int)ApptStatus.Scheduled) + "," + POut.Int((int)ApptStatus.Complete) + ") " + "AND ((appointment.AptStatus=" + POut.Int((int)ApptStatus.Complete) + " AND NOT ISNULL(securitylog.PatNum) AND securitylog.LogDateTime + INTERVAL 90 MINUTE <=" + DbHelper.Now() + ") " + "OR (appointment.DateTimeDismissed>" + DbHelper.Curdate() + " AND appointment.DateTimeDismissed + INTERVAL " + minutesToWaitTimeDismissed + " MINUTE<=" + DbHelper.Now() + ")) "; } return(Crud.AppointmentCrud.SelectMany(command)); }