/// <summary> /// Shows how to filter files during indexing /// Feature is supported in version 17.9.0 or greater of the API /// </summary> public static void FilterFilesDuringIndexing() { //ExStart:FilterFilesDuringIndexing // Creating indexing settings object IndexingSettings settings = new IndexingSettings(); // Creating filter that only passes files from 600 KB to 1 MB in length DocumentFilter byLength = DocumentFilter.CreateFileLengthRange(614400, 1048576); // Creating filter that only passes text files DocumentFilter byExtension = DocumentFilter.CreateFileExtension(".txt"); // Creating composite filter that only passes text files from 600 KB to 1 MB in length DocumentFilter compositeFilter = DocumentFilter.CreateConjunction(byLength, byExtension); // Setting filter settings.DocumentFilter = compositeFilter; // Creating index Index index = new Index(Utilities.indexPath, settings); // Indexing index.AddToIndex(Utilities.documentsPath); //ExEnd:FilterFilesDuringIndexing }
public List <IModel> Get(IModelFilter filter) { List <IModel> result = new List <IModel>(); DocumentFilter documentFilter = (DocumentFilter)filter; string query = "SELECT * FROM documents WHERE "; bool optionAdded = false; if (documentFilter.document_id.HasValue) { query += "document_id=" + documentFilter.document_id; optionAdded = true; } if (documentFilter.owner_id.HasValue) { if (optionAdded) { query += " and "; } query += "owner_id=" + documentFilter.owner_id; optionAdded = true; } if (documentFilter.type != null) { if (optionAdded) { query += " and "; } query += "type='" + documentFilter.type + "'"; optionAdded = true; } if (documentFilter.existence.HasValue) { if (optionAdded) { query += " and "; } query += "existence=" + documentFilter.existence; } DbDataReader reader = ExecuteReader(query); while (reader.Read()) { result.Add(new Document { document_id = (long)reader["document_id"], owner_id = (long)reader["owner_id"], existence = (bool)reader["existence"], type = (string)reader["type"] }); } RefreshDataReader(); return(result); }
public void FilterGetAllDocumentsIfNoOnlyNoParsedTest() { // Создаем поставщика var supplier = DataMother.CreateSupplier(); Save(supplier); var client = DataMother.CreateTestClientWithAddress(); Save(client); // Создаем много документов, чтобы не влезали на одну страницу for (int i = 0; i < 33; i++) { var documentLog = new DocumentReceiveLog(supplier); documentLog.ForClient = client; Save(documentLog); } // Создаем фильтр и устанавливаем параметр Только неразобранные var filter = new DocumentFilter(); filter.Supplier = supplier; filter.OnlyNoParsed = true; var documents = filter.Find(session); // должны получить документы в количестве равном одной странице Assert.That(documents.Count, Is.EqualTo(filter.PageSize)); // ищем все документы filter.OnlyNoParsed = false; documents = filter.Find(session); // должны получить документы в количестве большем одной страницы Assert.That(documents.Count, Is.GreaterThan(filter.PageSize)); }
public async Task <DocumentFilter> GetDocumentFilterAsync(long papmiRowId) { var typeFilters = new List <TypeFilter>(); var documents = await _medicalRecordRepository.GetDocumentsByPapmiRowIdAsync(papmiRowId); var documentsDocTypeDistList = documents.Select(d => d.DOCTYPE_Desc).Distinct().OrderBy(d => d).ToList(); foreach (var item in documentsDocTypeDistList) { var docs = documents.Where(dc => dc.DOCTYPE_Desc == item).ToList(); var typeFilter = new TypeFilter { TypeName = item, Documents = docs }; typeFilters.Add(typeFilter); } var documenFilter = new DocumentFilter() { TypeFilters = typeFilters }; return(documenFilter); }
public List <Document> GetDocuments(DocumentFilter filter) { using (var context = new SqlConnection(_connectionString)) { //Get list document StringBuilder sbSelect = new StringBuilder(); sbSelect.Append("SELECT Id "); sbSelect.Append(" ,CategoryId "); sbSelect.Append(" ,Title "); sbSelect.Append(" ,Description "); sbSelect.Append(" ,Cover "); sbSelect.Append(" ,PublishYear "); sbSelect.Append(" FROM Documents "); sbSelect.Append(" WHERE Title Collate Latin1_General_CI_AI LIKE N'%'+@keyword+'%' "); if (filter.CategoryId.HasValue) { sbSelect.Append(" AND CategoryId = @categoryId "); } sbSelect.Append(" ORDER BY Id DESC "); string querySelect = sbSelect.ToString(); List <Document> documents = context.Query <Document>(querySelect, new { keyword = filter.Keyword ?? string.Empty, categoryId = filter.CategoryId }).ToList(); return(documents); } }
public ActionResult <Document> FiltrableClient([FromBody] DocumentFilter filter) { filter.ruc_empresa_proveedor = new string[] { User.Identity.Name }; var temp = _iserviceDocument.filtrable(filter); return(Ok(temp)); }
public void NotParcedWaybills() { var filter = new DocumentFilter(); BindObjectInstance(filter, IsPost ? ParamStore.Form : ParamStore.QueryString, "filter", AutoLoadBehavior.NullIfInvalidKey); var documents = filter.FindStat(DbSession); PropertyBag["filter"] = filter; PropertyBag["documents"] = documents; }
public IEnumerable <Document> GetDocumentsByFilter(DocumentFilter filter, int page, int countPerPage) { var documents = _documentRepository.GetDocumentsByFilter(filter); return(documents.Skip((page - 1) * countPerPage) .Take(countPerPage) .ToList()); }
public IEnumerable <DocumentLiteModel> GetFiltredDocuments(DocumentFilter filter, int page, int countPerPage = 10) { return(_documentManager.GetDocumentsByFilter(filter, page, countPerPage) .Select(d => new DocumentLiteModel(d, string.Format($"{d.File.FileName}{d.File.FileExtension.ExtensionName}"), d.OwnerUser, d.ResponsibleUser, d.DocumentTags.Select(dt => dt.Tag))) .ToList()); }
public PipelineContext(PSDocumentOption option, IPipelineWriter writer, Action <IDocumentResult, bool> _Output, InstanceNameBinder instanceNameBinder) { Option = option; LanguageMode = option.Execution.LanguageMode.GetValueOrDefault(ExecutionOption.Default.LanguageMode.Value); Filter = DocumentFilter.Create(Option.Document.Include, Option.Document.Tag); Writer = writer; InstanceNameBinder = instanceNameBinder; _OutputVisitor = _Output; }
public void OnlyNoParsedReport() { var filter = new DocumentFilter(); var documents = filter.FindStat(session); var resultDoc = documents.FirstOrDefault(d => d.SupplierId == _supplier.Id); Assert.That(resultDoc.DocumentsCount, Is.EqualTo(1)); Assert.That(resultDoc.DocumentToClientsCount, Is.EqualTo(String.Format("{0}: {1}; ", _client.Name, 1))); }
public void Empty(string expected) { var model = new DocumentFilter(); var result = Fixture.SerializeObject(model); result.Should().Be(expected); var deresult = new Serializer(ClientVersion.Lsp3).DeserializeObject <DocumentFilter>(expected); deresult.Should().BeEquivalentTo(model); }
public FilterForm(DocumentFilter _df = null) { InitializeComponent(); if (_df != null) { Filter = _df; } else Filter = new DocumentFilter(); rtbWords.Lines = Filter.ToArray(); }
public void Empty(string expected) { var model = new DocumentFilter(); var result = Fixture.SerializeObject(model); result.Should().Be(expected); var deresult = JsonConvert.DeserializeObject <DocumentFilter>(expected); deresult.ShouldBeEquivalentTo(model); }
public PipelineContext(OptionContext option, PipelineStream stream, IPipelineWriter writer, Action <IDocumentResult, bool> _Output, InstanceNameBinder instanceNameBinder, string[] convention) { Option = option; LanguageMode = option.Execution.LanguageMode.GetValueOrDefault(ExecutionOption.Default.LanguageMode.Value); Filter = DocumentFilter.Create(option.Document.Include, option.Document.Tag); Stream = stream ?? new PipelineStream(null, null); Writer = writer; InstanceNameBinder = instanceNameBinder; _OutputVisitor = _Output; Convention = convention; Selector = new Dictionary <string, SelectorVisitor>(); }
public void OnlyLanguage(string expected) { var model = new DocumentFilter { Language = "csharp" }; var result = Fixture.SerializeObject(model); result.Should().Be(expected); var deresult = new LspSerializer(ClientVersion.Lsp3).DeserializeObject <DocumentFilter>(expected); deresult.Should().BeEquivalentTo(model); }
public void OnlyPattern(string expected) { var model = new DocumentFilter { Pattern = "123**" }; var result = Fixture.SerializeObject(model); result.Should().Be(expected); var deresult = new LspSerializer(ClientVersion.Lsp3).DeserializeObject <DocumentFilter>(expected); deresult.Should().BeEquivalentTo(model, x => x.UsingStructuralRecordEquality()); }
private void FilterMethod() { var filter = ComplexFilterParams as DocumentFilterParams; if (filter != null) { Filter = new DocumentFilter(filter); IsSearched = true; if (RefreshCommand != null) { RefreshCommand.Execute(null); } } }
public IActionResult ExportDataByProvider(DocumentFilter filter) { string filePath; filter.ruc_empresa_proveedor = new string[] { User.Identity.Name }; List <Document> doc = _iserviceDocument.filtrable(filter); string folderName = "Utilitarios"; create_excel _xls = new create_excel(_hostingEnvironment); filePath = _xls.crearExcel(doc); return(PhysicalFile(filePath, MimeTypes.GetMimeType(filePath), Path.GetFileName(filePath))); }
public MainForm() { InitializeComponent(); FormLog = new LogForm(); CurrentFilter = new DocumentFilter(); AddDocumentToGridDelegate = new AddDocumentGridDelegate(AddDocumentGrid); delShowStatusDelegate = new ShowStatusDelegate(ShowStatusMessage); if (File.Exists("config.xml")) { LoadFromConfig("config.xml"); //UpdateDocList(); } StopSearch = true; }
public bool Delete(IModelFilter filter) { try { DocumentFilter documentFilter = (DocumentFilter)filter; string query = "DELETE FROM documents WHERE "; bool optionAdded = false; if (documentFilter.document_id.HasValue) { query += "document_id=" + documentFilter.document_id; optionAdded = true; } if (documentFilter.owner_id.HasValue) { if (optionAdded) { query += " and "; } query += "owner_id=" + documentFilter.owner_id; optionAdded = true; } if (documentFilter.type != null) { if (optionAdded) { query += " and "; } query += "type='" + documentFilter.type + "'"; optionAdded = true; } if (documentFilter.existence.HasValue) { if (optionAdded) { query += " and "; } query += "existence=" + documentFilter.existence; } ExecuteNonQuery(query); } catch (Exception) { return(false); } return(true); }
bool DocumentsViewSourceFilter(object sender) { Document document = (Document)sender; bool isVisible = document.DocumentFolder != Folders.Trash && document.ContentType == ContentType.Attachment && document.IsImage == false; if (isVisible && DocumentFilter.IsInSearchMode) { isVisible = DocumentFilter.IsSearchVisible(document); } return(isVisible); }
public void Mixed(string expected) { var model = new DocumentFilter() { Pattern = "123**", Language = "csharp" }; var result = Fixture.SerializeObject(model); result.Should().Be(expected); var deresult = JsonConvert.DeserializeObject <DocumentFilter>(expected); deresult.ShouldBeEquivalentTo(model); }
public IQueryable <Document> GetDocumentsByFilter(DocumentFilter filter) { var query = from document in _context.Documents where (!filter.StartDate.HasValue || document.DeadLine >= filter.StartDate) && (!filter.EndDate.HasValue || document.DeadLine < filter.EndDate) && (!filter.StepId.HasValue || (int)document.StepId == filter.StepId.Value) && (!filter.DocumentTypeId.HasValue || (int)document.DocumentTypeId == filter.DocumentTypeId) && (!filter.IsResponsible || document.ResponsibleUserId.Contains(filter.UserId)) && (!filter.IsOwner || document.OwnerUserId.Contains(filter.UserId)) && (!(filter.DocumentNumber != null) || document.Number.ToLower().Contains(filter.DocumentNumber.ToLower())) select document; return(query); }
public void Full(string expected) { var model = new DocumentFilter { Pattern = "123**", Language = "csharp", Scheme = "abc" }; var result = Fixture.SerializeObject(model); result.Should().Be(expected); var deresult = new Serializer(ClientVersion.Lsp3).DeserializeObject <DocumentFilter>(expected); deresult.Should().BeEquivalentTo(model); }
public void OnlyNoParcedWithFakeTest() { _documentLog.IsFake = true; Save(_documentLog); Flush(); // создаем фильтр, устанавливаем в качестве параметра созданного поставщика и "искать только неразобранные" var filter = new DocumentFilter(); filter.Supplier = _supplier; filter.OnlyNoParsed = true; // ищем var documents = filter.Find(session); // не должны получить сохраненный выше документ из-за установленного IsFake Assert.That(documents.Count, Is.EqualTo(0)); }
public void OnlyNoParcedWithDocumentTest() { // создаем фильтр, устанавливаем в качестве параметра созданного поставщика и "искать только неразобранные" var filter = new DocumentFilter(); filter.Supplier = _supplier; filter.OnlyNoParsed = true; // создаем документ для лога var document = DataMother.CreateTestDocument(_supplier, _client, _documentLog); Save(document); // не должны выбрать запись лога, так как уже есть документ var documents = filter.Find(session); Assert.That(documents.Count, Is.EqualTo(0)); }
private void ClearFilterMethod() { Filter = new DocumentFilter(); ComplexFilterParams = new DocumentFilterParams(); InitFilter(); if (string.IsNullOrEmpty(SearchString)) { IsSearched = false; } if (RefreshCommand != null) { RefreshCommand.Execute(null); } }
public int addDocFilterIds(string projectID, string DocFilterIds, string Action) { string[] arr = DocFilterIds.Split(','); DocumentFilter doc = new DocumentFilter(); doc.ProjectID = Convert.ToInt32(projectID); doc.CanComment = Convert.ToBoolean(Action); try { for (int i = 0; i < arr.Length; i++) { string[] val = arr[i].Split('-'); if (val.Length > 1) { if (val[0] == "Department") { doc.DepartmentID = Convert.ToInt32(val[1]); } else if (val[0] == "TaskType") { doc.TaskTypeID = Convert.ToInt32(val[1]); } else if (val[0] == "Priority") { doc.PriorityID = Convert.ToInt32(val[1]); } else if (val[0] == "Milestone") { doc.MilestoneID = Convert.ToInt32(val[1]); } else if (val[0] == "Revision") { doc.RevisionID = Convert.ToInt32(val[1]); } } } doc.EntityState = EntityState.Added; AddDocumentFilters(doc); } catch (Exception ex) { throw ex; } return(doc.DocumentFiltersID); }
public DialogResult ShowDialog(DocumentFilter _df = null) { DocumentFilter df = _df; if (df ==null) df = new DocumentFilter(); rtbWords.Text = ""; foreach (string s in df) rtbWords.AppendText(s + "\r\n"); if (base.ShowDialog() == DialogResult.OK) { foreach (string s in rtbWords.Lines) if (!df.Contains(s.ToLower())) df.Add(s.ToLower()); } Filter = df; return DialogResult; }
public void Should_DealWithClassesThatImplementMultipleHandlers_BySettingKeyAccordingly() { var codeLensHandler = Substitute.For(new Type[] { typeof(ICodeLensHandler), typeof(ICodeLensResolveHandler) }, new object[0]); ((ICodeLensHandler)codeLensHandler).GetRegistrationOptions() .Returns(new CodeLensRegistrationOptions() { DocumentSelector = new DocumentSelector(DocumentFilter.ForLanguage("foo")) }); var handler = new SharedHandlerCollection(SupportedCapabilitiesFixture.AlwaysTrue, new TextDocumentIdentifiers()); handler.Add(codeLensHandler as IJsonRpcHandler); var descriptor = handler._handlers.Select(x => x.Key); descriptor.Should().BeEquivalentTo(new [] { "[foo]", "[foo]" }); }
public IActionResult Get(string documentName, DateTime?beginDate, DateTime?endDate, int top = 25) { if (string.IsNullOrWhiteSpace(documentName)) { throw new Exception("Try get catalog with out name"); } if (_service1C77.Metadata.Документы.TryGetValue(documentName, out var metadata)) { DocumentFilter documentFilter = new DocumentFilter { BeginPeriod = beginDate, EndPeriod = endDate, Top = top }; return(Ok(_service1C77.GetDocumentItems(metadata, documentFilter))); } else { throw new Exception($"The catlog {documentName} not exist in current config!"); } }
private void FillFilter() { var owners = (from item in FilterOwnerCheckList where item.IsChecked select item.Item).ToList(); var documentTypes = (from item in FilterDocumentTypeCheckList where item.IsChecked select item.Item).ToList(); FilterOwnerCount = owners.Count; FilterDocumentTypeCount = documentTypes.Count; ComplexFilterParams = new DocumentFilterParams { Owner = owners, DocumentType = documentTypes }; var complexFilterParams = ComplexFilterParams as DocumentFilterParams; Filter = new DocumentFilter(complexFilterParams); }
private void bFilter_Click(object sender, EventArgs e) { FilterForm ff = new FilterForm(); if (DialogResult.OK == ff.ShowDialog(CurrentFilter)) { CurrentFilter = ff.Filter; //if (SearchThread != null) //{ // StopSearch = true; //} if (StopSearch) { dgv.Rows.Clear(); StopSearch = false; SearchThread = new Thread(FilterDocList); SearchThread.IsBackground = true; SearchThread.Start(CurrentFilter); } } }