///<summary></summary> public static void Update(SiteLink siteLink) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), siteLink); return; } Crud.SiteLinkCrud.Update(siteLink); }
///<summary></summary> public static long Insert(SiteLink siteLink) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { siteLink.SiteLinkNum = Meth.GetLong(MethodBase.GetCurrentMethod(), siteLink); return(siteLink.SiteLinkNum); } return(Crud.SiteLinkCrud.Insert(siteLink)); }
///<summary>Gets the outer color of the first site that matches the siteNum passed in. Method designed for HQ only.</summary> public static Color GetSiteOuterColorBySiteNum(long siteNum, Color colorDefault) { //No need to check RemotingRole; no call to db. Color color = colorDefault; SiteLink siteLink = GetFirstOrDefault(x => x.SiteNum == siteNum); if (siteLink != null) { color = siteLink.OuterColor; } return(color); }
///<summary>Gets the color of the first Site match based on the first three octets in the default gateway of the local computer. ///Defaults to black if no valid site link can be found. ///The first three octets are used to dictate which location the calling computer is located. Method designed for HQ only.</summary> public static Color GetSiteColorByGateway() { //No need to check RemotingRole; no call to db. Color color = Color.Black; SiteLink siteLink = GetSiteLinkByGateway(); if (siteLink != null) { color = siteLink.SiteColor; } return(color); }
///<summary>Gets the first Site based on the first three octets in the default gateway of the local computer. ///Returns the first site in the list if there is no match. Can return null if there are no sites in the current cache or invalid site link. ///The first three octets are used to dictate which location the calling computer is located. Method designed for HQ only.</summary> public static Site GetSiteByGateway() { //No need to check RemotingRole; no call to db. //Defatult to first site in the list just in case we add a new location without first updating this method / paradigm. Site site = Sites.GetFirst(); SiteLink siteLink = GetSiteLinkByGateway(); if (siteLink != null) { site = Sites.GetFirst(x => x.SiteNum == siteLink.SiteNum); } return(site); }
///<summary></summary> public static void Upsert(SiteLink siteLink) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), siteLink); return; } if (siteLink.SiteLinkNum > 0) { Update(siteLink); } else { Insert(siteLink); } }
///<summary>Updates the EmployeeNum column of the corresponding site link entry. Returns true if something changed, otherwise false.</summary> public static bool UpdateTriageCoordinator(long siteLinkNum, long employeeNum) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetBool(MethodBase.GetCurrentMethod(), siteLinkNum, employeeNum)); } SiteLink siteLink = GetFirstOrDefault(x => x.SiteLinkNum == siteLinkNum); if (siteLink != null && siteLink.EmployeeNum == employeeNum) { return(false); } string command = "UPDATE sitelink SET EmployeeNum=" + POut.Long(employeeNum) + " " + "WHERE SiteLinkNum=" + POut.Long(siteLinkNum); Db.NonQ(command); return(true); }
///<summary>Fills the dictionary of connection setting defaults or user overrides for several fkeyTypes if needed.</summary> private static void FillDictHqCentralConnections() { if (_hasConnections) { return; } Dictionary <ConnectionNames, CentralConnection> dictHqCentralConnections = null; if (ODBuild.IsDebug() && !ODInitialize.IsRunningInUnitTest) { //The database will typically have connection settings to live databases that should not be used in debug mode. //Use the hard coded connection settings which developers can change as needed. dictHqCentralConnections = new Dictionary <ConnectionNames, CentralConnection>() { #region Default Debug Connections { ConnectionNames.BugsHQ, new CentralConnection() { ServerName = "localhost", DatabaseName = "bugs", MySqlUser = "******", MySqlPassword = "", } }, { ConnectionNames.CustomersHQ, new CentralConnection() { ServerName = "localhost", DatabaseName = "customers", MySqlUser = "******", MySqlPassword = "", } }, { ConnectionNames.ManualPublisher, new CentralConnection() { ServerName = "localhost", DatabaseName = "jordans_mp_test", MySqlUser = "******", MySqlPassword = "", } }, { ConnectionNames.WebChat, new CentralConnection() { ServerName = "localhost", DatabaseName = "webchat", MySqlUser = "******", MySqlPassword = "", } } #endregion }; } else //Release mode or unit testing //Get the default connection settings for all databases from the preference table. { dictHqCentralConnections = GetHqConnections(); #region Site Overrides SiteLink siteLink = SiteLinks.GetSiteLinkByGateway(); //There should always be a default connection setting for every possible connection at HQ. if (dictHqCentralConnections != null && siteLink != null) { //Look for site specific overrides. Dictionary <ConnectionNames, CentralConnection> dictHqCentralConnectionOverrides = GetHqConnectionsFromString(siteLink.ConnectionSettingsHQOverrides); if (dictHqCentralConnectionOverrides != null) { foreach (KeyValuePair <ConnectionNames, CentralConnection> keyValuePair in dictHqCentralConnectionOverrides) { dictHqCentralConnections[keyValuePair.Key] = keyValuePair.Value; } } } #endregion } foreach (KeyValuePair <ConnectionNames, CentralConnection> keyValuePair in dictHqCentralConnections) { _dictHqCentralConnections.AddOrUpdate(keyValuePair.Key, keyValuePair.Value, (conNames, conCentral) => { return(keyValuePair.Value); }); } _hasConnections = true; }