Ejemplo n.º 1
0
        public SearchViewModelTests()
        {
            var argParser       = Substitute.For <CommandLineArgParser>();
            var settingProvider = Substitute.For <ISettingsProvider>();

            viewModel = new SearchBarViewModel(argParser, settingProvider);
        }
        public MessageListViewModel(
            IEventAggregator eventAggregator,
            IWorkNotifier workNotifier,
            IServiceControl serviceControl,
            SearchBarViewModel searchBarViewModel,
            GeneralHeaderViewModel generalHeaderDisplay,
            MessageSelectionContext selectionContext,
            IClipboard clipboard,
            ISettingsProvider settingsProvider)
        {
            SearchBar = searchBarViewModel;
            Selection = selectionContext;

            this.clipboard            = clipboard;
            this.settingsProvider     = settingsProvider;
            this.eventAggregator      = eventAggregator;
            this.workNotifier         = workNotifier;
            this.serviceControl       = serviceControl;
            this.generalHeaderDisplay = generalHeaderDisplay;

            Items.Add(SearchBar);

            RetryMessageCommand  = new RetryMessageCommand(eventAggregator, workNotifier, serviceControl);
            CopyMessageIdCommand = new CopyMessageURICommand(clipboard, serviceControl);
            CopyHeadersCommand   = Command.Create(CopyHeaders,
                                                  generalHeaderDisplay.Changed
                                                  .Where(pc => pc.PropertyName == nameof(GeneralHeaderViewModel.HeaderContent))
                                                  .Select(s => !((string)s.Value).IsEmpty()));
            Rows = new BindableCollection <StoredMessage>();
        }
        // GET: Customer
        //public ActionResult Index()
        //{
        //    HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Customers").Result;
        //    var userList = response.Content.ReadAsAsync<IEnumerable<ApplicationUser>>().Result;
        //    return View(userList);
        //}

        public ActionResult Index(string search = "", string option = "")
        {
            if (search.Equals(""))
            {
                HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync("Customers").Result;
                var userList  = response.Content.ReadAsAsync <IEnumerable <ApplicationUser> >().Result;
                var viewModel = new SearchBarViewModel
                {
                    ApplicationUsers = userList
                };
                return(View(viewModel));
            }
            else
            {
                if (option.Equals("Email"))
                {
                    var users     = _context.Users.Where(c => c.Email.Equals(search)).ToList();
                    var viewModel = new SearchBarViewModel
                    {
                        ApplicationUsers = users
                    };
                    return(View(viewModel));
                }

                else if (option.Equals("PhoneNumber"))
                {
                    //try
                    //{
                    //var searchMobile = Convert.ToDouble(search);
                    var users     = _context.Users.Where(c => c.PhoneNumber.Equals(search)).ToList();
                    var viewModel = new SearchBarViewModel
                    {
                        ApplicationUsers = users
                    };
                    return(View(viewModel));
                    //}
                    //catch
                    //{
                    //    var users = _context.Users.ToList();
                    //    var viewModel = new SearchBarViewModel
                    //    {
                    //        ApplicationUsers = users,
                    //        CheckInteger = 1
                    //    };
                    //    return View(viewModel);

                    //}
                }

                else
                {
                    var users     = _context.Users.Where(c => c.FirstName.Equals(search)).ToList();
                    var viewModel = new SearchBarViewModel
                    {
                        ApplicationUsers = users
                    };
                    return(View(viewModel));
                }
            }
        }
