public void OgResultSearch() { var lotus = new Lotus(@"AppSrv74/U74/RND"); lotus.Init("123456"); var doc = lotus.SearchDocumentsByFormula("4525807B001D7F74", "[document_groupID] contains \"919DE51E60BD949E45258148002854EA\"").GetFirstDocument(); }
internal static bool LoadResultsFromSed(this OgDocument doc, Lotus lotus, string replicaId) { var results = lotus.SearchDocumentsByFormula(replicaId, $"[document_groupID] contains \"{doc.GroudId}\""); if (results.Count > 0) { var ogResult = OgResult.FromNotes(results.GetFirstDocument()); doc.Results = new[] { ogResult }; return(true); } return(false); }
public void LotusTestMethod() { var lotus = new Lotus(@"AppSrv74/U74/RND"); lotus.Init("123456"); var doc = lotus.SearchDocumentsByFormula("4525807B001CF66F", "[registration_number] contains \"1271-2/17-17\"").GetFirstDocument(); foreach (var attachment in lotus.GetAttachments(doc, "ответ")) { Assert.IsTrue(File.Exists(attachment)); File.Delete(attachment); } }
public void AssociationTestMethod() { var lotus = new Lotus(@"AppSrv74/U74/RND"); lotus.Init("123456"); var docs = lotus.SearchDocumentsByFormula("4525807B001CF66F", "[StatusId] contains \"in_file\" and [acceptance_date] > 01/06/2017 and [Form] contains \"doc_og\""); var totalCount = docs.Count; var ogDocuments = new List <OgDocument>(); for (var count = 1; count <= totalCount; count++) { var doc = docs.GetNthDocument(count); var ogDoc = OgDocument.FromNotes(doc); try { ogDoc.Attachments = lotus.GetAttachments(doc, "ответ") .Select(path => new Attachment(path)) .ToArray(); } catch (NoAttachmentException) { File.AppendAllText("log.txt", $"{ogDoc.Number} - отсутствуют вложения\n"); } ogDocuments.Add(ogDoc); } foreach (var ogDoc in ogDocuments) { try { ogDoc.LoadResultsFromSed(lotus, ""); } catch (Exception) { File.AppendAllText("log.txt", $"{ogDoc.Number} - ошибка при загрузке результатов\n"); } } foreach (var ogDoc in ogDocuments) { var isValid = ogDoc.ValidateResults(); if (!isValid) { File.AppendAllText("log.txt", $"{ogDoc.Number} - ошибка при валидации результатов\n"); } } Assert.IsTrue(ogDocuments.All(doc => doc.ValidateResults())); }
public IList <OgDocument> Get(string query) { if (!Lotus.IsInitialize) { Lotus.Init(LotusPass); } var docs = Lotus.SearchDocumentsByFormula(OgReplicaId, query); var ogDocuments = new List <OgDocument>(); for (var count = 1; count <= docs.Count; count++) { var doc = docs.GetNthDocument(count); OgDocument ogDoc = null; try { ogDoc = OgDocument.FromNotes(doc); } catch (NotImplementedException ex) { RaseNewMessage($"ERROR: Неожиданное значение при формировании документа. '{ex}'"); continue; } try { ogDoc.Attachments = Lotus.GetAttachments(doc, "ответ") .Select(path => new Attachment(path)) .ToArray(); } catch (NoAttachmentException) { RaseNewMessage($"WARNING: {ogDoc.Number} - отсутствуют вложения"); //continue; } RaseNewMessage($"{ogDoc.Number} - получен"); ogDocuments.Add(ogDoc); } foreach (var ogDoc in ogDocuments) { try { ogDoc.LoadResultsFromSed(Lotus, ResultReplicaId); RaseNewMessage($"Получен результат для {ogDoc.Number}"); } catch (DocumentsNotFoundException) { RaseNewMessage($"WARNING: {ogDoc.Number} - результат отсутствует"); } catch (Exception) { RaseNewMessage($"ERROR: {ogDoc.Number} - ошибка при загрузке результата"); } } foreach (var ogDoc in ogDocuments) { if (!ogDoc.ValidateResults()) { RaseNewMessage($"ERROR: {ogDoc.Number} - ошибка валидации результата"); } } return(ogDocuments); }