Пример #1
0
        public Search <ShelfLocationDto> Search(
            string queryParams = "",
            int limit          = Configurations.DefaultLimit,
            int page           = Configurations.DefaultPageValue,
            string sortColumn  = Configurations.DefaultOrder,
            bool descending    = false,
            bool count         = false)
        {
            var query = _shelfLocationRepository.Table;

            var searchParams = EnsureSearchQueryIsValid(queryParams, ResolveSearchQuery);

            if (searchParams != null)
            {
                query = query.HandleSearchParams(searchParams);
            }

            query = query.GetQuery(sortColumn, @descending);

            var _ = new SearchWrapper <ShelfLocationDto, ShelfLocation>();

            return(count
                ? _.ToCount(query)
                : _.ToList(query, page, limit,
                           list => list.Select(entity => entity.ToDto()).ToList() as IList <ShelfLocationDto>));
        }
Пример #2
0
        public BookingViewModel(IUnitOfWork unit, IEventAggregator eventAggregator,
                                IBookingCalculate calculationService,
                                ISearchGuestService searchGuestService,
                                IBookingFacade bookingFacade,
                                IRegionManager regionManager)
        {
            _unit = unit;
            _calculationService = calculationService;
            _searchGuestService = searchGuestService;
            _bookingFacade      = bookingFacade;
            _eventAggregator    = eventAggregator;

            _regionManager = regionManager;

            GuestResults = new ObservableCollection <Guest>();
            SearchRooms  = new SearchWrapper();
            Guest        = new GuestWrapper();

            SearchCommand = new DelegateCommand(SearchExecute, CanSearchExecute).ObservesCanExecute(() => SearchRooms.IsEnabled);
            BookCommand   = new DelegateCommand <object>(BookExecute, CanBookExecute).ObservesCanExecute(() => IsGuestFormValid);

            _eventAggregator.GetEvent <LoadEvent>().Subscribe(OnLoadEvent);

            Calculation.GetInstance().StayTypeChanged             += BookingViewModel_StayTypeChanged;
            SelectedRoomChange.GetInstance().RoomSelectionChanged += BookingViewModel_RoomSelectionChanged;
            SelectedGuestEvent.GetInstance().SelectedGuestChanged += OnSelectedGuestChange;

            SearchRooms.StateChanged += SearchRooms_StateChanged;
            Guest.StateChanged       += Guest_StateChanged;
        }
Пример #3
0
        public async Task <Search <T> > Search(
            string queryParams = "",
            int limit          = Configurations.DefaultLimit,
            int page           = Configurations.DefaultPageValue,
            string sortColumn  = Configurations.DefaultOrder,
            bool descending    = false,
            bool count         = false)
        {
            var repo = _worker.GetRepositoryAsync <E>();

            var query = await repo.GetQueryableAsync(searchFunc : src => src.SearchFunc(queryParams), queryExp : src => src.GetQuery(sortColumn, @descending), disableTracking : typeof(E).InitTracker(_lazyLoadEntities));

            var search = new SearchWrapper <T, E>();

            return(count
                ? search.ToCount(query)
                : search.ToList(query, page, limit, list => list.Select(entity => entity.ToDto <T, E>()).ToList()));
        }