Ejemplo n.º 4
0
        public MessageFlowViewModel(
            IServiceControl serviceControl,
            IEventAggregator eventAggregator,
            IWindowManagerEx windowManager,
            SearchBarViewModel searchBar,
            MessageListViewModel messageList,
            Func <ExceptionDetailViewModel> exceptionDetail,
            ISettingsProvider settingsProvider,
            EndpointExplorerViewModel endpointExplorer,
            IClipboard clipboard)
        {
            this.serviceControl   = serviceControl;
            this.eventAggregator  = eventAggregator;
            this.windowManager    = windowManager;
            this.settingsProvider = settingsProvider;
            this.messageList      = messageList;
            this.endpointExplorer = endpointExplorer;
            this.exceptionDetail  = exceptionDetail;

            CopyConversationIDCommand = new CopyConversationIDCommand(clipboard);
            CopyMessageURICommand     = new CopyMessageURICommand(clipboard, serviceControl);
            SearchByMessageIDCommand  = new SearchByMessageIDCommand(eventAggregator, searchBar);
            RetryMessageCommand       = new RetryMessageCommand(eventAggregator, serviceControl);

            Diagram = new MessageFlowDiagram();
            nodeMap = new ConcurrentDictionary <string, MessageNode>();
        }
        public SearchViewModelTests()
        {
            var argParser = Substitute.For<CommandLineArgParser>();
            var settingProvider = Substitute.For<ISettingsProvider>();

            viewModel = new SearchBarViewModel(argParser, settingProvider);
        }
Ejemplo n.º 6
0
        public MessageListViewModel(
            IEventAggregator eventAggregator,
            IServiceControl serviceControl,
            SearchBarViewModel searchBarViewModel,
            GeneralHeaderViewModel generalHeaderDisplay,
            IClipboard clipboard)
        {
            this.clipboard            = clipboard;
            this.eventAggregator      = eventAggregator;
            this.serviceControl       = serviceControl;
            this.generalHeaderDisplay = generalHeaderDisplay;

            SearchBar = searchBarViewModel;
            Items.Add(SearchBar);

            RetryMessageCommand  = new RetryMessageCommand(eventAggregator, serviceControl);
            CopyMessageIdCommand = new CopyMessageURICommand(clipboard, serviceControl);

            CopyHeadersCommand = this.CreateCommand(CopyHeaders, generalHeaderDisplay.WhenAnyValue(ghd => ghd.HeaderContent).Select(s => !s.IsEmpty()));

            Rows = new BindableCollection <StoredMessage>();

            this.WhenAnyValue(vm => vm.FocusedRow)
            .Throttle(TimeSpan.FromMilliseconds(500), RxApp.MainThreadScheduler)
            .Subscribe(_ => DoFocusedRowChanged());
        }
 public MemberManagementViewModel()
 {
     RegisterPageMemberModel = new MemberModel();
     ListPageMemberModel     = new MemberModel();
     TreeItemModel           = new TreeItemModel();
     SearchBar = new SearchBarViewModel();
     TreeViewMaker.InitializeTreeView(TreeItemModel);
 }
Ejemplo n.º 8
0
        public override void InitViewModels()
        {
            ItemsTree = new BasicTreeViewModel();
            ItemsTree.InitViewModels();
            ItemsTree.InitCommands();

            AddItemBar = new AddItemBarViewModel();
            SearchBar  = new SearchBarViewModel();
            SearchBar.InitViewModels();
        }
        public SearchViewModelTests()
        {
            var argParser       = Substitute.For <CommandLineArgParser>();
            var settingProvider = Substitute.For <ISettingsProvider>();

            // ReSharper disable once UnusedVariable
            // required for async command
            var dispatcher = Dispatcher.CurrentDispatcher;

            viewModel = new SearchBarViewModel(argParser, settingProvider);
        }
 public void TestInitialize()
 {
     EventAggregator = Substitute.For <IEventAggregator>();
     ServiceControl  = Substitute.For <IServiceControl>();
     SearchBar       = Substitute.For <SearchBarViewModel>();
     Clipboard       = Substitute.For <IClipboard>();
     MessageListFunc = () => new MessageListViewModel(EventAggregator,
                                                      ServiceControl,
                                                      SearchBar,
                                                      Substitute.For <GeneralHeaderViewModel>(),
                                                      Clipboard);
 }
 public void TestInitialize()
 {
     eventAggregator = Substitute.For <IEventAggregator>();
     serviceControl  = Substitute.For <IServiceControl>();
     searchBar       = Substitute.For <SearchBarViewModel>();
     clipboard       = Substitute.For <IClipboard>();
     messageListFunc = () => new MessageListViewModel(eventAggregator,
                                                      serviceControl,
                                                      searchBar,
                                                      Substitute.For <GeneralHeaderViewModel>(),
                                                      Substitute.For <MessageSelectionContext>(),
                                                      clipboard);
 }
