public Unity GetUnity(string user) { Unity unity = new Unity(); attributeData[] attributeDatas = new attributeData[1]; attributeDatas[0] = new attributeData { //search enrollment IDATTRIBUTE = EAttribute.tfyacess_userid.ToString(), VLATTRIBUTE = user }; searchDocumentFilter searchDocumentFilter = new searchDocumentFilter { IDCATEGORY = searchAttributePermissionCategory }; searchDocumentReturn searchDocumentReturn = seClient.searchDocument(searchDocumentFilter, "", attributeDatas); documentReturn retorno = new documentReturn(); if (searchDocumentReturn.RESULTS.Count() > 0) { string idDocument = searchDocumentReturn.RESULTS.FirstOrDefault().IDDOCUMENT; documentDataReturn documentDataReturn = seClient.viewDocumentData(idDocument, "", "", ""); string attributeCode = EAttribute.SER_cad_cod_unidade.ToString(); string attributeName = EAttribute.SER_cad_Unidade.ToString(); unity.Code = documentDataReturn.ATTRIBUTTES.Any(x => x.ATTRIBUTTENAME == attributeCode) ? documentDataReturn.ATTRIBUTTES.Where(x => x.ATTRIBUTTENAME == attributeCode).FirstOrDefault().ATTRIBUTTEVALUE.FirstOrDefault() : null; unity.Name = documentDataReturn.ATTRIBUTTES.Any(x => x.ATTRIBUTTENAME == attributeName) ? documentDataReturn.ATTRIBUTTES.Where(x => x.ATTRIBUTTENAME == attributeName).FirstOrDefault().ATTRIBUTTEVALUE.FirstOrDefault() : null; } return(unity); }
private void button1_Click_1(object sender, EventArgs e) { try { int cont = 0; var categ = textBox1categ.Text.Replace(" ", ""); if (categ != "" && categ != null) { listBox1PSTsemDOC.Items.Clear(); sendText(""); searchDocumentReturn searchDocumentReturn = new searchDocumentReturn(); searchDocumentFilter searchDocumentFilter = new searchDocumentFilter { IDCATEGORY = categ }; SEClient SeachDoc = Conection.GetConnection(); searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null); if (searchDocumentReturn.RESULTS.Count() > 0) { foreach (var item in (searchDocumentReturn.RESULTS)) { documentDataReturn searchDocumentReturn2 = new documentDataReturn(); SEClient SeachDoc2 = Conection.GetConnection(); searchDocumentReturn2 = SeachDoc2.viewDocumentData(item.IDDOCUMENT, "", "", ""); sendText("Pesquisando... " + item.IDDOCUMENT); if (searchDocumentReturn2.ELECTRONICFILE.Count() == 0) { listBox1PSTsemDOC.Items.Add(item.IDDOCUMENT + " - " + item.NMTITLE); cont++; } } sendText("Total de Documentos: " + cont); } } else { MessageBox.Show("Digite a categoria !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { MessageBox.Show("Erro: " + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static string ValidMatricExistt(string IdentificadorDOC) { Boolean PesqPastaAluno = Convert.ToBoolean(ConfigurationManager.AppSettings["PesqPastaAluno"]); if (PesqPastaAluno == true) { try { SEClient SeachDoc1 = Conection.GetConnection(); searchDocumentReturn searchDocumentReturnT1 = new searchDocumentReturn(); searchDocumentFilter searchDocumentFilterT1 = new searchDocumentFilter { IDDOCUMENT = IdentificadorDOC }; searchDocumentReturnT1 = SeachDoc1.searchDocument(searchDocumentFilterT1, "", null); Pesq2 = 1; if (searchDocumentReturnT1.RESULTS.Count() > 0) { return("yes"); } else { return("NoExist"); } } catch (Exception ex) { while (Pesq2 <= 2) { Pesq2++; File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | ValidMatricExistt | " + @" Valida Matricula: " + IdentificadorDOC + @" - " + ex.Message.ToString() + @";"); Thread.Sleep(Convert.ToInt32(IntervalReturn)); return(ValidMatricExistt(IdentificadorDOC)); } //File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | SeachDoc " + ex.Message.ToString() + @";"); return("NoConect"); } } else { return("yes"); } }
private void button1_Click(object sender, EventArgs e) { try { searchDocumentReturn searchDocumentReturn = new searchDocumentReturn(); SEClient SeachDoc = Conection.GetConnection(); searchDocumentFilter searchDocumentFilter = new searchDocumentFilter { IDCATEGORY = "123" }; searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null); if (searchDocumentReturn.RESULTS.Count() >= 0) { MessageBox.Show("Conexão testada com Sucesso!", ".:: Sucesso ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("Erro " + ex.Message, "..:: Erro ::..", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button4_Click(object sender, EventArgs e) { dateTimePicker1Inicio.Text = Convert.ToString(System.DateTime.Now.ToString("yyyy-MM-dd")); var inicio = "2020-06-19"; var fim = dateTimePicker2Fim.Text; searchDocumentReturn searchDocumentReturn = new searchDocumentReturn(); searchDocumentFilter searchDocumentFilter = new searchDocumentFilter { IDCATEGORY = textBox1CategDate.Text }; SEClient SeachDoc = Conection.GetConnection(); searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null); foreach (var item in (searchDocumentReturn.RESULTS.Where(p => p.DTDOCUMENT == inicio && p.DTDOCUMENT == fim))) { var data = item.DTDOCUMENT; var id = item.IDDOCUMENT; var nome = item.NMTITLE; } }
private void button1_Click(object sender, EventArgs e) { if (!Directory.Exists(logAssociaçaoDocumento)) { Directory.CreateDirectory(logAssociaçaoDocumento); } //string AssociaçaoDocumento = ""; //string CategPast = textBox1CategPast.Text; //string CategDoc = textBox3CategDoc.Text; //string AtribDoc = textBox2AtribDoc.Text; //string ReturnBusc = ValidMatricExistt(CategDoc, AtribDoc, CategPast); try { string CategPast = textBox1CategPast.Text; string CategDoc = textBox3CategDoc.Text; string AtribDoc = textBox2AtribDoc.Text; SEClient SeachDoc1 = Conection.GetConnection(); searchDocumentReturn searchDocumentReturnT1 = new searchDocumentReturn(); searchDocumentFilter searchDocumentFilterT1 = new searchDocumentFilter { IDCATEGORY = CategDoc }; searchDocumentReturnT1 = SeachDoc1.searchDocument(searchDocumentFilterT1, "", null); if (searchDocumentReturnT1.RESULTS.Count() > 0) { foreach (var item in (searchDocumentReturnT1.RESULTS)) { documentDataReturn documentDataReturn = new documentDataReturn(); SEClient SeachDoc = Conection.GetConnection(); documentDataReturn = SeachDoc.viewDocumentData(item.IDDOCUMENT, "", "", ""); foreach (var item1 in (documentDataReturn.ATTRIBUTTES.Where(p => p.ATTRIBUTTENAME == AtribDoc))) { var AtribuValue = item1.ATTRIBUTTEVALUE[0]; if (AtribuValue != null && AtribuValue != "") { string IDPasta = ""; if (travaAssocCategMatric == "yes") { IDPasta = AtribuValue; } else { IDPasta = CategPast + "-" + AtribuValue; } texto = @"Verificando associação... Documento: " + item.IDDOCUMENT + @" Pasta: " + IDPasta; sendText(texto); AssociarDOCxPASTA(CategPast, IDPasta, CategDoc, item.IDDOCUMENT); } else { File.AppendAllText(logAssociaçaoDocumento + @"\" + "log_Associação_erro.txt", "\r\n" + DateTime.Now + @" | ASSOCIAR DOCUMENTO: " + item.IDDOCUMENT + @" DOCUMENTO SEM VALOR NO ATRIBUTO: " + AtribDoc); } } //MessageBox.Show("Atributo Documento: " + AtribDoc + " não confere", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); //break; } } MessageBox.Show("Verificação concluida!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); sendText(""); } catch (Exception ex) { File.AppendAllText(logAssociaçaoDocumento + @"\" + "log_Associação_erro.txt", "\r\n" + DateTime.Now + @" | AssociaçãoDoc " + ex.Message.ToString() + @";"); MessageBox.Show("Erro " + ex.Message.ToString(), ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static string searchDoc(string Identificador, string empresa, string RetornCreateFolder, string Indice, string nome, string ColunaD, string ColunaE_Dtdesligamento, string ColunaF, string ColunaG, string ColunaH, string ColunaI, string ColunaJ, string ColunaK, string ColunaL, string ColunaM, string ColunaN, string ColunaO, string ColunaP) { try { #region DadosXML string Categorychecklist = ""; string Chklist_empresa = ""; string Chklist_evento = ""; var separator = ConfigurationManager.AppSettings["separator"]; XDocument doc = XDocument.Load((CaminhoDadosXML(caminho) + @"System.net.cnfg.xml")); var prods = from p in doc.Descendants("Config") select new { Categorychecklist = p.Element("Categorychecklist").Value, Chklist_empresa = p.Element("Chklist_empresa").Value, Chklist_evento = p.Element("Chklist_evento").Value, }; foreach (var p in prods) { Categorychecklist = p.Categorychecklist; Chklist_empresa = p.Chklist_empresa; Chklist_evento = p.Chklist_evento; } #endregion // attributeData[] attributeDatas = new attributeData[2]; attributeDatas[0] = new attributeData { IDATTRIBUTE = Chklist_empresa, VLATTRIBUTE = empresa }; attributeDatas[1] = new attributeData { IDATTRIBUTE = Chklist_evento, VLATTRIBUTE = "admissão" }; searchDocumentFilter searchDocumentFilter = new searchDocumentFilter { IDCATEGORY = Categorychecklist }; SEClient seClient = Conection.GetConnection(); searchDocumentReturn searchDocumentReturn = seClient.searchDocument(searchDocumentFilter, "", attributeDatas); if (searchDocumentReturn.RESULTS.Count() > 0) { foreach (var item in (searchDocumentReturn.RESULTS)) { string[] strNome = Path.GetFileName(item.IDDOCUMENT).ToString().Split(new char[] { Convert.ToChar(separator) }); string IdCat = strNome[3]; //Identificador var RetCriarDoc = CriarDoc(IdCat, RetornCreateFolder, Indice, Identificador, nome, empresa, ColunaD, ColunaE_Dtdesligamento, ColunaF, ColunaG, ColunaH, ColunaI, ColunaJ, ColunaK, ColunaL, ColunaM, ColunaN, ColunaO, ColunaP); if (RetCriarDoc != "false") { var RetDocAssocia = CriaDocContainerAssocia(IdCat, RetCriarDoc, RetornCreateFolder); } } } IDSeachDoc = 1; return(Identificador); } catch (Exception ex) {///here while (IDSeachDoc <= 2) { IDSeachDoc++; File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | CriarPastaDoc | " + ex.Message.ToString() + @";"); Thread.Sleep(Convert.ToInt32(5000)); return(searchDoc(Identificador, empresa, RetornCreateFolder, Indice, nome, ColunaD, ColunaE_Dtdesligamento, ColunaF, ColunaG, ColunaH, ColunaI, ColunaJ, ColunaK, ColunaL, ColunaM, ColunaN, ColunaO, ColunaP)); } return("false"); } }
private void checkBox1TituloPastaAluno_CheckedChanged(object sender, EventArgs e) { try { var CategPastaAluno = textBox1CategPastaAluno.Text.Replace(" ", ""); if (CategPastaAluno != "" && CategPastaAluno != null) { if (checkBox1TituloPastaAluno.Checked == true) { checkBox2AtribPastaAluno.Checked = false; checkBox2Titulo.Checked = false; string msg = "Formar o titulo com o valores dos atributos"; sendText(msg); comboBox1PastaAlunos.Visible = false; label7Traço.Visible = false; comboBox1PastaAluno.Items.Clear(); comboBox2PastaAluno.Items.Clear(); comboBox3PastaAluno.Items.Clear(); comboBox1PastaAlunos.Items.Clear(); searchDocumentReturn searchDocumentReturn = new searchDocumentReturn(); searchDocumentFilter searchDocumentFilter = new searchDocumentFilter { IDCATEGORY = CategPastaAluno }; searchDocumentReturn = SeachDoc2.searchDocument(searchDocumentFilter, null, null); string id = searchDocumentReturn.RESULTS[0].IDDOCUMENT; searchDocumentReturn2 = SeachDoc2.viewDocumentData(id, "", "", ""); if (searchDocumentReturn2.IDDOCUMENT != null && searchDocumentReturn2.IDDOCUMENT != "") { foreach (var item in (searchDocumentReturn2.ATTRIBUTTES)) { comboBox1PastaAluno.Items.Add(item.ATTRIBUTTENAME); comboBox2PastaAluno.Items.Add(item.ATTRIBUTTENAME); comboBox3PastaAluno.Items.Add(item.ATTRIBUTTENAME); comboBox1PastaAlunos.Items.Add(item.ATTRIBUTTENAME); } } else { MessageBox.Show("Identificador não localizado \r ou \r Digitado errado!", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else if (checkBox1Atributos.Checked == false) { //comboBox1RecebAtrib.Items.Clear(); } } else { MessageBox.Show("Categoria não digitada!", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); checkBox1TituloPastaAluno.Checked = false; return; } } catch (Exception ex) { MessageBox.Show("Erro: " + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button1_Click(object sender, EventArgs e) { if (!Directory.Exists(logExcluirDocumentos)) { Directory.CreateDirectory(logExcluirDocumentos); } //Variaveis searchDocumentReturn searchDocumentReturn = new searchDocumentReturn(); SEClient SeachDoc = Conection.GetConnection(); var texto = ""; var CampoText = textBoxCateg.Text.Replace(" ", ""); if (Categoria.Checked) { try { listBox1DelDoc.Visible = true; listBox1DelDoc.Items.Clear(); if (CampoText != "" && CampoText != null) { searchDocumentFilter searchDocumentFilter = new searchDocumentFilter { IDCATEGORY = CampoText }; searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null); foreach (var item in (searchDocumentReturn.RESULTS)) { listBox1DelDoc.Items.Add(item.IDDOCUMENT + " - " + item.NMTITLE); } int total = searchDocumentReturn.RESULTS.Count(); DialogResult dr = MessageBox.Show("Total de arquivos " + total + ", Deseja realmente excluir? ", "..:: Atenção ::..", MessageBoxButtons.YesNo); switch (dr) { case DialogResult.No: break; case DialogResult.Yes: if (searchDocumentReturn.RESULTS.Count() > 0) { foreach (var item in (searchDocumentReturn.RESULTS)) { texto = @"Total de Registros: " + total + " Excluindo ... " + item.IDDOCUMENT; sendText(texto); string RetornDelete = DeleteDocument.DeletDocument(CampoText, item.IDDOCUMENT); total = total - 1; } MessageBox.Show("Concluido!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); textBoxCateg.Text = ""; sendText(""); } else { MessageBox.Show("Sem registro para excluir! \n ou \n Categoria Digitado errado", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } break; } } else { MessageBox.Show("Categoria não digitada!", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { File.AppendAllText(logExcluirDocumentos + @"\" + "log_erro_ExcluirDocumentos.txt", "\r\n" + DateTime.Now + @" |" + ex.Message.ToString() + @";"); MessageBox.Show(ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (Matricula.Checked) { if (CampoText != "" && CampoText != null) { try { listBox1DelDoc.Visible = true; listBox1DelDoc.Items.Clear(); var fileNameArray = Path.GetFileName(CampoText).ToString().Split(new char[] { Convert.ToChar(",") }); documentDataReturn documentDataReturn = new documentDataReturn(); foreach (var item in (fileNameArray)) { documentDataReturn = SeachDoc.viewDocumentData(item, "", "", ""); listBox1DelDoc.Items.Add(documentDataReturn.IDDOCUMENT + " - " + documentDataReturn.NMTITLE); } if (documentDataReturn.IDDOCUMENT != "" && documentDataReturn.IDDOCUMENT != null) { DialogResult dr = MessageBox.Show("Deseja realmente excluir? ", "..:: Atenção ::..", MessageBoxButtons.YesNo); switch (dr) { case DialogResult.No: break; case DialogResult.Yes: foreach (var item in (fileNameArray)) { var IdDoc = documentDataReturn.IDDOCUMENT; var IdCat = documentDataReturn.IDCATEGORY; texto = @" Excluindo ... " + IdDoc + @" - " + documentDataReturn.NMTITLE; sendText(texto); string RetornDelete = DeleteDocument.DeletDocument(IdCat, item); sendText(""); } MessageBox.Show("Concluido!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } listBox1DelDoc.Items.Clear(); ////if (RetornDelete == true) { // MessageBox.Show("Concluido!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); ////} } else { listBox1DelDoc.Visible = false; MessageBox.Show("\n Sem registro para Excluir! \n ou \n Registro Digitado errado!", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { File.AppendAllText(logExcluirDocumentos + @"\" + "log_erro_ExcluirDocumentos.txt", "\r\n" + DateTime.Now + @" |" + ex.Message.ToString() + @";"); MessageBox.Show(ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Registro não digitado!", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } }
private void button3_Click(object sender, EventArgs e) { try { int cont = 0; var categ = textBox1categ.Text.Replace(" ", ""); if (categ != "" && categ != null) { listBox1PSTsemDOC.Items.Clear(); sendText2(""); searchDocumentReturn searchDocumentReturn = new searchDocumentReturn(); searchDocumentFilter searchDocumentFilter = new searchDocumentFilter { IDCATEGORY = categ }; SEClient SeachDoc = Conection.GetConnection(); searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null); if (searchDocumentReturn.RESULTS.Count() > 0) { foreach (var item in (searchDocumentReturn.RESULTS)) { //documentDataReturn searchDocumentReturn2 = new documentDataReturn(); //SEClient SeachDoc2 = Conection.GetConnection(); searchDocumentReturn2 = SeachDoc2.viewDocumentData(item.IDDOCUMENT, "", "", ""); sendText2("Pesquisando... " + item.IDDOCUMENT); if (searchDocumentReturn2.ELECTRONICFILE.Count() == 0) { listBox1PSTsemDOC.Items.Add(item.IDDOCUMENT + " - " + item.NMTITLE); cont++; } } sendText2("Total de Documentos: " + cont); if (cont > 0) { DialogResult dr = MessageBox.Show("Deseja realmente excluir? ", "..:: Atenção ::..", MessageBoxButtons.YesNo); switch (dr) { case DialogResult.No: break; case DialogResult.Yes: foreach (var item in (searchDocumentReturn.RESULTS)) { searchDocumentReturn2 = SeachDoc2.viewDocumentData(item.IDDOCUMENT, "", "", ""); if (searchDocumentReturn2.ELECTRONICFILE.Count() == 0) { sendText3("Excluindo... " + searchDocumentReturn2.IDDOCUMENT + " - " + searchDocumentReturn2.NMTITLE); var RetornDelete = DeleteDocument.DeletDocument(searchDocumentReturn2.IDCATEGORY, searchDocumentReturn2.IDDOCUMENT); } } break; } MessageBox.Show("Finalizado Exclusão!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); sendText3(""); } } } else { MessageBox.Show("Digite a categoria !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { MessageBox.Show("Erro: " + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button1_Click(object sender, EventArgs e) { var matrORcat = RecMatricula.Text.Replace(" ", ""); if (CheckMatricula.Checked) { try { //DeletDocument(Matricula); if (matrORcat != "" && matrORcat != null) { //listBoxLista.Visible = true; listBoxLista.Items.Clear(); labelList.Text = ""; documentDataReturn searchDocumentReturn2 = new documentDataReturn(); SEClient SeachDoc2 = Conection.GetConnection(); searchDocumentReturn2 = SeachDoc2.viewDocumentData(matrORcat, "", "", ""); if (searchDocumentReturn2.IDDOCUMENT != null && searchDocumentReturn2.IDDOCUMENT != "") { listBoxLista.Visible = true; labelList.Text = ("MATRICULA: " + searchDocumentReturn2.IDDOCUMENT + "\r" + "NOME: " + searchDocumentReturn2.NMTITLE + "\r" + "CATEGORIA: " + searchDocumentReturn2.IDCATEGORY + " - " + searchDocumentReturn2.NMCATEGORY + "\r" + "DATA DE CRIAÇÃO: " + searchDocumentReturn2.DTDOCUMENT + "\r" + ".. :: Atributos::.. "); foreach (var item in (searchDocumentReturn2.ATTRIBUTTES)) { if (item.ATTRIBUTTEVALUE.Count() <= 0) { item.ATTRIBUTTEVALUE = null; listBoxLista.Items.Add(item.ATTRIBUTTENAME + " = " + ""); } else { listBoxLista.Items.Add(item.ATTRIBUTTENAME + " = " + item.ATTRIBUTTEVALUE[0]); } } } else { MessageBox.Show("Documento não localizado !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { MessageBox.Show("Digite a matricula !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { MessageBox.Show("Erro :" + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (Categoria.Checked) { try { if (matrORcat != "" && matrORcat != null) { listBoxLista.Visible = true; listBoxLista.Items.Clear(); searchDocumentReturn searchDocumentReturn = new searchDocumentReturn(); searchDocumentFilter searchDocumentFilter = new searchDocumentFilter { IDCATEGORY = matrORcat }; SEClient SeachDoc = Conection.GetConnection(); searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null); labelList.Text = "Total de Documentos: " + Convert.ToString(searchDocumentReturn.RESULTS.Count()); if (searchDocumentReturn.RESULTS.Count() > 0) { foreach (var item in (searchDocumentReturn.RESULTS)) { listBoxLista.Items.Add(item.IDDOCUMENT + " - " + item.NMTITLE); } } } else { MessageBox.Show("Digite a categoria !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { MessageBox.Show("Erro: " + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }