public static string DeletDocument(string IDCATEGORY, string IdDocumento) { try { string Justificativa = "Exclusão Documento"; SEClient DeletDoc = Conection.GetConnection(); string RetornoDelet = DeletDoc.deleteDocument(IDCATEGORY, IdDocumento, "", Justificativa); File.AppendAllText(logExcluirDocumentos + @"\" + "log_ExcluirDocumentos.txt", "\r\n" + DateTime.Now + @" | Deletado Documento " + IdDocumento + @" " + RetornoDelet.Substring(3).ToString() + @";"); IDDelDoc = 1; if (RetornoDelet.Contains("1:")) { return("Sucesso"); } else { return("false"); } } catch (Exception ex) { while (IDDelDoc <= 2) { IDDelDoc++; Thread.Sleep(Convert.ToInt32(5000)); File.AppendAllText(logExcluirDocumentos + @"\" + "log_erro_Excluir_Documentos.txt", "\r\n" + DateTime.Now + @" | " + ex.Message.ToString() + @";"); return(DeletDocument(IDCATEGORY, IdDocumento)); } return("false"); } }
public bool DeleteDocument(string documentId) { try { //Checks whether the document exists documentDataReturn documentDataReturn = GetDocumentProperties(documentId); //If the document already exists in the specified category, it deletes the document if (documentDataReturn.IDDOCUMENT == documentId) { string deleteDocument = seClient.deleteDocument(documentDataReturn.IDCATEGORY, documentDataReturn.IDDOCUMENT, "", messageDeleteDocument); } else if (!string.IsNullOrEmpty(documentDataReturn.ERROR)) { throw new Exception(documentDataReturn.ERROR); } return(true); } catch (Exception ex) { throw ex; } }