private bool VerificaComputador() { ComputerColecao colecao = empresaNegocios.ConsultarComputadorIdUnid(infoUnid.uniid); if (colecao != null) { PreencherComputador(); List <string> mac = new List <string>(); foreach (ComputerInfo comp in colecao) { mac.Add(comp.compmac); if (mac.Contains(infoComp.compmac)) { infoComp = comp; return(true); } } return(false); } else { return(false); } }
private void PreencherForm() { if (Ativo) { textBoxId.Text = infoEmpresa.empcod; buttonUnid.Enabled = false; buttonUnid.ForeColor = Color.Gray; } else { infoEmpresa = empresaNegocios.ConsultarEmpresaSysId(textBoxId.Text); } if (infoEmpresa != null) { textBoxCnpj.Text = infoEmpresa.empcnpj; textBoxCep.Text = infoEmpresa.empcep; textBoxEmail.Text = infoEmpresa.empemail; textBoxComplemento.Text = infoEmpresa.empcomplemento; textBoxRef.Text = infoEmpresa.empreferencia; textBoxEnd.Text = infoEmpresa.empcomplemento; textBoxFantasia.Text = infoEmpresa.empfantasia; textBoxEnd.Text = infoEmpresa.emplogradouro + "/" + infoEmpresa.empbairro + " (" + infoEmpresa.empcidade + "-" + infoEmpresa.empuf + ")"; textBoxRazao.Text = infoEmpresa.emprazaosocial; textBoxTel.Text = infoEmpresa.emptelefone; empresaNegocios = new EmpresaNegocios(infoEmpresa.empconexao); colecaoUnid = empresaNegocios.ConsultarAssistencia(); Form1.Computer = new ComputerInfo(); Form1.ConfiguracaoRede(); textBoxComputer.Text = Form1.Computer.comphostname; textBoxIp.Text = Form1.Computer.compip; textBoxAdapter.Text = Form1.Computer.compadaptador; maskedTextBoxMac.Text = Form1.Computer.compmac; if (colecaoUnid != null) { infoUnid = colecaoUnid[0]; colecaoComp = empresaNegocios.ConsultarComputadorIdUnid(infoUnid.uniid); if (colecaoComp != null) { foreach (ComputerInfo comp in colecaoComp) { if (comp.compserver) { Form1.Server = comp; groupBoxServer.Enabled = false; radioButtonNao.Checked = true; } if (Form1.Computer.compmac == comp.compmac) { infoComp = comp; } } } textBoxUnidNome.Text = colecaoUnid[0].uniunidade; textBoxServer.Text = (Form1.Server == null) ? "" : Form1.Server.comphostname; } dataGridViewUnid.DataSource = colecaoUnid; buttonInserir.Enabled = true; } else { FormMessage.ShowMessegeInfo("Registro não encontrado!"); } }