Ejemplo n.º 12
0
        public SearchViewModel(ISearchServiceProxy proxy, SearchType searchType)
        {
            _searchType = searchType;
            _proxy = proxy;

            _searchBarViewModel = new SearchBarViewModel(searchType);

            _searchBarViewModel.IsSegmented = false;

            _searchBarViewModel.PropertyChanged += _searchBarViewModel_PropertyChanged;

            _searchBarViewModel.SearchStarted += _searchBarViewModel_SearchStarted;
            _searchBarViewModel.SearchCancelled += _searchBarViewModel_SearchCancelled;
        }
Ejemplo n.º 13
0
        // GET: Customer
        public ActionResult Index(string search = "", string option = "")
        {
            //var cust = _context.Customers.ToList();
            //return View(cust);
            //var cust = _context.Customers.ToList();
            //return View(cust);
            if (search.Equals(""))
            {
                var users     = _context.Users.ToList();
                var viewModel = new SearchBarViewModel
                {
                    Users = users
                };
                return(View(viewModel));
            }
            else
            {
                if (option.Equals("Email"))
                {
                    var users     = _context.Users.Where(c => c.Email.Equals(search)).ToList();
                    var viewModel = new SearchBarViewModel
                    {
                        Users = users
                    };
                    return(View(viewModel));
                }

                else if (option.Equals("PhoneNumber"))
                {
                    // var searchMobile = Convert.ToDouble(search);
                    var users     = _context.Users.Where(c => c.PhoneNumber.Equals(search)).ToList();
                    var viewModel = new SearchBarViewModel
                    {
                        Users = users
                    };
                    return(View(viewModel));
                }

                else
                {
                    var users     = _context.Users.Where(c => c.FirstName.Equals(search)).ToList();
                    var viewModel = new SearchBarViewModel
                    {
                        Users = users
                    };
                    return(View(viewModel));
                }
            }
        }
 public void TestInitialize()
 {
     eventAggregator = Substitute.For<IEventAggregator>();
     workNotifier = Substitute.For<IWorkNotifier>();
     serviceControl = Substitute.For<IServiceControl>();
     searchBar = Substitute.For<SearchBarViewModel>();
     clipboard = Substitute.For<IClipboard>();
     messageListFunc = () => new MessageListViewModel(
         eventAggregator,
         workNotifier,
         serviceControl,
         searchBar,
         Substitute.For<GeneralHeaderViewModel>(),
         Substitute.For<MessageSelectionContext>(),
         clipboard);
 }
        public SequenceDiagramViewModel(
            IClipboard clipboard,
            IEventAggregator eventAggregator,
            IWindowManagerEx windowManager,
            IServiceControl serviceControl,
            Func <ExceptionDetailViewModel> exceptionDetailViewModel,
            SearchBarViewModel searchBar,
            EndpointExplorerViewModel endpointExplorer,
            MessageListViewModel messageList)
        {
            this.windowManager            = windowManager;
            this.eventAggregator          = eventAggregator;
            this.serviceControl           = serviceControl;
            this.exceptionDetailViewModel = exceptionDetailViewModel;

            CopyConversationIDCommand = new CopyConversationIDCommand(clipboard);
            CopyMessageURICommand     = new CopyMessageURICommand(clipboard, serviceControl);
            RetryMessageCommand       = new RetryMessageCommand(eventAggregator, serviceControl);
            SearchByMessageIDCommand  = new SearchByMessageIDCommand(eventAggregator, searchBar);
            ShowSagaCommand           = new ShowSagaCommand(eventAggregator, endpointExplorer, messageList);
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> Search([FromQuery] SearchBarViewModel model)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(model.SearchName) && model.Value == 0)
                {
                    return(View());
                }

                var result = await this.barService.SearchAsync(model.SearchName, model.SearchByName, model.SearchByAddress, model.SearchByRating, model.Value);

                model.SearchResults = result.Select(b => this.searchBarVmMapper.MapFrom(b)).ToList();

                return(View(model));
            }
            catch (Exception)
            {
                this.toastNotification.AddWarningToastMessage("Something went wrong, please try again");
                return(View());
            }
        }
