private void grid_CellDoubleClick(object sender, ODGridClickEventArgs e) { int currentSelection = e.Row; //tbApts.SelectedRow; int currentScroll = grid.ScrollValue; //tbApts.ScrollValue; Patient pat = Patients.GetPat(_listUnschedApt[e.Row].PatNum); //If multiple selected, just take the one that was clicked on. FormOpenDental.S_Contr_PatientSelected(pat, true); FormApptEdit FormAE = new FormApptEdit(_listUnschedApt[e.Row].AptNum); FormAE.PinIsVisible = true; FormAE.ShowDialog(); if (FormAE.DialogResult != DialogResult.OK) { return; } if (FormAE.PinClicked) { SendPinboard_Click(); //Whatever they double clicked on will still be selected, just fire the event. DialogResult = DialogResult.OK; //this is an obsolete line. Window stays open. } else { FillGrid(); grid.SetSelected(currentSelection, true); grid.ScrollValue = currentScroll; } }
private void butAddViewJob_Click(object sender, EventArgs e) { if (_patCur == null) { return; } if (_listLinks.Count > 0) //View Job { if (_listLinks.Count == 1) { JobLink link = _listLinks.First(); FormOpenDental.S_GoToJob(link.JobNum); } else { MsgBox.Show(this, "Submission is associated to multiple jobs"); } return; } _bug = BugSubmissionL.AddBugAndJob(this, new List <BugSubmission>() { _subCur }, _patCur); if (_bug == null) { return; } if (this.Modal) { DialogResult = DialogResult.OK; } }
private void butAdd_Click(object sender, EventArgs e) { if (_viewMode == FormBugSubmissionMode.SelectionMode) //Text is set to "Ok" when SelectionMode { ListSelectedSubs = gridSubs.SelectedIndices.SelectMany(x => (List <BugSubmission>)gridSubs.ListGridRows[x].Tag).ToList(); DialogResult = DialogResult.OK; return; } if (_viewMode == FormBugSubmissionMode.ValidationMode) //Text is set to "Ok" when SelectionMode { ListSelectedSubs = _listAllSubs; DialogResult = DialogResult.OK; return; } if (butAddJob.Text == "View Job" && butAddJob.Tag is JobLink) //Assocaited to job, see gridSubs_CellClick(...) { FormOpenDental.S_GoToJob((butAddJob.Tag as JobLink).JobNum); return; } List <BugSubmission> listSelectedSubs = gridSubs.SelectedIndices.SelectMany(x => (List <BugSubmission>)gridSubs.ListGridRows[x].Tag).ToList(); BugCur = BugSubmissionL.AddBugAndJob(this, listSelectedSubs, _patCur); if (BugCur == null) { return; } if (this.Modal) { this.DialogResult = DialogResult.OK; } else { FillSubGrid(true); } }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { int currentSelection = gridMain.GetSelectedIndex(); int currentScroll = gridMain.ScrollValue; Patient pat = Patients.GetPat(_listPlannedAppts[e.Row].PatNum); //Only one can be selected at a time in this grid. FormOpenDental.S_Contr_PatientSelected(pat, true); FormApptEdit FormAE = new FormApptEdit(_listPlannedAppts[e.Row].AptNum); FormAE.PinIsVisible = true; FormAE.ShowDialog(); if (FormAE.DialogResult != DialogResult.OK) { return; } if (FormAE.PinClicked) { SendPinboard_Click(); DialogResult = DialogResult.OK; } else { RefreshAptList(); FillGrid(); gridMain.SetSelected(currentSelection, true); gridMain.ScrollValue = currentScroll; } }
///<summary>Returns true if the commlog was able to save to the database. Otherwise returns false. ///Set showMsg to true to show a meaningful message when the commlog cannot be saved.</summary> public bool SaveCommItem(bool showMsg) { Commlog commlog; if (!_view.TryGetCommItem(showMsg, out commlog)) { return(false); } if (IsNew || IsPersistent) { _view.SetCommlogNum(Commlogs.Insert(commlog)); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, "Insert"); //Post insert persistent user preferences. if (IsPersistent) { if (_userOdPrefClearNote == null || PIn.Bool(_userOdPrefClearNote.ValueString)) { _view.ClearNote(); } if (_userOdPrefEndDate == null || PIn.Bool(_userOdPrefEndDate.ValueString)) { _view.ClearDateTimeEnd(); } ODException.SwallowAnyException(() => { FormOpenDental.S_RefreshCurrentModule(); }); } } else { Commlogs.Update(commlog); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, ""); } return(true); }
private void SelectPatient_Click() { //If multiple selected, just take the last one to remain consistent with SendPinboard_Click. long patNum = _listUnschedApt[grid.SelectedIndices[grid.SelectedIndices.Length - 1]].PatNum; Patient pat = Patients.GetPat(patNum); FormOpenDental.S_Contr_PatientSelected(pat, true); }
private void SelectPatient_Click() { if(gridConflicts.SelectedIndices.Length==0) { MsgBox.Show(this,"Please select an appointment first."); return; } //If multiple selected, just take the last one to remain consistent with SendPinboard_Click. Patient pat=_listPatients.First(x => x.PatNum==_listAppts[gridConflicts.SelectedIndices[gridConflicts.SelectedIndices.Length-1]].PatNum); FormOpenDental.S_Contr_PatientSelected(pat,true); }
private void FormVoiceMails_FormClosing(object sender, FormClosingEventArgs e) { //Change the ClockStatus to Available if the logged on user is clocked in and the same user as the extension. if (FormOpenDental.PhoneTile.PhoneCur != null && ClockEvents.IsClockedIn(Security.CurUser.EmployeeNum) && Security.CurUser.EmployeeNum == FormOpenDental.PhoneTile.PhoneCur.EmployeeNum) { FormOpenDental.S_SetPhoneStatusAvailable(); } }
private void gridMain_CellClick(object sender, ODGridClickEventArgs e) { if (gridMain.SelectedIndices.Length != 1) { return; } long goToPatNum = PIn.Long(gridMain.Rows[e.Row].Tag.ToString()); Patient pat = Patients.GetPat(goToPatNum); FormOpenDental.S_Contr_PatientSelected(pat, false); }
///<summary>If multiple patients are selected in UnchedList, will select the last patient to remain consistent with sending to pinboard behavior.</summary> private void SeeChart_Click() { if (grid.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select an appointment first."); return; } Patient pat = Patients.GetPat(_listUnschedApt[grid.SelectedIndices[grid.SelectedIndices.Length - 1]].PatNum); //If multiple selected, just take the last one to remain consistent with SendPinboard_Click. FormOpenDental.S_Contr_PatientSelected(pat, false); GotoModule.GotoChart(pat.PatNum); }
private void menuItemGoTo_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select one payment first."); return; } long patNum = ((Payment)gridMain.Rows[gridMain.SelectedIndices[0]].Tag).PatNum; FormOpenDental.S_Contr_PatientSelected(Patients.GetPat(patNum), false); GotoModule.GotoAccount(0); }
private void SeeChart_Click() { if (gridMain.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select an appointment first."); return; } //Only one can be selected at a time in this grid, but just in case we change it in the future it will select the last one in the list to be consistent with other patient selections. Patient pat = Patients.GetPat(_listPlannedAppts[gridMain.SelectedIndices[gridMain.SelectedIndices.Length - 1]].PatNum); FormOpenDental.S_Contr_PatientSelected(pat, false); GotoModule.GotoChart(pat.PatNum); }
public static void SetInvalidTask(long taskNum, bool isPopup) { List <InvalidType> listITypes = new List <InvalidType>(); if (isPopup) { listITypes.Add(InvalidType.TaskPopup); //we also need to tell the database about all the users with unread tasks TaskUnreads.AddUnreads(taskNum, Security.CurUser.UserNum); } else { listITypes.Add(InvalidType.Task); } FormOpenDental.S_DataValid_BecomeInvalid(new ValidEventArgs(DateTime.MinValue, listITypes.ToArray(), PrefC.GetBool(PrefName.DoLimitTaskSignals), taskNum)); }
private void FormMapHQ_Load(object sender, EventArgs e) { _siteCur = SiteLinks.GetSiteByIP(); if (_siteCur == null) { MessageBox.Show("Error. No sites found in the cache."); DialogResult = DialogResult.Abort; Close(); return; } FormOpenDental.AddMapToList(this); FillMaps(); FillTabs(); FillCombo(); FillMapAreaPanel(); FillTriageLabelColors(); }
private void goToChartToolStripMenuItem_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length != 1) { MsgBox.Show(this, "Please select a patient first."); return; } if (!Security.IsAuthorized(Permissions.ChartModule)) { return; } long patNum = PIn.Long(gridMain.Rows[gridMain.SelectedIndices[0]].Tag.ToString()); Patient pat = Patients.GetPat(patNum); FormOpenDental.S_Contr_PatientSelected(pat, false); SendToBack(); GotoModule.GotoChart(pat.PatNum); }
private void gridConflicts_DoubleClick(object sender,ODGridClickEventArgs e) { int currentSelection=e.Row; int currentScroll=gridConflicts.ScrollValue; Appointment apptCur=(Appointment)gridConflicts.ListGridRows[e.Row].Tag; long SelectedPatNum=apptCur.PatNum; Patient pat=_listPatients.First(x => x.PatNum==SelectedPatNum); FormOpenDental.S_Contr_PatientSelected(pat,true); FormApptEdit FormAE=new FormApptEdit(apptCur.AptNum); FormAE.PinIsVisible=true; FormAE.ShowDialog(); if(FormAE.DialogResult!=DialogResult.OK) { return; } if(FormAE.PinClicked) { SendPinboard_Click(); //Whatever they double clicked on will still be selected, just fire the event to send it to the pinboard. } gridConflicts.SetSelected(currentSelection,true); gridConflicts.ScrollValue=currentScroll; }
static void Main(string[] args) { //Register an EventHandler which handles unhandled exceptions. //AppDomain.CurrentDomain.UnhandledException+=new UnhandledExceptionEventHandler(OnUnhandeledExceptionPolicy); bool isSecondInstance = false; //or more. Process[] processes = Process.GetProcesses(); for (int i = 0; i < processes.Length; i++) { if (processes[i].Id == Process.GetCurrentProcess().Id) { continue; } //we have to do it this way because during debugging, the name has vshost tacked onto the end. if (processes[i].ProcessName.StartsWith("OpenDental")) { isSecondInstance = true; break; } } /* * if(args.Length>0) {//if any command line args, then we will attempt to reuse an existing OD window. * if(isSecondInstance){ * FormCommandLinePassOff formCommandLine=new FormCommandLinePassOff(); * formCommandLine.CommandLineArgs=new string[args.Length]; * args.CopyTo(formCommandLine.CommandLineArgs,0); * Application.Run(formCommandLine); * return; * } * }*/ Application.SetCompatibleTextRenderingDefault(false); //designer uses new text rendering. This makes the exe use matching text rendering. Before this was added, it was common for labels to be longer in the running program than they were in the designer. Application.EnableVisualStyles(); //changes appearance to XP Application.DoEvents(); string[] cla = new string[args.Length]; args.CopyTo(cla, 0); FormOpenDental formOD = new FormOpenDental(cla); formOD.IsSecondInstance = isSecondInstance; Application.Run(formOD); }
///<summary>Returns true if the commlog was able to save to the database. Otherwise returns false. ///Set showMsg to true to show a meaningful message when the commlog cannot be saved.</summary> private bool SaveCommItem(bool showMsg) { if (!SyncCommlogWithUI(showMsg)) { return(false); } if (_isPersistent && string.IsNullOrWhiteSpace(_commlogCur.Note)) //in persistent mode, we don't want to save empty commlogs { return(false); } if (_commlogOld.IsNew || _isPersistent) { Commlogs.Insert(_commlogCur); _commlogCur.IsNew = false; _commlogOld = _commlogCur.Copy(); textCommlogNum.Text = _commlogCur.CommlogNum.ToString(); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, _commlogCur.PatNum, "Insert"); //Post insert persistent user preferences. if (_isPersistent) { if (_userOdPrefClearNote == null || PIn.Bool(_userOdPrefClearNote.ValueString)) { ClearNote(); } if (_userOdPrefEndDate == null || PIn.Bool(_userOdPrefEndDate.ValueString)) { ClearDateTimeEnd(); } ODException.SwallowAnyException(() => { FormOpenDental.S_RefreshCurrentModule(); }); } } else { Commlogs.Update(_commlogCur); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, _commlogCur.PatNum, ""); } return(true); }
///<summary>Called to change the password for Security.CurUser. ///Returns true if password was changed successfully. ///Set isForcedLogOff to force the program to log the user off if they cancel out of the Change Password window.</summary> public static bool ChangePassword(bool isForcedLogOff, bool doRefreshSecurityCache = true) { //no security blocking because everyone is allowed to change their own password. if (Security.CurUser.UserNumCEMT != 0) { MsgBox.Show("FormOpenDental", "Use the CEMT tool to change your password."); return(false); } FormUserPassword FormU = new FormUserPassword(false, Security.CurUser.UserName); FormU.ShowDialog(); if (FormU.DialogResult == DialogResult.Cancel) { if (isForcedLogOff) { FormOpenDental FormOD = Application.OpenForms.OfType <FormOpenDental>().ToList()[0]; //There always should be exactly 1. FormOD.LogOffNow(true); } return(false); } bool isPasswordStrong = FormU.PasswordIsStrong; try { Userods.UpdatePassword(Security.CurUser, FormU.LoginDetails, isPasswordStrong); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } Security.CurUser.PasswordIsStrong = FormU.PasswordIsStrong; Security.CurUser.LoginDetails = FormU.LoginDetails; Security.PasswordTyped = FormU.PasswordTyped; if (doRefreshSecurityCache) { DataValid.SetInvalid(InvalidType.Security); } return(true); }
private void butNew_Click(object sender, System.EventArgs e) { if (!Security.IsAuthorized(Permissions.AppointmentCreate)) { return; } if (PatRestrictionL.IsRestricted(_patCur.PatNum, PatRestrict.ApptSchedule)) { return; } if (AppointmentL.PromptForMerge(_patCur, out _patCur)) { FillFamily(); odApptGrid.PatCur = _patCur; odApptGrid.RefreshAppts(); FormOpenDental.S_Contr_PatientSelected(_patCur, true, false); } if (_patCur != null && _patCur.PatStatus.In(PatientStatus.Archived, PatientStatus.Deceased)) { MsgBox.Show(this, "Appointments cannot be scheduled for " + _patCur.PatStatus.ToString().ToLower() + " patients."); return; } MakeAppointment(); }
private void dataJobs_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { FormOpenDental.S_GoToJob(((Job)(dataJobs.Rows[e.RowIndex].Tag)).JobNum); }
static void Main(string[] args) { //Application.EnableVisualStyles() uses version 6 of comctl32.dll instead of version 5. See https://support.microsoft.com/en-us/kb/2892345 //See also http://stackoverflow.com/questions/8335983/accessviolationexception-on-tooltip-that-faults-comctl32-dll-net-4-0 Application.EnableVisualStyles(); //This line fixes rare AccessViolationExceptions for ToolTips on our ValidDate boxes, ValidDouble boxes, etc... //Register an EventHandler which handles unhandled exceptions. //AppDomain.CurrentDomain.UnhandledException+=new UnhandledExceptionEventHandler(OnUnhandeledExceptionPolicy); bool isSecondInstance = false; //or more. Process[] processes = Process.GetProcesses(); for (int i = 0; i < processes.Length; i++) { if (processes[i].Id == Process.GetCurrentProcess().Id) { continue; } //we have to do it this way because during debugging, the name has vshost tacked onto the end. if (processes[i].ProcessName.StartsWith("OpenDental")) { isSecondInstance = true; break; } } /* * if(args.Length>0) {//if any command line args, then we will attempt to reuse an existing OD window. * if(isSecondInstance){ * FormCommandLinePassOff formCommandLine=new FormCommandLinePassOff(); * formCommandLine.CommandLineArgs=new string[args.Length]; * args.CopyTo(formCommandLine.CommandLineArgs,0); * Application.Run(formCommandLine); * return; * } * }*/ Application.SetCompatibleTextRenderingDefault(false); //designer uses new text rendering. This makes the exe use matching text rendering. Before this was added, it was common for labels to be longer in the running program than they were in the designer. Application.EnableVisualStyles(); //changes appearance to XP Application.DoEvents(); string[] cla = new string[args.Length]; args.CopyTo(cla, 0); FormOpenDental formOD = new FormOpenDental(cla); Action <Exception, string> onUnhandled = new Action <Exception, string>((e, threadName) => { //Try to automatically submit a bug report to HQ. Default to "None" just in case the submission fails. BugSubmissionResult subResult = BugSubmissionResult.None; try { subResult = BugSubmissions.SubmitException(e, threadName, FormOpenDental.CurPatNum, formOD.GetSelectedModuleName()); } catch (Exception ex) { ex.DoNothing(); } FriendlyException.Show("Critical Error: " + e.Message, e, "Quit"); formOD.ProcessKillCommand(); }); CodeBase.ODThread.RegisterForUnhandledExceptions(formOD, onUnhandled); formOD.IsSecondInstance = isSecondInstance; Application.AddMessageFilter(new ODGlobalUserActiveHandler()); Application.ThreadException += new ThreadExceptionEventHandler((object s, ThreadExceptionEventArgs e) => { onUnhandled(e.Exception, "ProgramEntry"); }); Application.Run(formOD); }
private void butOK_Click(object sender, System.EventArgs e) { bool usingEcw = Programs.UsingEcwTightOrFullMode(); Userod selectedUser = null; if (PrefC.GetBool(PrefName.UserNameManualEntry)) { for (int i = 0; i < listUser.Items.Count; i++) { //Check the user name typed in using ToLower and Trim because Open Dental is case insensitive and does not allow white-space in regards to user names. if (textUser.Text.Trim().ToLower() == listUser.Items[i].ToString().Trim().ToLower()) { selectedUser = (Userod)listUser.Items[i]; //Found the typed username break; } } if (selectedUser == null) { MsgBox.Show(this, "Login failed"); return; } } else { selectedUser = (Userod)listUser.SelectedItem; } string password = textPassword.Text; if (usingEcw) //ecw requires hash, but non-ecw requires actual password { password = Userods.HashPassword(password, true); } if (selectedUser.UserName == "Stay Open" && IsSimpleSwitch && PrefC.IsODHQ) { // No need to check password when changing task users at HQ to user "Stay Open". } else { try { Userods.CheckUserAndPassword(selectedUser.UserName, password, usingEcw); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } if (RemotingClient.RemotingRole == RemotingRole.ClientWeb && selectedUser.Password == "" && textPassword.Text == "") { MsgBox.Show(this, "When using the web service, not allowed to log in with no password. A password should be added for this user."); return; } //successful login. if (!IsSimpleSwitch) { Security.CurUser = selectedUser.Copy(); Security.IsUserLoggedIn = true; //Jason approved always storing the cleartext password that the user typed in //since this is necessary for Reporting Servers over middle tier and was already happening when a user logged in over middle tier. Security.PasswordTyped = password; if (PrefC.GetBool(PrefName.PasswordsMustBeStrong) && PrefC.GetBool(PrefName.PasswordsWeakChangeToStrong)) { if (Userods.IsPasswordStrong(textPassword.Text) != "") //Password is not strong { MsgBox.Show(this, "You must change your password to a strong password due to the current Security settings."); FormOpenDental FormOD = Application.OpenForms.OfType <FormOpenDental>().ToList()[0]; //There always should be exactly 1. if (!FormOD.ChangePassword(true)) //Failed password update. { return; } } } } else { CurUserSimpleSwitch = selectedUser.Copy(); } if (!IsSimpleSwitch) { SecurityLogs.MakeLogEntry(Permissions.UserLogOnOff, 0, "User: "******" has logged on."); } Plugins.HookAddCode(this, "FormLogOn.butOK_Click_end"); DialogResult = DialogResult.OK; }
///<summary></summary> protected static void OnModuleSelected(ModuleEventArgs e) { FormOpenDental.S_GotoModule_ModuleSelected(e); }
///<summary>Triggers an event that causes a signal to be sent to all other computers telling them what kind of locally stored data needs to be updated. Either supply a set of flags for the types, or supply a date if the appointment screen needs to be refreshed. Yes, this does immediately refresh the local data, too. The AllLocal override does all types except appointment date for the local computer only, such as when starting up.</summary> public static void SetInvalid(bool onlyLocal) { FormOpenDental.S_DataValid_BecomeInvalid(new ValidEventArgs(DateTime.MinValue, new[] { InvalidType.AllLocal }, true, 0)); }
private void gridNoHours_CellDoubleClick(object sender, ODGridClickEventArgs e) { FormOpenDental.S_GoToJob(((Job)gridNoHours.Rows[e.Row].Tag).JobNum); }
private void gridQuoteOld_CellDoubleClick(object sender, ODGridClickEventArgs e) { FormOpenDental.S_GoToJob(((Job)gridQuoteNotStarted.Rows[e.Row].Tag).JobNum); }
/* * ///<summary>Triggers an event that causes a signal to be sent to all other computers telling them what kind of locally stored data needs to be updated. Either supply a set of flags for the types, or supply a date if the appointment screen needs to be refreshed. Yes, this does immediately refresh the local data, too. The AllLocal override does all types except appointment date for the local computer only, such as when starting up.</summary> * public static void SetInvalid(List<int> itypes){ * OnBecameInvalid(new OpenDental.ValidEventArgs(DateTime.MinValue,itypes,false,0)); * }*/ ///<summary>Triggers an event that causes a signal to be sent to all other computers telling them what kind of locally stored data needs to be updated. Either supply a set of flags for the types, or supply a date if the appointment screen needs to be refreshed. Yes, this does immediately refresh the local data, too. The AllLocal override does all types except appointment date for the local computer only, such as when starting up.</summary> public static void SetInvalid(params InvalidType[] arrayITypes) { FormOpenDental.S_DataValid_BecomeInvalid(new ValidEventArgs(DateTime.MinValue, arrayITypes, false, 0)); }
private void FormMapHQ_FormClosed(object sender, FormClosedEventArgs e) { FormOpenDental.RemoveMapFromList(this); }
private void butSynch_Click(object sender, EventArgs e) { if (textUsername.Text == "") { MsgBox.Show(this, "Please enter a username first."); return; } if (_listReplicationServers.Count == 0) { MsgBox.Show(this, "Please add at servers to the list first."); return; } Cursor = Cursors.WaitCursor; string databaseNameOriginal = MiscData.GetCurrentDatabase(); string compNameOriginal = DataConnection.GetServerName(); DataConnection dc; bool isReplicationSucessfull = true; for (int i = 0; i < _listReplicationServers.Count; i++) { string compName = _listReplicationServers[i].Descript; dc = new DataConnection(); try { dc.SetDb(compName, databaseNameOriginal, textUsername.Text, textPassword.Text, "", "", DataConnection.DBtype); //Connection is considered to be successfull at this point. Now restart the slave process to force replication. string command = "STOP SLAVE; START SLAVE; SHOW SLAVE STATUS;"; DataTable slaveStatus = dc.GetTable(command); //Wait for the slave process to become active again. for (int j = 0; j < 40 && slaveStatus.Rows[0]["Slave_IO_Running"].ToString().ToLower() != "yes"; j++) { Thread.Sleep(1000); command = "SHOW SLAVE STATUS"; slaveStatus = dc.GetTable(command); } if (slaveStatus.Rows[0]["Slave_IO_Running"].ToString().ToLower() != "yes") { throw new ApplicationException(Lan.g(this, "Slave IO is not running on server") + " " + compName); } if (slaveStatus.Rows[0]["Slave_SQL_Running"].ToString().ToLower() != "yes") { throw new ApplicationException(Lan.g(this, "Slave SQL is not running on server") + " " + compName); } //Wait for replication to complete. while (slaveStatus.Rows[0]["Slave_IO_State"].ToString().ToLower() != "waiting for master to send event" || slaveStatus.Rows[0]["Seconds_Behind_Master"].ToString() != "0") { slaveStatus = dc.GetTable(command); } } catch (Exception ex) { Cursor = Cursors.Default; MessageBox.Show(Lan.g(this, "Error forcing synch on server") + " " + compName + ": " + ex.Message); isReplicationSucessfull = false; break; //Cancel operation. } } if (isReplicationSucessfull) { Cursor = Cursors.Default; MessageBox.Show(Lan.g(this, "Database synch completed successfully.")); } //Do not leave this function without connecting back to original database, or closing program. //At this point we are still connected to the last replication server in the list, try to connect back up to the original database. bool isReconnectSuccessful = false; while (!isReconnectSuccessful) { try { //Reconnect back to original database. dc = new DataConnection(); dc.SetDb(compNameOriginal, databaseNameOriginal, textUsername.Text, textPassword.Text, "", "", DataConnection.DBtype); isReconnectSuccessful = true; //No exception thrown, leave while loop. } catch (Exception ex) { if (MessageBox.Show(Lan.g(this, "Error reconnecting to server") + " " + compNameOriginal + ": " + ex.Message + "\r\n" + Lan.g(this, "Would you like to retry? Cancel will close the program."), "", MessageBoxButtons.OKCancel) != DialogResult.OK) { FormOpenDental.S_ProcessKillCommand(); } } } }