Пример #4
0
        public IActionResult Match(string MatchMethod)
        {
            int?dogId = HttpContext.Session.GetInt32("CurrentDog");

            if (dogId == null)
            {
                return(RedirectToAction("Index"));
            }
            Dog CurrentDog         = _context.Dogs.Include(d => d.Preferences).ThenInclude(p => p.Filter).SingleOrDefault(dog => dog.DogId == dogId);
            IEnumerable <Dog> Dogs = _context.Dogs.Include(d => d.Interests).ThenInclude(di => di.Interest).Include(d => d.Humans).ThenInclude(f => f.Human).Include(d => d.Animals).ThenInclude(c => c.Animal).Where(d => d.DogId != dogId).ToList();

            foreach (var dog in Dogs)
            {
                dog.MatchPercent        = CalculateMatch(dog, CurrentDog);
                dog.ReverseMatchPercent = CalculateMatch(CurrentDog, dog);
            }
            List <Filter> SearchFilters = new List <Filter>();

            if (MatchMethod == "Match")
            {
                Dogs = Dogs.Where(d => d.MatchPercent >= 0.66666);
            }
            else if (MatchMethod == "Reverse")
            {
                Dogs = Dogs.Where(d => d.ReverseMatchPercent >= 0.66666);
            }
            else if (MatchMethod == "Mutual")
            {
                Dogs = Dogs.Where(d => d.ReverseMatchPercent >= 0.66666 && d.MatchPercent >= 0.66666);
            }
            Dogs = Dogs.OrderByDescending(d => d.MatchPercent);
            Dogs = RemoveBlockages(Dogs, CurrentDog);
            SearchWrapper SearchResults = new SearchWrapper(Dogs, SearchFilters);

            ViewBag.currDogId = dogId;
            return(View("Search", SearchResults));
        }
Пример #5
0
        protected override bool PerformDeviceLoad(string deviceId)
        {
            string ontSerial = "";

            // We can only build an ONT off of an ONT serial number or ONT Port serial number
            switch (DeviceLogic.GetDeviceTypeById(deviceId))
            {
                case DeviceTypeEnum.ONT: ontSerial = deviceId; break;
                case DeviceTypeEnum.ONTPort: ontSerial = DeviceLogic.DetermineONTSerial(deviceId); break;
                default: throw new ArgumentException("OPDL139: Invalid ONT Id or ONT Port Id. Can't create object.");
            }

            // Now that we have the serial number, perform the magnum search for the ONT and related ports
            SearchWrapper s = new SearchWrapper();
            s.SearchByDevice = new DeviceSearchWrapper();
            s.SearchByDevice.DeviceId = ontSerial;
            s.SearchType = SearchTypeEnum.SearchByDevice;
            List<SearchWrapper> results = null;
            DeviceWrapper device = new DeviceWrapper() { DeviceId = ontSerial };
            using (_magnumProxy = new MagnumProxy())
            {
                results = _magnumProxy.Client.Search(s, CurrentUser.AsRosettianUser().Name).ToList();
            }

            if (results.Count > 0)
            {
                // Using the results, assign values to the properties of our ONT object
                try
                {
                    PopulateFromSearchResults(results);
                }
                catch (ArgumentException)
                {
                    // do nothing (omits bad port from list of ports)
                }

                DeviceLoaded = true;
            }
            return DeviceLoaded;
        }
        public IntentInput GetInput(ItemContextParameters parameters, IConversation conversation)
        {
            var indexes = SearchWrapper.GetIndexNames().Concat(new[] { Translator.Text("Chat.Parameters.All") });

            return(IntentInputFactory.Create(IntentInputType.ListSearch, indexes.Select(a => new ListItem(a, a)).ToList()));
        }
