Esempio n. 1
0
 ///<summary>Returns serialized DbInfo object as JSON string of database info from both the preference table and non preferernce table info.</summary>
 private string GetDbInfoJSON(long patNum, string moduleName)
 {
     _info = new BugSubmission.SubmissionInfo();
     try {
         //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.WebServiceServerName
         };
         foreach (PrefName pref in listPrefs)
         {
             _info.DictPrefValues[pref] = Prefs.GetOne(pref).ValueString;
         }
         _info.CountClinics            = Clinics.GetCount();
         _info.EnabledPlugins          = Programs.GetWhere(x => x.Enabled && !string.IsNullOrWhiteSpace(x.PluginDllName)).Select(x => x.ProgName).ToList();
         _info.ClinicNumCur            = Clinics.ClinicNum;
         _info.UserNumCur              = Security.CurUser.UserNum;
         _info.PatientNumCur           = patNum;
         _info.IsOfficeOnReplication   = (ReplicationServers.GetCount() > 0 ? true : false);
         _info.IsOfficeUsingMiddleTier = (RemotingClient.RemotingRole == RemotingRole.ClientWeb ? true : false);
         _info.WindowsVersion          = MiscData.GetOSVersionInfo();
         _info.CompName = Environment.MachineName;
         List <UpdateHistory> listHist = UpdateHistories.GetPreviouUpdateHistories(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.
         _info.ModuleNameCur         = moduleName;
         _info.DatabaseName          = DataConnection.GetDatabaseName();
     }
     catch (Exception ex) {
         ex.DoNothing();
     }
     return(JsonConvert.SerializeObject(_info));
 }