///<summary>Load values from database for hidden preferences if they exist. If a pref doesn't exist then the corresponding UI is hidden.</summary> private void FillHiddenPrefs() { FillOptionalPrefBool(checkAgingEnterprise, PrefName.AgingIsEnterprise); FillOptionalPrefBool(checkAgingShowPayplanPayments, PrefName.AgingReportShowAgePatPayplanPayments); FillOptionalPrefBool(checkClaimSnapshotEnabled, PrefName.ClaimSnapshotEnabled); FillOptionalPrefBool(checkDBMDisableOptimize, PrefName.DatabaseMaintenanceDisableOptimize); FillOptionalPrefBool(checkDBMSkipCheckTable, PrefName.DatabaseMaintenanceSkipCheckTable); validDateAgingServiceTimeDue.Text = PrefC.GetDateT(PrefName.AgingServiceTimeDue).ToShortTimeString(); checkEnableClinics.Checked = PrefC.HasClinicsEnabled; string updateStreamline = GetHiddenPrefString(PrefName.UpdateStreamLinePassword); if (updateStreamline != null) { checkUpdateStreamlinePassword.Checked = (updateStreamline == "abracadabra"); } else { checkUpdateStreamlinePassword.Visible = false; } string updateLargeTables = GetHiddenPrefString(PrefName.UpdateAlterLargeTablesDirectly); if (updateLargeTables != null) { checkUpdateAlterLargeTablesDirectly.Checked = updateLargeTables == "1"; } else { checkUpdateAlterLargeTablesDirectly.Visible = false; } }
private void butOK_Click(object sender, EventArgs e) { bool changed = false; if (!ValidEntries()) { return; } if (PIn.DateT(textStartTime.Text).Hour != PrefC.GetDateT(PrefName.ApptPrintTimeStart).Hour || PIn.DateT(textStopTime.Text).Hour != PrefC.GetDateT(PrefName.ApptPrintTimeStop).Hour || textFontSize.Text != PrefC.GetString(PrefName.ApptPrintFontSize) || textColumnsPerPage.Text != PrefC.GetInt(PrefName.ApptPrintColumnsPerPage).ToString()) { changed = true; } if (changed) { if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Save the changes that were made?")) { SaveChanges(true); } } ApptPrintStartTime = PIn.DateT(textStartTime.Text); ApptPrintStopTime = PIn.DateT(textStopTime.Text); ApptPrintFontSize = PIn.Int(textFontSize.Text); ApptPrintColsPerPage = PIn.Int(textColumnsPerPage.Text); DialogResult = DialogResult.OK; }
///<summary>Checks if Repeating Charges are already running on another workstation or by the OpenDental Service. If less than 24 hours have ///passed since the tool was started, user will be blocked from running Repeating Charges. Otherwise, SecurityAdmin users can restart the tool. ///</summary> private bool CheckBeginDateTime() { Prefs.RefreshCache(); //Just to be sure we don't miss someone who has just started running repeating charges. if (PrefC.GetString(PrefName.RepeatingChargesBeginDateTime) == "") { return(true); } DateTime repeatingChargesBeginDateTime = PrefC.GetDateT(PrefName.RepeatingChargesBeginDateTime); if ((MiscData.GetNowDateTime() - repeatingChargesBeginDateTime).TotalHours < 24) { MsgBox.Show(this, "Repeating charges already running on another workstation, you must wait for them to finish before continuing."); return(false); } //It's been more than 24 hours since repeat charges started. if (Security.IsAuthorized(Permissions.SecurityAdmin, true)) { string message = Lans.g(this, "Repeating Charges last started on") + " " + repeatingChargesBeginDateTime.ToString() + Lans.g(this, ". Restart repeating charges?"); if (MsgBox.Show(MsgBoxButtons.OKCancel, message)) { SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, "Restarted repeating charges. Previous Repeating Charges Begin DateTime was " + repeatingChargesBeginDateTime.ToString() + "."); return(true); } return(false); //Security admin doesn't want to restart repeat charges. } //User isn't a security admin. MsgBox.Show(Lans.g(this, "Repeating Charges last started on") + " " + repeatingChargesBeginDateTime.ToString() + Lans.g(this, ". Contact a user with SecurityAdmin permission to restart repeating charges.")); return(false); }
public static string MainTitleUpdateCountdown(string titleText = "") { string retVal; TimeSpan timeLeft = PrefC.GetDateT(PrefName.UpdateDateTime) - DateTime.Now; string strTimeLeft = ""; if (timeLeft.TotalSeconds >= 0) { if (timeLeft.Days >= 1) { strTimeLeft = timeLeft.Days + " " + Lan.g("FormOpenDental", "days") + ", " + timeLeft.Hours + " " + Lan.g("FormOpenDental", "hours"); } else if (timeLeft.Hours >= 1) { strTimeLeft = timeLeft.Hours + " " + Lan.g("FormOpenDental", "hours") + ", " + timeLeft.Minutes + " " + Lan.g("FormOpenDental", "minutes"); } else if (timeLeft.Minutes >= 1) { strTimeLeft = timeLeft.Minutes + " " + Lan.g("FormOpenDental", "minutes") + ", " + timeLeft.Seconds + " " + Lan.g("FormOpenDental", "seconds"); } else if (timeLeft.Seconds >= 0) { strTimeLeft = timeLeft.Seconds + " " + Lan.g("FormOpenDental", "seconds"); } } else { return(titleText); } retVal = titleText + " " + Lan.g("FormOpenDental", "Update In") + ": " + strTimeLeft; return(retVal); }
private bool PrintViewSetup() { bool changed = false; if (!ValidEntries()) { return(false); } if (PIn.DateT(comboStart.SelectedItem.ToString()).Hour != PrefC.GetDateT(PrefName.ApptPrintTimeStart).Hour || PIn.DateT(comboStop.SelectedItem.ToString()).Hour != PrefC.GetDateT(PrefName.ApptPrintTimeStop).Hour || textFontSize.Text != PrefC.GetString(PrefName.ApptPrintFontSize) || textColumnsPerPage.Text != PrefC.GetInt(PrefName.ApptPrintColumnsPerPage).ToString()) { changed = true; } if (changed) { if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Save the changes that were made?")) { SaveChanges(true); } } ApptPrintStartTime = PIn.DateT(comboStart.SelectedItem.ToString()); ApptPrintStopTime = PIn.DateT(comboStop.SelectedItem.ToString()); ApptPrintFontSize = PIn.Int(textFontSize.Text); ApptPrintColsPerPage = PIn.Int(textColumnsPerPage.Text); return(true); }
private void FormApptPrintSetup_Load(object sender, EventArgs e) { TimeSpan time; string timeStart = PrefC.GetDateT(PrefName.ApptPrintTimeStart).ToShortTimeString(); string timeStop = PrefC.GetDateT(PrefName.ApptPrintTimeStop).ToShortTimeString(); for (int i = 0; i <= 24; i++) { time = new TimeSpan(i, 0, 0); comboStart.Items.Add(time.ToShortTimeString()); comboStop.Items.Add(time.ToShortTimeString()); if (time.ToShortTimeString() == timeStart) { comboStart.SelectedIndex = i; } if (time.ToShortTimeString() == timeStop) { comboStop.SelectedIndex = i; } } textFontSize.Text = PrefC.GetString(PrefName.ApptPrintFontSize); textColumnsPerPage.Text = PrefC.GetInt(PrefName.ApptPrintColumnsPerPage).ToString(); if (PrefC.HasClinicsEnabled && Clinics.ClinicNum == 0) //Hide if clinics is enabled and headquarters is selected { groupBoxPrintRouting.Enabled = false; } if (_isWeeklyView) //Disable if the user has the weekly view selected in the appt module { groupBoxPrintRouting.Enabled = false; } }
private void ShowProgressForm(DateTime changedSince) { if (checkTroubleshooting.Checked) { IsTroubleshootMode = true; } else { IsTroubleshootMode = false; } DateTime timeSynchStarted = MiscData.GetNowDateTime(); FormP = new FormProgress(); FormP.MaxVal = 100; //to keep the form from closing until the real MaxVal is set. FormP.NumberMultiplication = 1; FormP.DisplayText = "Preparing records for upload."; FormP.NumberFormat = "F0"; //start the thread that will perform the upload ThreadStart uploadDelegate = delegate { UploadWorker(changedSince, timeSynchStarted); }; Thread workerThread = new Thread(uploadDelegate); workerThread.Start(); //display the progress dialog to the user: FormP.ShowDialog(); if (FormP.DialogResult == DialogResult.Cancel) { workerThread.Abort(); } changed = true; textDateTimeLastRun.Text = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun).ToShortDateString() + " " + PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun).ToShortTimeString(); }
private void FormUpdateSetup_Load(object sender, EventArgs e) { if (!Security.IsAuthorized(Permissions.SecurityAdmin, true)) { butChangeRegKey.Enabled = false; butOK.Enabled = false; } textUpdateServerAddress.Text = PrefC.GetString(PrefName.UpdateServerAddress); textWebsitePath.Text = PrefC.GetString(PrefName.UpdateWebsitePath); textWebProxyAddress.Text = PrefC.GetString(PrefName.UpdateWebProxyAddress); textWebProxyUserName.Text = PrefC.GetString(PrefName.UpdateWebProxyUserName); textWebProxyPassword.Text = PrefC.GetString(PrefName.UpdateWebProxyPassword); string regkey = PrefC.GetString(PrefName.RegistrationKey); if (regkey.Length == 16) { textRegKey.Text = regkey.Substring(0, 4) + "-" + regkey.Substring(4, 4) + "-" + regkey.Substring(8, 4) + "-" + regkey.Substring(12, 4); } else { textRegKey.Text = regkey; } textMultiple.Text = PrefC.GetString(PrefName.UpdateMultipleDatabases); checkShowMsi.Checked = PrefC.GetBool(PrefName.UpdateShowMsiButtons); _updateTime = PrefC.GetDateT(PrefName.UpdateDateTime); textUpdateTime.Text = _updateTime.ToString(); if (PrefC.AtoZfolderUsed != DataStorageType.LocalAtoZ) { labelRecopy.Text = @"Recopy all of the files from C:\Program Files\Open Dental\ into a special place in the database for future use in updating other computers."; } }
private void FillTabMobileSynch() { textMobileSyncServerURL.Text = PrefC.GetString(PrefName.MobileSyncServerURL); textSynchMinutes.Text = PrefC.GetInt(PrefName.MobileSyncIntervalMinutes).ToString(); textDateBefore.Text = PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).ToShortDateString(); textMobileSynchWorkStation.Text = PrefC.GetString(PrefName.MobileSyncWorkstationName); textMobileUserName.Text = PrefC.GetString(PrefName.MobileUserName); textMobilePassword.Text = ""; //not stored locally, and not pulled from web server DateTime lastRun = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun); if (lastRun.Year > 1880) { textDateTimeLastRun.Text = lastRun.ToShortDateString() + " " + lastRun.ToShortTimeString(); } //Hide the Old-style Mobile Synch tab and make visible the button that unhides the tab, //only if mobile synch has not been used for at least a month. If used again, the clock will reset //and the if (MiscData.GetNowDateTime().Subtract(lastRun.Date).TotalDays > 30) { groupNotUsed.Visible = true; butShowOldMobileSych.Visible = true; tabControl.TabPages.Remove(tabMobileSynch); } //Web server is not contacted when loading this form. That would be too slow. //CreateAppointments(5); }
private void FormApptPrintSetup_Load(object sender, EventArgs e) { textStartTime.Text = PrefC.GetDateT(PrefName.ApptPrintTimeStart).ToShortTimeString(); textStopTime.Text = PrefC.GetDateT(PrefName.ApptPrintTimeStop).ToShortTimeString(); textFontSize.Text = PrefC.GetString(PrefName.ApptPrintFontSize); textColumnsPerPage.Text = PrefC.GetInt(PrefName.ApptPrintColumnsPerPage).ToString(); }
private void FormClearinghouses_Load(object sender, System.EventArgs e) { textReportComputerName.Text = PrefC.GetString(PrefName.ClaimReportComputerName); int claimReportReceiveInterval = PrefC.GetInt(PrefName.ClaimReportReceiveInterval); checkReceiveReportsService.Checked = PrefC.GetBool(PrefName.ClaimReportReceivedByService); _listClearinghousesHq = Clearinghouses.GetDeepCopy(true); _listClearinghousesClinicAll = Clearinghouses.GetAllNonHq(); _listClearinghousesClinicCur = new List <Clearinghouse>(); _selectedClinicNum = 0; if (PrefC.HasClinicsEnabled) { comboClinic.Visible = true; labelClinic.Visible = true; FillClinics(); } if (CultureInfo.CurrentCulture.Name.EndsWith("CA")) { butEligibility.Visible = false; } FillGrid(); if (claimReportReceiveInterval == 0) { radioTime.Checked = true; DateTime fullDateTime = PrefC.GetDateT(PrefName.ClaimReportReceiveTime); textReportCheckTime.Text = fullDateTime.ToShortTimeString(); } else { textReportCheckInterval.Text = POut.Int(claimReportReceiveInterval); radioInterval.Checked = true; } }
///<summary>If !isPreCharges, a message box will display for any errors instructing users to try again. If the failed aging attempt is after ///charges have been added/deleted, we don't want to inform the user that the transaction failed so run again since the charges were successfully ///inserted/deleted and it was only updating the aged balances that failed. If isPreCharges, this won't run aging again if the last aging run was ///today. If !isPreCharges, we will run aging even if it was run today to update aged bals to include the charges added/deleted.</summary> private bool RunAgingEnterprise(bool isOnLoad = false) { DateTime dtNow = MiscData.GetNowDateTime(); DateTime dtToday = dtNow.Date; DateTime dateLastAging = PrefC.GetDate(PrefName.DateLastAging); if (isOnLoad && dateLastAging.Date == dtToday) { return(true); //this is prior to inserting/deleting charges and aging has already been run for this date } Prefs.RefreshCache(); DateTime dateTAgingBeganPref = PrefC.GetDateT(PrefName.AgingBeginDateTime); if (dateTAgingBeganPref > DateTime.MinValue) { if (isOnLoad) { MessageBox.Show(this, Lan.g(this, "In order to add finance charges, aging must be calculated, but you cannot run aging until it has finished " + "the current calculations which began on") + " " + dateTAgingBeganPref.ToString() + ".\r\n" + Lans.g(this, "If you believe the current aging " + "process has finished, a user with SecurityAdmin permission can manually clear the date and time by going to Setup | Miscellaneous and " + "pressing the 'Clear' button.")); } return(false); } Prefs.UpdateString(PrefName.AgingBeginDateTime, POut.DateT(dtNow, false)); //get lock on pref to block others Signalods.SetInvalid(InvalidType.Prefs); //signal a cache refresh so other computers will have the updated pref as quickly as possible Action actionCloseProgress = null; try { actionCloseProgress = ODProgressOld.ShowProgressStatus("FinanceCharge", this, Lan.g(this, "Calculating enterprise aging for all patients as of") + " " + dtToday.ToShortDateString() + "..."); Cursor = Cursors.WaitCursor; Ledgers.ComputeAging(0, dtToday); Prefs.UpdateString(PrefName.DateLastAging, POut.Date(dtToday, false)); } catch (MySqlException ex) { actionCloseProgress?.Invoke(); //effectively terminates progress bar Cursor = Cursors.Default; if (ex == null || ex.Number != 1213) //not a deadlock error, just throw { throw; } if (isOnLoad) { MsgBox.Show(this, "Deadlock error detected in enterprise aging transaction and rolled back. Try again later."); } return(false); } finally { actionCloseProgress?.Invoke(); //effectively terminates progress bar Cursor = Cursors.Default; Prefs.UpdateString(PrefName.AgingBeginDateTime, ""); //clear lock on pref whether aging was successful or not Signalods.SetInvalid(InvalidType.Prefs); } return(true); }
public void RepeatCharges_RunRepeatingCharges_PrefsUpdate() { DateTime dateTimeLastRunExpected = new DateTime(2018, 05, 09); string strBeginDateTimeExpected = ""; //Will be empty after a successfully run Repeating Charges. RepeatCharges.RunRepeatingCharges(dateTimeLastRunExpected); Prefs.RefreshCache(); Assert.AreEqual(strBeginDateTimeExpected, PrefC.GetString(PrefName.RepeatingChargesBeginDateTime)); Assert.AreEqual(dateTimeLastRunExpected, PrefC.GetDateT(PrefName.RepeatingChargesLastDateTime)); }
private void FillTabMisc() { //.NET has a bug in the DateTimePicker control where the text will not get updated and will instead default to showing DateTime.Now. //In order to get the control into a mode where it will display the correct value that we set, we need to set the property Checked to true. //Today's date will show even when the property is defaulted to true (via the designer), so we need to do it programmatically right here. //E.g. set your computer region to Assamese (India) and the DateTimePickers on the Automation Setting tab will both be set to todays date // if the tab is NOT set to be the first tab to display (don't ask me why it works then). //This is bad for our customers because setting both of the date pickers to the same date and time will cause automation to stop. dateRunStart.Checked = true; dateRunEnd.Checked = true; //Now that the DateTimePicker controls are ready to display the DateTime we set, go ahead and set them. //If loading the picker controls with the DateTime fields from the database failed, the date picker controls default to 7 AM and 10 PM. ODException.SwallowAnyException(() => { dateRunStart.Value = PrefC.GetDateT(PrefName.AutomaticCommunicationTimeStart); dateRunEnd.Value = PrefC.GetDateT(PrefName.AutomaticCommunicationTimeEnd); }); labelDateCustom.Text = ""; radioDateShortDate.Text = DateTime.Today.ToString(_shortDateFormat); //Formats as '3/15/2018' radioDateLongDate.Text = DateTime.Today.ToString(_longDateFormat); //Formats as 'Thursday, March 15, 2018' radioDateMMMMdyyyy.Text = DateTime.Today.ToString(_dateFormatMMMMdyyyy); //Formats as 'March 15, 2018' radioDatem.Text = DateTime.Today.ToString(_dateFormatm); //Formats as 'March 15' string curFormat = PrefC.GetString(PrefName.PatientCommunicationDateFormat); if (curFormat == CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern) { curFormat = _shortDateFormat; } if (curFormat == CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern) { curFormat = _longDateFormat; } switch (curFormat) { case _shortDateFormat: radioDateShortDate.Checked = true; break; case _longDateFormat: radioDateLongDate.Checked = true; break; case _dateFormatMMMMdyyyy: radioDateMMMMdyyyy.Checked = true; break; case _dateFormatm: radioDatem.Checked = true; break; default: radioDateCustom.Checked = true; textDateCustom.Text = PrefC.GetString(PrefName.PatientCommunicationDateFormat); break; } }
///<summary>Called from FormOpenDental and from FormEhrOnlineAccess. doForce is set to false to follow regular synching interval.</summary> public static void SynchFromMain(bool doForce) { if (Application.OpenForms["FormMobile"] != null) //tested. This prevents main synch whenever this form is open. { return; } if (IsSynching) { return; } DateTime timeSynchStarted = MiscData.GetNowDateTime(); if (!doForce) //if doForce, we skip checking the interval { if (timeSynchStarted < PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun).AddMinutes(PrefC.GetInt(PrefName.MobileSyncIntervalMinutes))) { return; } } //if(PrefC.GetString(PrefName.MobileSyncServerURL).Contains("192.168.0.196") || PrefC.GetString(PrefName.MobileSyncServerURL).Contains("localhost")) { if (PrefC.GetString(PrefName.MobileSyncServerURL).Contains("10.10.1.196") || PrefC.GetString(PrefName.MobileSyncServerURL).Contains("localhost")) { IgnoreCertificateErrors(); } if (!TestWebServiceExists()) { if (!doForce) //if being used from FormOpenDental as part of timer { if (IsServerAvail) //this will only happen the first time to prevent multiple windows. { IsServerAvail = false; DialogResult res = MessageBox.Show("Mobile synch server not available. Synch failed. Turn off synch?", "", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { Prefs.UpdateInt(PrefName.MobileSyncIntervalMinutes, 0); } } } return; } else { IsServerAvail = true; } DateTime changedSince = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun); //FormProgress FormP=new FormProgress();//but we won't display it. //FormP.NumberFormat=""; //FormP.DisplayText=""; //start the thread that will perform the upload ThreadStart uploadDelegate = delegate { UploadWorker(changedSince, timeSynchStarted); }; Thread workerThread = new Thread(uploadDelegate); workerThread.Start(); }
private bool RunAgingEnterprise(DateTime dateCalc) { DateTime dateLastAging = PrefC.GetDate(PrefName.DateLastAging); if (dateLastAging.Date == dateCalc.Date) { if (MessageBox.Show(this, Lan.g(this, "Aging has already been calculated for") + " " + dateCalc.ToShortDateString() + " " + Lan.g(this, "and does not normally need to run more than once per day.\r\n\r\nRun anway?"), "", MessageBoxButtons.YesNo) != DialogResult.Yes) { return(false); } } //Refresh prefs because AgingBeginDateTime is very time sensitive Prefs.RefreshCache(); DateTime dateTAgingBeganPref = PrefC.GetDateT(PrefName.AgingBeginDateTime); if (dateTAgingBeganPref > DateTime.MinValue) { MessageBox.Show(this, Lan.g(this, "You cannot run aging until it has finished the current calculations which began on") + " " + dateTAgingBeganPref.ToString() + ".\r\n" + Lans.g(this, "If you believe the current aging process has finished, a user with SecurityAdmin permission " + "can manually clear the date and time by going to Setup | Miscellaneous and pressing the 'Clear' button.")); return(false); } Prefs.UpdateString(PrefName.AgingBeginDateTime, POut.DateT(MiscData.GetNowDateTime(), false)); //get lock on pref to block others Signalods.SetInvalid(InvalidType.Prefs); //signal a cache refresh so other computers will have the updated pref as quickly as possible Action actionCloseAgingProgress = null; try { actionCloseAgingProgress = ODProgressOld.ShowProgressStatus("ComputeAging", this, Lan.g(this, "Calculating enterprise aging for all patients as of") + " " + dateCalc.ToShortDateString() + "..."); Cursor = Cursors.WaitCursor; Ledgers.ComputeAging(0, dateCalc); Prefs.UpdateString(PrefName.DateLastAging, POut.Date(dateCalc, false)); } catch (MySqlException ex) { actionCloseAgingProgress?.Invoke(); Cursor = Cursors.Default; if (ex == null || ex.Number != 1213) //not a deadlock error, just throw { throw; } MsgBox.Show(this, "Deadlock error detected in aging transaction and rolled back. Try again later."); return(false); } finally { actionCloseAgingProgress?.Invoke(); Cursor = Cursors.Default; Prefs.UpdateString(PrefName.AgingBeginDateTime, ""); //clear lock on pref whether aging was successful or not Signalods.SetInvalid(InvalidType.Prefs); } return(true); }
private void FormMobileSetup_Load(object sender, EventArgs e) { textMobileSyncServerURL.Text = PrefC.GetString(PrefName.MobileSyncServerURL); textSynchMinutes.Text = PrefC.GetInt(PrefName.MobileSyncIntervalMinutes).ToString(); textDateBefore.Text = PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).ToShortDateString(); textMobileSynchWorkStation.Text = PrefC.GetString(PrefName.MobileSyncWorkstationName); textMobileUserName.Text = PrefC.GetString(PrefName.MobileUserName); textMobilePassword.Text = ""; //not stored locally, and not pulled from web server DateTime lastRun = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun); if (lastRun.Year > 1880) { textDateTimeLastRun.Text = lastRun.ToShortDateString() + " " + lastRun.ToShortTimeString(); } //Web server is not contacted when loading this form. That would be too slow. //CreateAppointments(5); }
private bool RunAgingEnterprise(DateTime dateCalc) { DateTime dateLastAging = PrefC.GetDate(PrefName.DateLastAging); if (dateLastAging.Date == dateCalc.Date) { if (MessageBox.Show(this, Lan.g(this, "Aging has already been calculated for") + " " + dateCalc.ToShortDateString() + " " + Lan.g(this, "and does not normally need to run more than once per day.\r\n\r\nRun anyway?"), "", MessageBoxButtons.YesNo) != DialogResult.Yes) { return(false); } } //Refresh prefs because AgingBeginDateTime is very time sensitive Prefs.RefreshCache(); DateTime dateTAgingBeganPref = PrefC.GetDateT(PrefName.AgingBeginDateTime); if (dateTAgingBeganPref > DateTime.MinValue) { MessageBox.Show(this, Lan.g(this, "You cannot run aging until it has finished the current calculations which began on") + " " + dateTAgingBeganPref.ToString() + ".\r\n" + Lans.g(this, "If you believe the current aging process has finished, a user with SecurityAdmin permission " + "can manually clear the date and time by going to Setup | Miscellaneous and pressing the 'Clear' button.")); return(false); } SecurityLogs.MakeLogEntry(Permissions.AgingRan, 0, "Aging Ran - Aging Form"); Prefs.UpdateString(PrefName.AgingBeginDateTime, POut.DateT(MiscData.GetNowDateTime(), false)); //get lock on pref to block others Signalods.SetInvalid(InvalidType.Prefs); //signal a cache refresh so other computers will have the updated pref as quickly as possible Cursor = Cursors.WaitCursor; bool result = true; ODProgress.ShowAction( () => { Ledgers.ComputeAging(0, dateCalc); Prefs.UpdateString(PrefName.DateLastAging, POut.Date(dateCalc, false)); }, startingMessage: Lan.g(this, "Calculating enterprise aging for all patients as of") + " " + dateCalc.ToShortDateString() + "...", actionException: ex => { Ledgers.AgingExceptionHandler(ex, this); result = false; } ); Cursor = Cursors.Default; Prefs.UpdateString(PrefName.AgingBeginDateTime, ""); //clear lock on pref whether aging was successful or not Signalods.SetInvalid(InvalidType.Prefs); return(result); }
private void SetButtonVisibility() { DateTime updateTime = PrefC.GetDateT(PrefName.UpdateDateTime); bool showMsi = PrefC.GetBool(PrefName.UpdateShowMsiButtons); bool showDownloadAndInstall = (updateTime < DateTime.Now); butDownloadMsiBuild.Visible = showMsi; butDownloadMsiStable.Visible = showMsi; butDownloadMsiBeta.Visible = showMsi; butDownloadMsiAlpha.Visible = showMsi; butDownloadMsiBuild.Enabled = showDownloadAndInstall; butDownloadMsiStable.Enabled = showDownloadAndInstall; butDownloadMsiBeta.Enabled = showDownloadAndInstall; butDownloadMsiAlpha.Enabled = showDownloadAndInstall; butInstallBuild.Enabled = showDownloadAndInstall; butInstallStable.Enabled = showDownloadAndInstall; butInstallBeta.Enabled = showDownloadAndInstall; butInstallAlpha.Enabled = showDownloadAndInstall; }
private void butSync_Click(object sender, EventArgs e) { if (!SavePrefs()) { return; } if (IsSynching) { MsgBox.Show(this, "A Synch is in progress at the moment. Please try again later."); return; } if (PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).Year < 1880) { MsgBox.Show(this, "Full synch has never been run before."); return; } DateTime changedSince = PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun); ShowProgressForm(changedSince); }
///<summary>This is the function that the worker thread uses to actually perform the upload. Can also call this method in the ordinary way if the data to be transferred is small. The timeSynchStarted must be passed in to ensure that no records are skipped due to small time differences.</summary> private static void UploadWorker(DateTime changedSince, DateTime timeSynchStarted) { int totalCount = 100; try { //Dennis: try catch may not work: Does not work in threads, not sure about this. Note that all methods inside this try catch block are without exception handling. This is done on purpose so that when an exception does occur it does not update PrefName.MobileSyncDateTimeLastRun //The handling of PrefName.MobileSynchNewTables79 should never be removed in future versions DateTime changedProv = changedSince; DateTime changedDeleted = changedSince; DateTime changedPat = changedSince; DateTime changedStatement = changedSince; DateTime changedDocument = changedSince; DateTime changedRecall = changedSince; if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables79Done, false)) { changedProv = DateTime.MinValue; changedDeleted = DateTime.MinValue; } if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables112Done, false)) { changedPat = DateTime.MinValue; changedStatement = DateTime.MinValue; changedDocument = DateTime.MinValue; } if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables121Done, false)) { changedRecall = DateTime.MinValue; UploadPreference(PrefName.PracticeTitle); //done again because the previous upload did not include the prefnum } bool synchDelPat = true; if (PrefC.GetDateT(PrefName.MobileSyncDateTimeLastRun).Hour == timeSynchStarted.Hour) { synchDelPat = false; // synching delPatNumList is timeconsuming (15 seconds) for a dental office with around 5000 patients and it's mostly the same records that have to be deleted every time a synch happens. So it's done only once hourly. } //MobileWeb List <long> patNumList = Patientms.GetChangedSincePatNums(changedPat); List <long> aptNumList = Appointmentms.GetChangedSinceAptNums(changedSince, PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate)); List <long> rxNumList = RxPatms.GetChangedSinceRxNums(changedSince); List <long> provNumList = Providerms.GetChangedSinceProvNums(changedProv); List <long> pharNumList = Pharmacyms.GetChangedSincePharmacyNums(changedSince); List <long> allergyDefNumList = AllergyDefms.GetChangedSinceAllergyDefNums(changedSince); List <long> allergyNumList = Allergyms.GetChangedSinceAllergyNums(changedSince); //exclusively Patient Portal List <long> eligibleForUploadPatNumList = Patientms.GetPatNumsEligibleForSynch(); List <long> labPanelNumList = LabPanelms.GetChangedSinceLabPanelNums(changedSince, eligibleForUploadPatNumList); List <long> labResultNumList = LabResultms.GetChangedSinceLabResultNums(changedSince); List <long> medicationNumList = Medicationms.GetChangedSinceMedicationNums(changedSince); List <long> medicationPatNumList = MedicationPatms.GetChangedSinceMedicationPatNums(changedSince, eligibleForUploadPatNumList); List <long> diseaseDefNumList = DiseaseDefms.GetChangedSinceDiseaseDefNums(changedSince); List <long> diseaseNumList = Diseasems.GetChangedSinceDiseaseNums(changedSince, eligibleForUploadPatNumList); List <long> icd9NumList = ICD9ms.GetChangedSinceICD9Nums(changedSince); List <long> statementNumList = Statementms.GetChangedSinceStatementNums(changedStatement, eligibleForUploadPatNumList, statementLimitPerPatient); List <long> documentNumList = Documentms.GetChangedSinceDocumentNums(changedDocument, statementNumList); List <long> recallNumList = Recallms.GetChangedSinceRecallNums(changedRecall); List <long> delPatNumList = Patientms.GetPatNumsForDeletion(); //List<DeletedObject> dO=DeletedObjects.GetDeletedSince(changedDeleted);dennis: delete this line later List <long> deletedObjectNumList = DeletedObjects.GetChangedSinceDeletedObjectNums(changedDeleted); totalCount = patNumList.Count + aptNumList.Count + rxNumList.Count + provNumList.Count + pharNumList.Count + labPanelNumList.Count + labResultNumList.Count + medicationNumList.Count + medicationPatNumList.Count + allergyDefNumList.Count + allergyNumList.Count + diseaseDefNumList.Count + diseaseNumList.Count + icd9NumList.Count + statementNumList.Count + documentNumList.Count + recallNumList.Count + deletedObjectNumList.Count; if (synchDelPat) { totalCount += delPatNumList.Count; } double currentVal = 0; if (Application.OpenForms["FormProgress"] != null) // without this line the following error is thrown: "Invoke or BeginInvoke cannot be called on a control until the window handle has been created." or a null pointer exception is thrown when an automatic synch is done by the system. { FormP.Invoke(new PassProgressDelegate(PassProgressToDialog), new object[] { currentVal, "?currentVal of ?maxVal records uploaded", totalCount, "" }); } IsSynching = true; SynchGeneric(patNumList, SynchEntity.patient, totalCount, ref currentVal); SynchGeneric(aptNumList, SynchEntity.appointment, totalCount, ref currentVal); SynchGeneric(rxNumList, SynchEntity.prescription, totalCount, ref currentVal); SynchGeneric(provNumList, SynchEntity.provider, totalCount, ref currentVal); SynchGeneric(pharNumList, SynchEntity.pharmacy, totalCount, ref currentVal); //pat portal SynchGeneric(labPanelNumList, SynchEntity.labpanel, totalCount, ref currentVal); SynchGeneric(labResultNumList, SynchEntity.labresult, totalCount, ref currentVal); SynchGeneric(medicationNumList, SynchEntity.medication, totalCount, ref currentVal); SynchGeneric(medicationPatNumList, SynchEntity.medicationpat, totalCount, ref currentVal); SynchGeneric(allergyDefNumList, SynchEntity.allergydef, totalCount, ref currentVal); SynchGeneric(allergyNumList, SynchEntity.allergy, totalCount, ref currentVal); SynchGeneric(diseaseDefNumList, SynchEntity.diseasedef, totalCount, ref currentVal); SynchGeneric(diseaseNumList, SynchEntity.disease, totalCount, ref currentVal); SynchGeneric(icd9NumList, SynchEntity.icd9, totalCount, ref currentVal); SynchGeneric(statementNumList, SynchEntity.statement, totalCount, ref currentVal); SynchGeneric(documentNumList, SynchEntity.document, totalCount, ref currentVal); SynchGeneric(recallNumList, SynchEntity.recall, totalCount, ref currentVal); if (synchDelPat) { SynchGeneric(delPatNumList, SynchEntity.patientdel, totalCount, ref currentVal); } //DeleteObjects(dO,totalCount,ref currentVal);// this has to be done at this end because objects may have been created and deleted between synchs. If this function is place above then the such a deleted object will not be deleted from the server. SynchGeneric(deletedObjectNumList, SynchEntity.deletedobject, totalCount, ref currentVal); // this has to be done at this end because objects may have been created and deleted between synchs. If this function is place above then the such a deleted object will not be deleted from the server. if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables79Done, true)) { Prefs.UpdateBool(PrefName.MobileSynchNewTables79Done, true); } if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables112Done, true)) { Prefs.UpdateBool(PrefName.MobileSynchNewTables112Done, true); } if (!PrefC.GetBoolSilent(PrefName.MobileSynchNewTables121Done, true)) { Prefs.UpdateBool(PrefName.MobileSynchNewTables121Done, true); } Prefs.UpdateDateT(PrefName.MobileSyncDateTimeLastRun, timeSynchStarted); IsSynching = false; } catch (Exception e) { IsSynching = false; // this will ensure that the synch can start again. If this variable remains true due to an exception then a synch will never take place automatically. if (Application.OpenForms["FormProgress"] != null) // without this line the following error is thrown: "Invoke or BeginInvoke cannot be called on a control until the window handle has been created." or a null pointer exception is thrown when an automatic synch is done by the system. { FormP.Invoke(new PassProgressDelegate(PassProgressToDialog), new object[] { 0, "?currentVal of ?maxVal records uploaded", totalCount, e.Message }); } } }
private void FormTransworldSetup_Load(object sender, EventArgs e) { _progCur = Programs.GetCur(ProgramName.Transworld); if (_progCur == null) { MsgBox.Show(this, "The Transworld entry is missing from the database. Please contact support."); //should never happen return; } checkEnabled.Checked = _progCur.Enabled; if (!PrefC.HasClinicsEnabled) //clinics are not enabled, use ClinicNum 0 to indicate 'Headquarters' or practice level program properties { checkEnabled.Text = Lan.g(this, "Enabled"); groupClinicSettings.Text = Lan.g(this, "Transworld Settings"); comboClinic.Visible = false; labelClinic.Visible = false; labelClinicEnable.Visible = false; _listUserClinicNums = new List <long>() { 0 }; //if clinics are disabled, programproperty.ClinicNum will be set to 0 groupSendActivity.Text = Lan.g(this, "Account Activity Updates"); //remove '(affects all clinics)' from text _selectedClinicNum = 0; } else //Using clinics { groupClinicSettings.Text = Lan.g(this, "Transworld Clinic Settings"); _listUserClinicNums = new List <long>(); //if Transworld is enabled and the user is restricted to a clinic, don't allow the user to disable for all clinics if (Security.CurUser.ClinicIsRestricted) { if (checkEnabled.Checked) { checkEnabled.Enabled = false; } } else { comboClinic.Items.Add(Lan.g(this, "Headquarters")); //this way both lists have the same number of items in it and if 'Headquarters' is selected the programproperty.ClinicNum will be set to 0 _listUserClinicNums.Add(0); comboClinic.SelectedIndex = 0; } List <Clinic> listClinics = Clinics.GetForUserod(Security.CurUser); foreach (Clinic clinicCur in listClinics) { comboClinic.Items.Add(clinicCur.Abbr); _listUserClinicNums.Add(clinicCur.ClinicNum); if (Clinics.ClinicNum == clinicCur.ClinicNum) //set selected index to the currently selected clinic in FormOpenDental { _selectedClinicNum = clinicCur.ClinicNum; comboClinic.SelectedIndex = comboClinic.Items.Count - 1; } } } _dictClinicListProgProps = ProgramProperties.GetForProgram(_progCur.ProgramNum) //get list of all props for the program .GroupBy(x => x.ClinicNum) //group each clinic .ToDictionary(x => x.Key, x => x.ToList()); //turn list into a dictionary of key=ClinicNum, value=List<ProgramProperty> for the clinic DateTime dateTSend = PrefC.GetDateT(PrefName.TransworldServiceTimeDue); if (dateTSend != DateTime.MinValue) { textUpdatesTimeOfDay.Text = dateTSend.ToShortTimeString(); } comboSendFrequencyUnits.Items.AddRange(Enum.GetNames(typeof(FrequencyUnit))); string[] sendFreqStrs = PrefC.GetString(PrefName.TransworldServiceSendFrequency).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (sendFreqStrs.Length == 2) { int sendFreq = PIn.Int(sendFreqStrs[0], false); FrequencyUnit sendFreqUnit; if (sendFreq > 0 && Enum.TryParse(sendFreqStrs[1], out sendFreqUnit)) { numericSendFrequency.Value = sendFreq; comboSendFrequencyUnits.SelectedIndex = (int)sendFreqUnit; } } else //if not set, default to repeat once a day { comboSendFrequencyUnits.SelectedIndex = (int)FrequencyUnit.Days; numericSendFrequency.Value = 1; } FillComboBoxes(); FillFields(); }
/// <summary>Sets UI for preferences that we know for sure will exist.</summary> private void FillStandardPrefs() { #region Account Tab checkAgingMonthly.Checked = PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily); foreach (PayClinicSetting prompt in Enum.GetValues(typeof(PayClinicSetting))) { comboPaymentClinicSetting.Items.Add(Lan.g(this, prompt.GetDescription())); } comboPaymentClinicSetting.SelectedIndex = PrefC.GetInt(PrefName.PaymentClinicSetting); checkPaymentsPromptForPayType.Checked = PrefC.GetBool(PrefName.PaymentsPromptForPayType); for (int i = 0; i < Enum.GetNames(typeof(AutoSplitPreference)).Length; i++) { comboAutoSplitPref.Items.Add(Lans.g(this, Enum.GetNames(typeof(AutoSplitPreference))[i])); } comboAutoSplitPref.SelectedIndex = PrefC.GetInt(PrefName.AutoSplitLogic); checkBillShowTransSinceZero.Checked = PrefC.GetBool(PrefName.BillingShowTransSinceBalZero); textClaimIdentifier.Text = PrefC.GetString(PrefName.ClaimIdPrefix); checkReceiveReportsService.Checked = PrefC.GetBool(PrefName.ClaimReportReceivedByService); _claimReportReceiveInterval = PrefC.GetInt(PrefName.ClaimReportReceiveInterval); if (_claimReportReceiveInterval == 0) { radioTime.Checked = true; DateTime fullDateTime = PrefC.GetDateT(PrefName.ClaimReportReceiveTime); textReportCheckTime.Text = fullDateTime.ToShortTimeString(); } else { textReportCheckInterval.Text = POut.Int(_claimReportReceiveInterval); radioInterval.Checked = true; } List <RigorousAccounting> listEnums = Enum.GetValues(typeof(RigorousAccounting)).OfType <RigorousAccounting>().ToList(); for (int i = 0; i < listEnums.Count; i++) { comboRigorousAccounting.Items.Add(listEnums[i].GetDescription()); } comboRigorousAccounting.SelectedIndex = PrefC.GetInt(PrefName.RigorousAccounting); List <RigorousAdjustments> listAdjEnums = Enum.GetValues(typeof(RigorousAdjustments)).OfType <RigorousAdjustments>().ToList(); for (int i = 0; i < listAdjEnums.Count; i++) { comboRigorousAdjustments.Items.Add(listAdjEnums[i].GetDescription()); } comboRigorousAdjustments.SelectedIndex = PrefC.GetInt(PrefName.RigorousAdjustments); checkHidePaysplits.Checked = PrefC.GetBool(PrefName.PaymentWindowDefaultHideSplits); foreach (PayPlanVersions version in Enum.GetValues(typeof(PayPlanVersions))) { comboPayPlansVersion.Items.Add(Lan.g("enumPayPlanVersions", version.GetDescription())); } comboPayPlansVersion.SelectedIndex = PrefC.GetInt(PrefName.PayPlansVersion) - 1; textBillingElectBatchMax.Text = PrefC.GetInt(PrefName.BillingElectBatchMax).ToString(); checkBillingShowProgress.Checked = PrefC.GetBool(PrefName.BillingShowSendProgress); #endregion Account Tab #region Advanced Tab checkPasswordsMustBeStrong.Checked = PrefC.GetBool(PrefName.PasswordsMustBeStrong); checkPasswordsStrongIncludeSpecial.Checked = PrefC.GetBool(PrefName.PasswordsStrongIncludeSpecial); checkPasswordForceWeakToStrong.Checked = PrefC.GetBool(PrefName.PasswordsWeakChangeToStrong); checkLockIncludesAdmin.Checked = PrefC.GetBool(PrefName.SecurityLockIncludesAdmin); textLogOffAfterMinutes.Text = PrefC.GetInt(PrefName.SecurityLogOffAfterMinutes).ToString(); checkUserNameManualEntry.Checked = PrefC.GetBool(PrefName.UserNameManualEntry); textDateLock.Text = PrefC.GetDate(PrefName.SecurityLockDate).ToShortDateString(); textDaysLock.Text = PrefC.GetInt(PrefName.SecurityLockDays).ToString(); long signalInactive = PrefC.GetLong(PrefName.SignalInactiveMinutes); textInactiveSignal.Text = (signalInactive == 0 ? "" : signalInactive.ToString()); long sigInterval = PrefC.GetLong(PrefName.ProcessSigsIntervalInSecs); textSigInterval.Text = (sigInterval == 0 ? "" : sigInterval.ToString()); string patSearchMinChars = PrefC.GetString(PrefName.PatientSelectSearchMinChars); textPatSelectMinChars.Text = Math.Min(10, Math.Max(1, PIn.Int(patSearchMinChars, false))).ToString(); //enforce minimum 1 maximum 10 string patSearchPauseMs = PrefC.GetString(PrefName.PatientSelectSearchPauseMs); textPatSelectPauseMs.Text = Math.Min(10000, Math.Max(1, PIn.Int(patSearchPauseMs, false))).ToString(); //enforce minimum 1 maximum 10000 checkPatientSelectFilterRestrictedClinics.Checked = PrefC.GetBool(PrefName.PatientSelectFilterRestrictedClinics); YN searchEmptyParams = PIn.Enum <YN>(PrefC.GetInt(PrefName.PatientSelectSearchWithEmptyParams)); if (searchEmptyParams != YN.Unknown) { checkPatSearchEmptyParams.CheckState = CheckState.Unchecked; checkPatSearchEmptyParams.Checked = searchEmptyParams == YN.Yes; } _usePhonenumTable = PrefC.GetEnum <YN>(PrefName.PatientPhoneUsePhonenumberTable); if (_usePhonenumTable != YN.Unknown) { checkUsePhoneNumTable.CheckState = CheckState.Unchecked; checkUsePhoneNumTable.Checked = _usePhonenumTable == YN.Yes; } #endregion Advanced Tab #region Appts Tab checkApptsRequireProcs.Checked = PrefC.GetBool(PrefName.ApptsRequireProc); checkUseOpHygProv.Checked = PrefC.GetBool(PrefName.ApptSecondaryProviderConsiderOpOnly); checkEnterpriseApptList.Checked = PrefC.GetBool(PrefName.EnterpriseApptList); checkEnableNoneView.Checked = PrefC.GetBool(PrefName.EnterpriseNoneApptViewDefaultDisabled); #endregion Appts Tab #region Family Tab checkSuperFam.Checked = PrefC.GetBool(PrefName.ShowFeatureSuperfamilies); checkPatClone.Checked = PrefC.GetBool(PrefName.ShowFeaturePatientClone); checkShowFeeSchedGroups.Checked = PrefC.GetBool(PrefName.ShowFeeSchedGroups); checkSuperFamCloneCreate.Checked = PrefC.GetBool(PrefName.CloneCreateSuperFamily); //users should only see the snapshot trigger and service runtime if they have it set to something other than ClaimCreate. //if a user wants to be able to change claimsnapshot settings, the following MySQL statement should be run: //UPDATE preference SET ValueString = 'Service' WHERE PrefName = 'ClaimSnapshotTriggerType' if (PIn.Enum <ClaimSnapshotTrigger>(PrefC.GetString(PrefName.ClaimSnapshotTriggerType), true) == ClaimSnapshotTrigger.ClaimCreate) { groupClaimSnapshot.Visible = false; } foreach (ClaimSnapshotTrigger trigger in Enum.GetValues(typeof(ClaimSnapshotTrigger))) { comboClaimSnapshotTrigger.Items.Add(trigger.GetDescription()); } comboClaimSnapshotTrigger.SelectedIndex = (int)PIn.Enum <ClaimSnapshotTrigger>(PrefC.GetString(PrefName.ClaimSnapshotTriggerType), true); textClaimSnapshotRunTime.Text = PrefC.GetDateT(PrefName.ClaimSnapshotRunTime).ToShortTimeString(); #endregion Family Tab #region Reports Tab checkUseReportServer.Checked = (PrefC.GetString(PrefName.ReportingServerCompName) != "" || PrefC.GetString(PrefName.ReportingServerURI) != ""); textServerName.Text = PrefC.GetString(PrefName.ReportingServerCompName); comboDatabase.Text = PrefC.GetString(PrefName.ReportingServerDbName); textMysqlUser.Text = PrefC.GetString(PrefName.ReportingServerMySqlUser); string decryptedPass; CDT.Class1.Decrypt(PrefC.GetString(PrefName.ReportingServerMySqlPassHash), out decryptedPass); textMysqlPass.Text = decryptedPass; textMiddleTierURI.Text = PrefC.GetString(PrefName.ReportingServerURI); FillComboDatabases(); SetReportServerUIEnabled(); #endregion Reports Tab }
/// <summary>May be called from other parts of the program without showing this form. You must still create an instance of this form though. /// Checks CallFire bridge, if it is OK to send a text, etc. (Buttons to load this form are usually disabled if it is not OK, /// but this is needed for Confirmations, Recalls, etc.). CanIncreaseLimit will prompt the user to increase the spending limit if sending the /// text would exceed that limit. Should only be true when this method is called from this form. </summary> public bool SendText(long patNum, string wirelessPhone, string message, YN txtMsgOk, long clinicNum, SmsMessageSource smsMessageSource, bool canIncreaseLimit = false) { if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start", patNum, wirelessPhone, message, txtMsgOk)) { return(false); } if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start2", patNum, wirelessPhone, message, txtMsgOk)) { return(true); } if (wirelessPhone == "") { MsgBox.Show(this, "Please enter a phone number."); return(false); } if (SmsPhones.IsIntegratedTextingEnabled()) { if (!PrefC.HasClinicsEnabled && PrefC.GetDateT(PrefName.SmsContractDate).Year < 1880) //Checking for practice (clinics turned off). { MsgBox.Show(this, "Integrated Texting has not been enabled."); return(false); } else if (PrefC.HasClinicsEnabled && !Clinics.IsTextingEnabled(clinicNum)) //Checking for specific clinic. //This is likely to happen a few times per office until they setup texting properly. { if (clinicNum != 0) { MessageBox.Show(Lans.g(this, "Integrated Texting has not been enabled for the following clinic") + ":\r\n" + Clinics.GetClinic(clinicNum).Description + "."); } else { //Should never happen. This message is precautionary. MsgBox.Show(this, "The default texting clinic has not been set."); } return(false); } } else if (!Programs.IsEnabled(ProgramName.CallFire)) { MsgBox.Show(this, "CallFire Program Link must be enabled."); return(false); } if (patNum != 0 && txtMsgOk == YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo)) { MsgBox.Show(this, "It is not OK to text this patient."); return(false); } if (patNum != 0 && txtMsgOk == YN.No) { MsgBox.Show(this, "It is not OK to text this patient."); return(false); } if (SmsPhones.IsIntegratedTextingEnabled()) { try { SmsToMobiles.SendSmsSingle(patNum, wirelessPhone, message, clinicNum, smsMessageSource, user: Security.CurUser); //Can pass in 0 as PatNum if no patient selected. return(true); } catch (Exception ex) { //ProcessSendSmsException handles the spending limit has been reached error, or returns false if the exception is different. if (!canIncreaseLimit || !FormEServicesSetup.ProcessSendSmsException(ex)) { MsgBox.Show(this, ex.Message); } return(false); } } else { if (message.Length > 160) //only a limitation for CallFire { MsgBox.Show(this, "Text length must be less than 160 characters."); return(false); } return(SendCallFire(patNum, wirelessPhone, message)); //Can pass in 0 as PatNum if no patient selected. } }