private static void TrySetCanadianNetworkNum(Carrier jsonCarrier, OpenDentBusiness.Carrier odCarrier, List <CanadianNetwork> listCanadianNetworks) { if (jsonCarrier.Network == null || jsonCarrier.Network.Count == 0) { return; //We need to be careful not to fully trust data coming from other applications. } //Telus B is now the primary network in Canada, includes almost all carriers. Network jsonCarrierNetwork = jsonCarrier.Network.FirstOrDefault(x => x.Network_Folder == "TGB"); if (jsonCarrierNetwork == null) //We have a bypass that treats INSTREAM like Telus B. Try looking for INSTREAM now. { jsonCarrierNetwork = jsonCarrier.Network.FirstOrDefault(x => x.Network_Folder == "INS"); } if (jsonCarrierNetwork == null) //Otherswise default to first value in list. { jsonCarrierNetwork = jsonCarrier.Network[0]; } string odAbbr = ""; switch (jsonCarrierNetwork.Network_Folder) { case "ABC": //Alberta Blue Cross odAbbr = "ABC"; break; case "TGA": //Telus Group A, this isn't in our current json file. Best guess. odAbbr = "TELUS A"; break; case "TGB": //Telus Group B odAbbr = "TELUS B"; break; case "INS": //instream odAbbr = "CSI"; //CSI is the previous name for the network now known as INSTREAM. break; default: //Unknown network_foler, CanadianNetworkNum will not be set. ODException.SwallowAnyException(() => { //Let HQ known if this ever happens so that it doesn't go unnoticed. BugSubmissions.SubmitException( new ApplicationException("Unknown iTrans Network. Name: " + jsonCarrierNetwork.Name + " - Folder: " + jsonCarrierNetwork.Network_Folder) ); }); break; } CanadianNetwork network = listCanadianNetworks.FirstOrDefault(x => x.Abbrev == odAbbr); if (network != null) { odCarrier.CanadianNetworkNum = network.CanadianNetworkNum; } }
///<summary>Attempts to submit an exception to HQ. ///Checks PrefName.SendUnhandledExceptionsToHQ prior to web call. ///Returns BugSubmissionResult.UpdateRequired when submitter is not on most recent stable or any version of the beta. ///Returns BugSubmissionResult.Failed when an error occured in the web call method. ///Returns BugSubmissionResult.Success when bugSubmissions was successfully created at HQ.</summary> public static BugSubmissionResult SubmitException(Exception ex, string threadName = "", long patNumCur = -1, string moduleName = "") { if (!PrefC.GetBool(PrefName.SendUnhandledExceptionsToHQ) || _listInvalidExceptionText.Any(x => ex.Message.ToLower().Contains(x.ToLower()))) { return(BugSubmissionResult.None); } return(BugSubmissions.ParseBugSubmissionResult( WebServiceMainHQProxy.GetWebServiceMainHQInstance().SubmitUnhandledException( WebServiceMainHQProxy.CreateWebServiceHQPayload( WebServiceMainHQProxy.CreatePayloadContent( new BugSubmission(ex, threadName, patNumCur, moduleName), "bugSubmission") , eServiceCode.BugSubmission)))); }
/// <summary>ListFixedBugInfos must be set prior to calling this.</summary> /// <param name="programVersionOverride">Rarely we might need to pass in a target program version when this submissions programversion is not set. /// For example this is done in unit test to target a specific match.</param> /// <returns>Returns the pertinent MatchedBugInfo.</returns> public MatchedBugInfo GetPertinentFixedVersion(Version programVersionOverride = null) { Version pertinentFixedVersion = null; MatchedBugInfo pertinentBugInfo = null; if (programVersionOverride == null) { programVersionOverride = new Version(this.ProgramVersion); } foreach (MatchedBugInfo bugInfo in this.ListFixedBugInfos) { List <Version> listFixedVersions = bugInfo.VersionsFixed.Split(';').Select(x => new Version(x)).ToList(); if (BugSubmissions.TryMatchPertinentFixedVersion(programVersionOverride, listFixedVersions, out Version versionFound)) { if (pertinentFixedVersion == null || pertinentFixedVersion < versionFound) { pertinentBugInfo = bugInfo; } pertinentFixedVersion = new[] { pertinentFixedVersion ?? new Version(), versionFound }.Max(); } } return(pertinentBugInfo); }