예제 #1
0
 ///<summary>Returns serialized DbInfo object as JSON string of database info from both the preference table and non preferernce table info.
 ///Every unique bit of information is individually try / caught so that we return as much information as possible.</summary>
 private string GetDbInfoJSON(long patNum, string moduleName)
 {
     _info = new BugSubmission.SubmissionInfo();
     ODException.SwallowAnyException(() => {
         //This list is not in a separate method because we want to ensure that future development related to bug submissions don't try to make assumptions
         //on which preferences are in an object at any given time.
         //Ex.  Let's say in version 17.4, the list doesn't contain the payplan version preference, but 17.5 does.
         //If we called the method that retrieves the used preferences from WebServiceMainHQ which in this example is on version 17.5,
         // it would think all bugsubmission rows contain the payplan version preference when that is not the case.
         List <PrefName> listPrefs = new List <PrefName>()
         {
             PrefName.AtoZfolderUsed,
             PrefName.ClaimSnapshotEnabled,
             PrefName.ClaimSnapshotRunTime,
             PrefName.ClaimSnapshotTriggerType,
             PrefName.CorruptedDatabase,
             PrefName.DataBaseVersion,
             PrefName.EasyNoClinics,
             PrefName.LanguageAndRegion,
             PrefName.MySqlVersion,
             PrefName.PayPlansVersion,
             PrefName.ProcessSigsIntervalInSecs,
             PrefName.ProgramVersionLastUpdated,
             PrefName.ProgramVersion,
             PrefName.RandomPrimaryKeys,
             PrefName.RegistrationKey,
             PrefName.RegistrationKeyIsDisabled,
             PrefName.ReplicationFailureAtServer_id,
             PrefName.ReportingServerCompName,
             PrefName.ReportingServerDbName,
             PrefName.ReportingServerMySqlUser,
             PrefName.ReportingServerMySqlPassHash,
             PrefName.ReportingServerURI,
             PrefName.SecurityLogOffAfterMinutes,
             PrefName.WebServiceServerName
         };
         foreach (PrefName pref in listPrefs)
         {
             _info.DictPrefValues[pref] = Prefs.GetOne(pref).ValueString;
         }
     });
     ODException.SwallowAnyException(() => { _info.CountClinics = Clinics.GetCount(); });
     ODException.SwallowAnyException(() => { _info.EnabledPlugins = Programs.GetWhere(x => x.Enabled && !string.IsNullOrWhiteSpace(x.PluginDllName)).Select(x => x.ProgName).ToList(); });
     ODException.SwallowAnyException(() => { _info.ClinicNumCur = Clinics.ClinicNum; });
     ODException.SwallowAnyException(() => { _info.UserNumCur = Security.CurUser.UserNum; });
     ODException.SwallowAnyException(() => { _info.PatientNumCur = patNum; });
     ODException.SwallowAnyException(() => { _info.IsOfficeOnReplication = (ReplicationServers.GetCount() > 0 ? true : false); });
     ODException.SwallowAnyException(() => { _info.IsOfficeUsingMiddleTier = (RemotingClient.RemotingRole == RemotingRole.ClientWeb ? true : false); });
     ODException.SwallowAnyException(() => { _info.WindowsVersion = MiscData.GetOSVersionInfo(); });
     ODException.SwallowAnyException(() => { _info.CompName = Security.CurComputerName; });
     ODException.SwallowAnyException(() => {
         List <UpdateHistory> listHist = UpdateHistories.GetPreviousUpdateHistories(2);                        //Ordered by newer versions first.
         _info.PreviousUpdateVersion   = listHist.Count == 2 ? listHist[1].ProgramVersion : "";                //Show the previous version they updated from
         _info.PreviousUpdateTime      = listHist.Count > 0 ? listHist[0].DateTimeUpdated : DateTime.MinValue; //Show when they updated to the current version.
     });
     ODException.SwallowAnyException(() => { _info.ModuleNameCur = moduleName; });
     ODException.SwallowAnyException(() => { _info.DatabaseName = DataConnection.GetDatabaseName(); });
     ODException.SwallowAnyException(() => { _info.OpenDentBusinessVersion = MiscData.GetAssemblyVersion(); });
     ODException.SwallowAnyException(() => { _info.OpenDentBusinessMiddleTierVersion = MiscData.GetAssemblyVersionForMiddleTier(); });
     return(JsonConvert.SerializeObject(_info, new JsonSerializerSettings {
         NullValueHandling = NullValueHandling.Ignore
     }));
 }