Пример #7
0
        protected void LoadAndSetPortsList(List<SearchWrapper> results = null)
        {
            Boolean proceed = false;
            List<ONTPort> portList = new List<ONTPort>();

            // Create search objects
            //magnumHelper = new MagnumHelper();
            SearchWrapper srch = new SearchWrapper();
            srch.SearchByDevice = new DeviceSearchWrapper();
            srch.SearchType = SearchTypeEnum.SearchByDevice;

            // Determine Root ONT Serial number
            switch (DeviceLogic.GetDeviceTypeById(SerialNumber))
            {
                case DeviceTypeEnum.ONT:
                    {
                        proceed = true; // set proceed flag
                        srch.SearchByDevice.DeviceId = SerialNumber + "%"; // search for all ports for this ONT
                        break;
                    }
                case DeviceTypeEnum.ONTPort:
                    {
                        proceed = true; // set proceed flag
                        // get ONT serial from port ID, then get associated ports from Triad
                        srch.SearchByDevice.DeviceId = DeviceLogic.DetermineONTSerial(SerialNumber + "%");
                        break;
                    }
                default: break;
            }

            if (proceed)
            {
                // initialize individual portType lists (allows sorting into logical order --> voice, data, video
                List<ONTPort> voicePorts = new List<ONTPort>();
                List<ONTPort> dataPorts = new List<ONTPort>();
                List<ONTPort> mocaPorts = new List<ONTPort>();
                List<ONTPort> videoPorts = new List<ONTPort>();
                DeviceWrapper dev = new DeviceWrapper();
                SubscriberWrapper sub = new SubscriberWrapper();

                using (_magnumProxy = new MagnumProxy())
                {
                    // if no search wrapper was passed in, perform our own search
                    if (results == null)
                    {
                        results = _magnumProxy.Client.Search(srch, CurrentUser.AsRosettianUser().Name).ToList();
                    }

                    if (results.Count > 0)
                    {
                        dev = _magnumProxy.Client.LoadDevice(results[0].SearchByDevice.DeviceId, CurrentUser.AsRosettianUser().Name);
                    }
                }

                // once we have a definite result set, parse out the ports, assign the type and property values
                // from the search results
                foreach (SearchWrapper wrapper in results)
                {
                    ONTPort port = null;
                    // double check that we are working with an ONT Port
                    if (DeviceLogic.GetDeviceTypeById(wrapper.SearchByDevice.DeviceId) == DeviceTypeEnum.ONTPort)
                    {
                        // get new port from factory and add to correct type list
                        port = ONTPortFactory.GetONTPort(wrapper.SearchByDevice);
                        switch (port.PortType)
                        {
                            case ONTPortTypeEnum.Ethernet: dataPorts.Add(port); break;
                            case ONTPortTypeEnum.Moca: mocaPorts.Add(port); break;
                            case ONTPortTypeEnum.Video: videoPorts.Add(port); break;
                            case ONTPortTypeEnum.Voice: voicePorts.Add(port); break;
                        }
                    }
                }

                // internally order all port lists
                voicePorts = voicePorts.OrderBy(p => p.SerialNumber).ToList();
                dataPorts = dataPorts.OrderBy(p => p.SerialNumber).ToList();
                videoPorts = videoPorts.OrderBy(p => p.SerialNumber).ToList();
                mocaPorts = mocaPorts.OrderBy(p => p.SerialNumber).ToList();

                // add to main list in order of precedence
                portList.AddRange(voicePorts);
                portList.AddRange(dataPorts);
                portList.AddRange(videoPorts);
                portList.AddRange(mocaPorts);
            }

            Ports = portList;
        }
