/// <summary> /// Init OSVersionInfo object by current windows environment /// </summary> /// <returns></returns> public static OSVersionInfo GetOSVersionInfo() { System.OperatingSystem osVersionObj = System.Environment.OSVersion; OSVersionInfo osVersionInfo = new OSVersionInfo() { Name = GetOSName(osVersionObj), Major = osVersionObj.Version.Major, Minor = osVersionObj.Version.Minor, Build = osVersionObj.Version.Build }; return(osVersionInfo); }
public void EnviaInformacaohardware(int IDempresa, int IDsetor, string versao_Dispositivo, string IPLocal, string UserOS, string HashMaquina, string UrlWS) { InsereDados(); //Variáveis. DA = null; DA = new SqlCeDataAdapter("Select * from CH_Hardware", SQLConn); //Instância DataAdapter com o cod a executar e a conexão TBCH = null; TBCH = new DataTable(); //Instância DataTable. DA.Fill(TBCH); //preenche tabela var osInfo = OSVersionInfo.GetOSVersionInfo(); if (TBCH.Rows.Count > 0) { //Informações do hardware --- pontonarede.ServiceSoapClient WebS = new pontonarede.ServiceSoapClient("ServiceSoap", UrlWS); WebS.Endpoint.Binding.OpenTimeout = TimeSpan.FromSeconds(3); WebS.Endpoint.Binding.SendTimeout = TimeSpan.FromSeconds(5); try { WebS.Open(); ChaveHardware CH = new ChaveHardware(pnrClient.Properties.Settings.Default.ptServer35ConnectionString); WebS.MonitoramentoClientHash(TBCH.Rows[0]["SerialHD"].ToString(), TBCH.Rows[0]["SerialProcessador"].ToString(), TBCH.Rows[0]["EnderecoMAC"].ToString(), IPLocal, UserOS, osInfo.FullName, DateTime.Now, IDempresa, IDsetor, versao_Dispositivo, TBCH.Rows[0]["TotalMemoria"].ToString(), TBCH.Rows[0]["EspacoLivreHD"].ToString(), TBCH.Rows[0]["CapacidadeHD"].ToString(), TBCH.Rows[0]["ArquiteturaMaquina"].ToString(), TBCH.Rows[0]["ModeloProcessador"].ToString(), HashMaquina); WebS.Close(); } catch (Exception ex) { //MessageBox.Show("Erro na hora de enviar informação da máquina! " + ex.ToString(), //"Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); ex.ToString(); WebS.Close(); } } }