Ejemplo n.º 17
0
        public MessageListViewModel(
            IEventAggregator eventAggregator,
            IServiceControl serviceControl,
            SearchBarViewModel searchBarViewModel,
            GeneralHeaderViewModel generalHeaderDisplay,
            MessageSelectionContext selectionContext,
            IClipboard clipboard)
        {
            this.SearchBar = searchBarViewModel;
            this.Selection = selectionContext;

            this.clipboard            = clipboard;
            this.eventAggregator      = eventAggregator;
            this.serviceControl       = serviceControl;
            this.generalHeaderDisplay = generalHeaderDisplay;

            Items.Add(SearchBar);

            RetryMessageCommand  = new RetryMessageCommand(eventAggregator, serviceControl);
            CopyMessageIdCommand = new CopyMessageURICommand(clipboard, serviceControl);
            CopyHeadersCommand   = this.CreateCommand(CopyHeaders, generalHeaderDisplay.WhenAnyValue(ghd => ghd.HeaderContent).Select(s => !s.IsEmpty()));
            Rows = new BindableCollection <StoredMessage>();
        }
 public SearchByMessageIDCommand(IEventAggregator eventAggregator, SearchBarViewModel searchBar)
 {
     this.eventAggregator = eventAggregator;
     this.searchBar = searchBar;
 }
Ejemplo n.º 19
0
 public SearchByMessageIDCommand(IEventAggregator eventAggregator, SearchBarViewModel searchBar)
 {
     this.eventAggregator = eventAggregator;
     this.searchBar       = searchBar;
 }
Ejemplo n.º 20
0
        public IActionResult ProductsFromCategoryNavbarSearch(SearchBarViewModel viewModel)
        {
            var model = this.productsService.GetAllProductsFromCategory(viewModel.Name);

            return(this.View("All", model));
        }
Ejemplo n.º 21
0
 public SearchBarPage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     BindingContext = _viewModel = new SearchBarViewModel();
 }
Ejemplo n.º 22
0
 public IViewComponentResult Invoke(SearchBarViewModel searchBarViewModel)
 {
     return(View(searchBarViewModel));
 }
Ejemplo n.º 23
0
 public SearchBarView(SearchBarViewModel model)
 {
     this.searchBar = model;
     InitializeComponent();
     this.DataContext = model;
 }
        public UI_SearchBarView()
        {
            InitializeComponent();

            BindingContext = new SearchBarViewModel();
        }
 public void TestInitialize()
 {
     ArgParser = Substitute.For<CommandLineArgParser>();
     SettingProvider = Substitute.For<ISettingsProvider>();
     ViewModel = new SearchBarViewModel(ArgParser, SettingProvider);
 }
Ejemplo n.º 26
0
 public void TestInitialize()
 {
     argParser       = Substitute.For <CommandLineArgParser>();
     settingProvider = Substitute.For <ISettingsProvider>();
     viewModel       = new SearchBarViewModel(argParser, settingProvider);
 }
 public void TestInitialize()
 {
     EventAggregator = Substitute.For<IEventAggregator>();
     ServiceControl = Substitute.For<IServiceControl>();
     SearchBar = Substitute.For<SearchBarViewModel>();
     Clipboard = Substitute.For<IClipboard>();
     MessageListFunc = () => new MessageListViewModel(EventAggregator,
                                            ServiceControl,
                                            SearchBar,
                                            Substitute.For<GeneralHeaderViewModel>(),
                                            Clipboard);
 }