Пример #8
0
        public PartialViewResult SearchBox(SearchVm searchVm)
        {
            //searchVm.whereclause = (searchVm.whereclause == null ? "" : searchVm.whereclause);
            //searchVm.txtSearch = (searchVm.txtSearch == null ? "" : searchVm.txtSearch);
            //searchVm.SearchBy = (searchVm.SearchBy == null ? "" : searchVm.SearchBy);

            //var searchResultVm = new SearchResultVm()
            //{
            //    SearchByList = searchcolumnbo.GetCategoryList(searchVm.SearchTable),
            //    ListData = LoadData(searchVm)
            //};
            searchVm.whereclause = (searchVm.whereclause == null ? "" : searchVm.whereclause);
            searchVm.txtSearch   = (searchVm.txtSearch == null ? "" : searchVm.txtSearch);
            searchVm.SearchBy    = (searchVm.SearchBy == null ? "" : searchVm.SearchBy);

            var strSearchClause = "";

            if (searchVm.txtSearch.Trim().Length > 0)
            {
                if (searchVm.whereclause.Equals("LIKE"))
                {
                    strSearchClause = string.Format("{0} {1} N'%{2}%'", searchVm.SearchBy, searchVm.whereclause, searchVm.txtSearch.Trim());
                }
                else
                {
                    strSearchClause = string.Format("{0} {1} '{2}'", searchVm.SearchBy, searchVm.whereclause, searchVm.txtSearch.Trim());
                }
            }
            ////var searchResultVm = new SearchResultVm()
            ////{
            ////    SearchByList = searchcolumnbo.GetCategoryList(searchVm.SearchTable),
            ////    ListData = LoadData(searchVm)
            ////};


            var searchWrapper = new SearchWrapper();

            searchWrapper.SearchByList = new SearchColumnBO().GetCategoryList(searchVm.SearchTable);
            searchWrapper.searchVm     = searchVm;
            //IDataReader searchResult = null;
            //IList IList;
            switch (searchVm.SearchTable)
            {
            case SearchCategories.APINVOICE:
                var searchResultAPInvoice = new SearchResultVm <APInvoice>();
                List <APInvoice> lstSearchResultAPInvoice = SearchService.DataReaderMapToList <APInvoice>(new APInvoiceBO().PerformSearch(strSearchClause));
                searchResultAPInvoice.ListData      = lstSearchResultAPInvoice;
                searchResultAPInvoice.searchWrapper = searchWrapper;
                return(PartialView("_APInvoice", searchResultAPInvoice));

            case SearchCategories.ARINVOICE:
                var searchResultARInvoice = new SearchResultVm <ARInvoice>();
                List <ARInvoice> lstSearchResultARInvoice = SearchService.DataReaderMapToList <ARInvoice>(new ARInvoiceBO().PerformSearch(strSearchClause));
                searchResultARInvoice.ListData      = lstSearchResultARInvoice;
                searchResultARInvoice.searchWrapper = searchWrapper;
                return(PartialView("_ARInvoice", searchResultARInvoice));

            case SearchCategories.CBPAYMENT:
                var searchResultCBPayment = new SearchResultVm <CBPayment>();
                List <CBPayment> lstSearchResultCBPayment = SearchService.DataReaderMapToList <CBPayment>(new CBPaymentBO().PerformSearch(strSearchClause));
                searchResultCBPayment.ListData      = lstSearchResultCBPayment;
                searchResultCBPayment.searchWrapper = searchWrapper;
                return(PartialView("_CBPaymentSearchDialog", searchResultCBPayment));

            case SearchCategories.CBRECEIPT:
                var searchResultCBReceipt = new SearchResultVm <CBReceipt>();
                List <CBReceipt> lstSearchResultCBReceipt = SearchService.DataReaderMapToList <CBReceipt>(new CBReceiptBO().PerformSearch(strSearchClause));
                searchResultCBReceipt.ListData      = lstSearchResultCBReceipt;
                searchResultCBReceipt.searchWrapper = searchWrapper;
                return(PartialView("_CBReceiptSearchDialog", searchResultCBReceipt));

            case SearchCategories.GLJOURNAL:
                var searchResultGLJournal = new SearchResultVm <GLJournal>();
                List <GLJournal> lstSearchResultGLJournal = SearchService.DataReaderMapToList <GLJournal>(new GLJournalBO().PerformSearch(strSearchClause));
                searchResultGLJournal.ListData      = lstSearchResultGLJournal;
                searchResultGLJournal.searchWrapper = searchWrapper;
                return(PartialView("_GLJournalSearchDialog", searchResultGLJournal));



            //case SearchCategories.APINVOICE:
            //    List<APInvoice> customer = SearchService.DataReaderMapToList<APInvoice>(new APInvoiceBO().PerformSearch(""));

            //    return PartialView("APInvoice");

            /*
             * case SearchCategories.CUSTOMER:
             * case SearchCategories.ALLCUSTOMER:
             *  return PartialView("Customer", SearchService.Search<Customer>(searchVm));
             * case SearchCategories.COUNTRY:
             *  return PartialView("Country", SearchService.Search<Country>(searchVm));
             * case SearchCategories.CHARGECODE:
             *  return PartialView("ChargeCode", SearchService.Search<ChargeCodeMaster>(searchVm));
             *
             * case SearchCategories.FORWARDER:
             *  return PartialView("Forwarder", SearchService.Search<Forwarder>(searchVm));
             * case SearchCategories.HAULIER:
             *  return PartialView("Haulier", SearchService.Search<Haulier>(searchVm));
             * case SearchCategories.CONTAINERMASTER:
             *  return PartialView("ContainerMaster", SearchService.Search<ContainerMaster>(searchVm));
             * case SearchCategories.WOCONTAINERLIST:
             *  return PartialView("WOContainer", SearchService.Search<WOContainer>(searchVm));
             * case SearchCategories.TRUCKIN:
             *  return PartialView("TruckMovementHd", SearchService.Search<TruckMovementHd>(searchVm));
             * case SearchCategories.VESSEL:
             *  return PartialView("Vessel", SearchService.Search<Vessel>(searchVm));
             * case SearchCategories.PORT:
             * case SearchCategories.AREA:
             *  return PartialView("PortArea", SearchService.Search<PortArea>(searchVm));
             * case SearchCategories.VESSELSCHEDULE:
             *  //pending
             *  return PartialView("VesselSchedule", SearchService.Search<VesselSchedule>(searchVm));
             * case SearchCategories.BOOKINGVESSEL:
             *  return PartialView("BookingVessel", SearchService.Search<BookingVessel>(searchVm));
             * case SearchCategories.ORDER:
             *  return PartialView("Order", SearchService.Search<Order>(searchVm));
             * case SearchCategories.PENDINGMOVEMENTORDER:
             *  return PartialView("PendingMovementOrder", SearchService.Search<PendingMovementOrder>(searchVm));
             * case SearchCategories.RETRIEVEIMPORTLCLORDERS:
             *  return PartialView("RetrieveImportLCLOrders", SearchService.Search<RetrieveImportLCLOrders>(searchVm));
             * case SearchCategories.RETRIEVEEXPORTLCLORDERS:
             *  return PartialView("RetrieveExportLCLOrders", SearchService.Search<RetrieveExportLCLOrders>(searchVm));
             * case SearchCategories.TRUCKSINYARD:
             *  return PartialView("TrucksInYard", SearchService.Search<TrucksInYard>(searchVm));
             * case SearchCategories.QUOTATION:
             *  return PartialView("Quotation", SearchService.Search<Quotation>(searchVm));
             * case SearchCategories.TALLYIN:
             *  return PartialView("TallyIn", SearchService.Search<TallyIn>(searchVm));
             * case SearchCategories.TALLYOUT:
             *  return PartialView("TallyOut", SearchService.Search<TallyOut>(searchVm));
             * case SearchCategories.CYDIRECT:
             *  return PartialView("CYDirect", SearchService.Search<CYDirect>(searchVm));
             * case SearchCategories.TALLYINPENDINGQTY:
             *  return PartialView("TallyInPendingQty", SearchService.Search<TallyInPendingQty>(searchVm));
             * case SearchCategories.COSTSHEETVASCHARGES:
             *  return PartialView("CostSheetVASCharges", SearchService.Search<CostSheetVasCharges>(searchVm));
             * case SearchCategories.CASHINVOICE:
             *  return PartialView("CashInvoice", SearchService.Search<CashInvoice>(searchVm));
             * case SearchCategories.WORKORDERSEARCH:
             *  return PartialView("WorkOrder", SearchService.Search<WorkOrder>(searchVm));
             * /*
             * case SearchCategories.PORTROTATIONVESSELSEARCH:
             * case SearchCategories.PORTROTATIONVOYAGESEARCH:   */
            default:
                return(PartialView("Order"));
            }
        }
