Exemplo n.º 1
0
        /// <summary>
        /// Searches the specified search term.
        /// </summary>
        /// <param name="searchType">Startup type of the search.</param>
        /// <param name="searchTerm">The search term.</param>
        /// <param name="showUIForEmptyResult">if set to <c>true</c> then show UI even when result is empty.</param>
        /// <returns>
        /// Selected result if found, null otherwise.
        /// </returns>
        public ISearchResult Search(SearchType searchType, string searchTerm, bool showUIForEmptyResult)
        {
            SearchResult    result    = null;
            SearchViewModel viewModel = new SearchViewModel(searchType, searchTerm);

            viewModel.ExecuteSearch();

            // We will not show the UI for emtpy result if not requested.
            if (showUIForEmptyResult ||
                viewModel.Results.Count > 0 ||
                viewModel.SearchTerms.Length < viewModel.MinimumSearchTermLengh)
            {
                result = new SearchResult();

                using (frmSmartSearch searchForm = new frmSmartSearch(viewModel))
                {
                    POSFormsManager.ShowPOSForm(searchForm);

                    if (searchForm.DialogResult == DialogResult.OK)
                    {
                        result.SearchType = (SearchResultType)viewModel.SelectedResult.SearchType;
                        result.Number     = viewModel.SelectedResult.Number;
                    }
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        private void Search()
        {
            // Get the results
            viewModel.ExecuteSearch();

            // Select the top grid row
            gridView.MoveFirst();

            // Move focus back to the seach TextBox
            textBoxSearch.Select();

            UpdateNavigationButtons();
        }
Exemplo n.º 3
0
        public ActionResult Delete(SearchViewModel model)
        {
            model.Initialize(NoteStorage);

            model.Delete();

            if (ModelState.IsValid)
            {
                model.ExecuteSearch();
            }

            return(PartialView("SearchPartial", model));
        }
Exemplo n.º 4
0
        public ActionResult Search(SearchViewModel model)
        {
            model.Initialize(NoteStorage);

            if (model.PeriodStart >= model.PeriodEnd)
            {
                ModelState.AddModelError(nameof(model.PeriodEnd), "Period end date must be greater than start.");
            }
            else if (ModelState.IsValid)
            {
                model.ExecuteSearch();
            }

            return(View("Search", model));
        }