private void GetUserLocation() { try { var systemInfo = new ActiveDs.ADSystemInfo(); var siteName = systemInfo.SiteName; UserLocation = !string.IsNullOrEmpty(siteName) ? siteName : "UNKNOWN"; } catch { UserLocation = "UNKNOWN"; } }
private string GetProjectLocation(string path) { string projectLocation = ""; try { if (!string.IsNullOrEmpty(path)) { Regex regServer = new Regex(@"^\\\\group\\hok\\(.+?(?=\\))|^\\\\(.{2,3})-\d{2}svr(\.group\.hok\.com)?\\", RegexOptions.IgnoreCase); Match regMatch = regServer.Match(path); if (regMatch.Success) { if (string.IsNullOrEmpty(regMatch.Groups[1].Value)) { projectLocation = regMatch.Groups[2].Value; } else { projectLocation = regMatch.Groups[1].Value; } } if (string.IsNullOrEmpty(projectLocation)) { try { ActiveDs.ADSystemInfo systemInfo = new ActiveDs.ADSystemInfo(); string siteName = systemInfo.SiteName; if (!string.IsNullOrEmpty(siteName)) { projectLocation = siteName; } } catch { projectLocation = ""; } } } } catch (Exception ex) { MessageBox.Show("Failed to get project location.\n" + ex.Message, "Get Project Location", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(projectLocation); }
private void GetUserLocation() { try { ActiveDs.ADSystemInfo systemInfo = new ActiveDs.ADSystemInfo(); string siteName = systemInfo.SiteName; if (!string.IsNullOrEmpty(siteName)) { userLocation = siteName; } else { userLocation = "UNKNOWN"; } } catch { userLocation = "UNKNOWN"; } }
private void GetUserInfo() { try { try { UserName = Environment.UserName; } catch (Exception ex) { Log.AppendLog(LogMessageType.EXCEPTION, ex.Message); UserName = ""; } var systemInfo = new ActiveDs.ADSystemInfo(); var siteName = systemInfo.SiteName; UserLocation = !string.IsNullOrEmpty(siteName) ? siteName : "UNKNOWN"; } catch (Exception ex) { Log.AppendLog(LogMessageType.EXCEPTION, ex.Message); UserLocation = "UNKNOWN"; } try { var hostEntry = Dns.GetHostEntry(Dns.GetHostName()); IPAddress = hostEntry.AddressList[1].ToString(); } catch (Exception ex) { Log.AppendLog(LogMessageType.EXCEPTION, ex.Message); IPAddress = "UNKNOWN"; } }
private void GetUserLocation() { try { var systemInfo = new ActiveDs.ADSystemInfo(); var siteName = systemInfo.SiteName; UserLocation = !string.IsNullOrEmpty(siteName) ? siteName : "UNKNOWN"; if (UserLocation == "VPN") { if (IpAddress == "") { GetIpAddress(); } if (IpAddress.StartsWith("172.30.56")) { UserLocation = "LON"; } } } catch { UserLocation = "UNKNOWN"; } }