Пример #9
0
        public IActionResult Search()
        {
            int?dogId = HttpContext.Session.GetInt32("CurrentDog");

            if (dogId == null)
            {
                return(RedirectToAction("Index"));
            }
            Dog CurrentDog                  = _context.Dogs.Include(d => d.Preferences).ThenInclude(p => p.Filter).Include(d => d.BlockedDogs).Include(d => d.BlockingMe).SingleOrDefault(dog => dog.DogId == dogId);
            IEnumerable <Dog> Dogs          = _context.Dogs.Include(d => d.Interests).ThenInclude(di => di.Interest).Include(d => d.Humans).ThenInclude(f => f.Human).Include(d => d.Animals).ThenInclude(c => c.Animal).Where(d => d.DogId != dogId).ToList();
            List <Filter>     SearchFilters = HttpContext.Session.GetObjectFromJson <List <Filter> >("SearchFilters");

            if (SearchFilters != null)
            {
                foreach (var filter in SearchFilters)
                {
                    if (filter.Category == "Age")
                    {
                        if (filter.LinqFilter == "Puppy")
                        {
                            Dogs = from dog in Dogs
                                   where dog.Age <= 3
                                   select dog;
                        }
                        if (filter.LinqFilter == "Adult")
                        {
                            Dogs = from dog in Dogs
                                   where dog.Age > 3 && dog.Age < 10
                                   select dog;
                        }
                        if (filter.LinqFilter == "Senior")
                        {
                            Dogs = from dog in Dogs
                                   where dog.Age >= 10
                                   select dog;
                        }
                    }
                    else if (filter.Category == "Breed")
                    {
                        Dogs = from dog in Dogs
                               where dog.Breed == filter.UserFilter
                               select dog;
                    }
                    else if (filter.Category == "BodyType")
                    {
                        Dogs = from dog in Dogs
                               where dog.BodyType == filter.UserFilter
                               select dog;
                    }
                    else if (filter.Category == "HighestEducation")
                    {
                        Dogs = from dog in Dogs
                               where dog.HighestEducation == filter.UserFilter
                               select dog;
                    }
                    else if (filter.Category == "Barking")
                    {
                        Dogs = from dog in Dogs
                               where dog.Barking == filter.UserFilter
                               select dog;
                    }
                    else if (filter.Category == "Accidents")
                    {
                        Dogs = from dog in Dogs
                               where dog.Accidents == filter.UserFilter
                               select dog;
                    }
                }
                HttpContext.Session.SetObjectAsJson("SearchFilters", null);
            }
            foreach (var dog in Dogs)
            {
                dog.MatchPercent = CalculateMatch(dog, CurrentDog);
            }
            Dogs = RemoveBlockages(Dogs, CurrentDog);
            SearchWrapper SearchResults = new SearchWrapper(Dogs, SearchFilters);

            ViewBag.currDogId = dogId;
            return(View(SearchResults));
        }
Пример #10
0
        /// <summary>
        /// Public facing method to move a device to a location. Performs necessary validation before passing
        /// to protected method for actual device relocation in Triad.
        /// </summary>
        /// <param name="locId"></param>
        /// <returns>Returns true if successful</returns>
        public virtual Boolean MoveToLocation(string locId)
        {
            Boolean success = false;

            using (_magnumProxy = new MagnumProxy())
            {
                SearchWrapper srch = new SearchWrapper();
                srch.SearchByLocation = new LocationSearchWrapper();
                srch.SearchByLocation.LocationId = locId;
                srch.SearchType = SearchTypeEnum.SearchByLocation;
                SearchWrapper[] results = _magnumProxy.Client.Search(srch, CurrentUser.AsRosettianUser().Name);

                if (results.Length == 1) // if and only if one result is returned, move the device
                {
                    success = PerformLocationChange(locId);
                    if (success)
                    {
                        LocationId = locId;
                    }
                }
            }

            return success;
        }