Пример #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string[] fill = SearchFunctions.fill_ID(globalConnection, studentID);
            selectRoom.Visibility = Visibility.Hidden;

            switch (fill[0])
            {
            case "S": fillST(fill); type = "S"; break;

            case "O": fillOL(fill); type = "O"; break;

            case "SE": fill_e_ST(fill); type = "SE"; break;

            case "OE": fill_e_OL(fill); type = "OE"; break;
            }

            /*if (fill[0] == "S")
             * {
             *  fillST(fill);
             *  type = "S";
             * }
             * else
             *  if (fill[0] == "O")
             *  {
             *      fillOL(fill);
             *      type = "O";
             *  }*/
        }
Пример #2
0
        // POST api/values
        //public String Post([FromBody]Models.InputItem Content)
        //{
        //    return Content.ItemName + Content.ItemQuality.ToString() + Content.ItemQuality.ToString();
        //}

        public List <Models.InputItem> Post([FromBody] List <Models.InputItem> JsonString)
        {
            SearchFunctions functions = new SearchFunctions();



            // Loop through all inputs
            for (var i = 0; i < JsonString.Count; i++)
            {
                // Begin check if value is valid
                if (functions.isValidItem(JsonString[i].ItemName))
                {
                    int QualityChangeVal;

                    QualityChangeVal = functions.GetAmendment(JsonString[i].ItemName, JsonString[i].ItemValue);

                    JsonString[i].ItemQuality = functions.SetQuality(JsonString[i].ItemQuality, QualityChangeVal);

                    // Overwrite for SOAP, only item not to decrease in SellIn Value
                    if (JsonString[i].ItemName.ToLower() != "soap")
                    {
                        JsonString[i].ItemValue--;
                    }
                }
                else
                {
                    // Not a valid item, change item name to correspond to that
                    JsonString[i].ItemName    = "Invalid Item";
                    JsonString[i].ItemQuality = 0;
                    JsonString[i].ItemValue   = 0;
                }
            }

            return(JsonString);
        }
Пример #3
0
        private void livingSerch()
        {
            switch (livingParam.SelectedIndex)
            {
            case (-1): commonSearch(); break;

            case (0): livingTable.ItemsSource = SearchFunctions.search_byFIOall(globalConnection, serchString.Text, (bool)CheckBox1.IsChecked); break;

            case (1): courseSearch(); break;

            case (2): try { livingTable.ItemsSource = SearchFunctions.search_ByID(globalConnection, serchString.Text.ToString()); }
                catch { MessageBox.Show("Неверный формат номера студенческого билета"); } break;

            case (3): livingTable.ItemsSource = SearchFunctions.search_ByRoomNumber(globalConnection, serchString.Text.ToString()); break;

            case (4): if (Citizenship.SelectedIndex != -1)
                {
                    citizenSearch();
                }
                break;

            case (5): livingTable.ItemsSource = SearchFunctions.search_ByDecreeNumber(globalConnection, serchString.Text.ToString()); break;

            case (6): searchByStayLimit(); break;
            }
        }
Пример #4
0
        private void fillST(string[] res)
        {
            infoLabel.Visibility = Visibility.Hidden;
            info.Visibility      = Visibility.Hidden;
            faculty.IsEnabled    = true;
            course.IsEnabled     = true;
            form.IsEnabled       = true;
            id.IsEnabled         = true;

            gender = res[5];

            surname.Text       = res[1];
            name.Text          = res[2];
            patronymic.Text    = res[3];
            id.Text            = res[4];
            course.Text        = res[7];
            roomNumber.Content = res[8];
            phone.Text         = res[10];
            decree.Text        = res[11];

            faculty.SelectedValue     = res[6];
            form.SelectedValue        = res[13];
            citizenship.SelectedValue = SearchFunctions.convertToShortCitizenship(globalConnection, res[15]);

            date.SelectedDate            = Convert.ToDateTime(res[9]);
            decreeDate.SelectedDate      = Convert.ToDateTime(res[12]);
            stayLimit.SelectedDate       = Convert.ToDateTime(res[14]);
            inspire.Visibility           = Visibility.Hidden;
            evictionDate.Visibility      = Visibility.Hidden;
            evictionDateLabel.Visibility = Visibility.Hidden;
        }
Пример #5
0
        private void roomTypeSearch()
        {
            string t = "";

            switch (type.SelectedValue.ToString())
            {
            case ("Мужская"): t = "m"; break;

            case ("Женская"): t = "f"; break;

            case ("Семейная"): t = "c"; break;
            }

            roomTable.ItemsSource = SearchFunctions.searchRoom_ByType(globalConnection, t, (bool)CheckBox2.IsChecked, (bool)checkBox3.IsChecked);
        }
Пример #6
0
        private void courseSearch()
        {
            string faculty = "";
            string form    = "";

            if (studentFac.SelectedValue != null)
            {
                faculty = studentFac.SelectedValue.ToString();
            }
            if (Form.SelectedValue != null)
            {
                form = Form.SelectedValue.ToString();
            }

            livingTable.ItemsSource = SearchFunctions.search_byCourse(globalConnection, serchString.Text.ToString(), (bool)CheckBox1.IsChecked, faculty, form, (bool)evictedP.IsChecked);
        }
Пример #7
0
        private void citizenSearch()
        {
            string faculty = "";
            string form    = "";

            if (studentFac.SelectedValue != null)
            {
                faculty = studentFac.SelectedValue.ToString();
            }
            if (Form.SelectedValue != null)
            {
                form = Form.SelectedValue.ToString();
            }

            livingTable.ItemsSource = SearchFunctions.search_ByCitizenship(globalConnection, SearchFunctions.convertToFullCitizenship(globalConnection, Citizenship.Text.ToString()), (bool)CheckBox1.IsChecked, (bool)CheckBox2.IsChecked, faculty, form, (bool)evictedP.IsChecked);
        }
Пример #8
0
        private void roomSearch()
        {
            switch (roomParam.SelectedIndex)
            {
            case (-1): roomTable.ItemsSource = SearchFunctions.commonRoomSearch(globalConnection, (bool)CheckBox1.IsChecked, (bool)CheckBox2.IsChecked, (bool)checkBox3.IsChecked); break;

            case (0): roomTable.ItemsSource = SearchFunctions.searchRoomByNumber(globalConnection, serchString.Text); break;

            case (1): roomTable.ItemsSource = SearchFunctions.searchRoom_ByPlaces(globalConnection, serchString.Text, (bool)CheckBox1.IsChecked, (bool)CheckBox2.IsChecked, (bool)checkBox3.IsChecked); break;

            case (2): roomTable.ItemsSource = SearchFunctions.searchRoom_ByFplaces(globalConnection, serchString.Text, fPlaces()); break;

            case (3): if (type.SelectedIndex != -1)
                {
                    roomTypeSearch();
                }
                break;
            }
        }
Пример #9
0
        static async Task Main(string[] args)
        {
            /*Setting up*/
            var builder = new ConfigurationBuilder();

            BuildConfig(builder);
            var configuration = builder.Build();

            /*Get Settings for APIs*/
            var bingSettings = new Searcher();

            configuration.GetSection("Searchers:Bing").Bind(bingSettings);

            var googleSettings = new Searcher();

            configuration.GetSection("Searchers:Google").Bind(googleSettings);

            /*Get Settings for APIs*/
            List <ISearcher> SearcherList = new List <ISearcher>();

            if (bingSettings.Active == 1)
            {
                SearcherList.Add(new BingSearcher(SearcherSettingsMapper.Map(bingSettings)));
            }
            if (googleSettings.Active == 1)
            {
                SearcherList.Add(new GoogleSearcher(SearcherSettingsMapper.Map(googleSettings)));
            }

            /*Values to Search*/
            args = new string[] { "java", "ayuda", "java", "JSON" };


            Console.WriteLine("Searching .....");
            ISearchFunctions searchFunctions           = new SearchFunctions(SearcherList.ToArray());
            Dictionary <string, SearchResults> results = searchFunctions.ExecuteSeach(args.Distinct()).Result;

            Console.WriteLine("Searching Done");
            DisplayResults(results);
            Console.ReadLine();
        }
Пример #10
0
        private void searchByStayLimit()
        {
            string faculty = "";
            string form    = "";
            string sl      = "";

            if (stayLimitComboBox.SelectedIndex != -1)
            {
                sl = stayLimitComboBox.SelectedValue.ToString();
            }
            if (studentFac.SelectedIndex != -1)
            {
                faculty = studentFac.SelectedValue.ToString();
            }
            if (Form.SelectedIndex != -1)
            {
                form = Form.SelectedValue.ToString();
            }

            livingTable.ItemsSource = SearchFunctions.search_byStayLimit(globalConnection, sl, (bool)CheckBox1.IsChecked, (bool)CheckBox2.IsChecked, faculty, form);
        }
Пример #11
0
        public static List <Trade> FindTrades(TaskStatus status, SearchFunctions SearchFunction)
        {
            var Trades = new List <Trade>();

            var SystemsInReach = (from system in GlobalData.Systems
                                  where (system.Coordinates - UserData.System.Coordinates).Length < UserData.Max_Travel_Distance
                                  select system).ToList();

            for (int i = 0; i < SystemsInReach.Count; i++)
            {
                status.Progress         = (int)((double)(i + 1) / (double)SystemsInReach.Count * 100);
                status.ProcessedObjects = Trades.Count;
                var SystemPool = (from system in GlobalData.Systems
                                  where (system.Coordinates - SystemsInReach[i].Coordinates).Length < UserData.Max_Jump_Distance * UserData.Max_Route_Length
                                  select system).ToList();

                List <Trade> newTrades = null;
                switch (SearchFunction)
                {
                case SearchFunctions.Default:
                    newTrades = Rules.Check(SystemsInReach[i], SystemPool);
                    break;

                case SearchFunctions.ImperialSlavePowerplay:
                    newTrades = Rules.CheckImpSlave(SystemsInReach[i], SystemPool);
                    break;
                }

                if (newTrades != null)
                {
                    // Condense
                    for (int c = 0; c < newTrades.Count; c++)
                    {
                        foreach (var oldTrade in Trades)
                        {
                            if (newTrades.Count <= 0)
                            {
                                continue;
                            }

                            if ((newTrades[c].Start == oldTrade.End &&
                                 newTrades[c].End == oldTrade.Start) ||
                                (newTrades[c].End == oldTrade.End &&
                                 newTrades[c].Start == oldTrade.Start))
                            {
                                newTrades.RemoveAt(c);
                            }
                        }
                    }

                    Trades.AddRange(newTrades);

                    Trade[] aTrades = new Trade[Trades.Count];
                    Trades.CopyTo(aTrades);
                    status.Tag1 = aTrades.ToList();
                }

                if (status.CancelRequest)
                {
                    i = SystemsInReach.Count;
                    status.Progress      = 100;
                    status.CancelRequest = false;

                    /*if(Trades.Count > UserData.stopAfterTrades)
                     * {
                     *  var difference = Trades.Count - UserData.stopAfterTrades;
                     *  Trades.RemoveRange(Trades.Count - 1 - difference, difference);
                     * }*/
                }
            }



            return(Trades);
        }
Пример #12
0
        public async void MobyManualMatch(bool AutoMatchOnSingle100Score)
        {
            var mySettings = new MetroDialogSettings()
            {
                NegativeButtonText = "Cancel Scraping",
                AnimateShow        = false,
                AnimateHide        = false,
            };

            var controller = await mw.ShowProgressAsync("Attempting manual match based on word count - mobygames to thegamesdb", "", settings : mySettings);

            controller.SetCancelable(true);
            await Task.Delay(100);



            await Task.Run(() =>
            {
                Task.Delay(1);
                int progress = 0;

                List <Junction> jList = new List <Junction>();

                List <MasterView> unmatched = (from a in MasterView.GetMasterView()
                                               where a.mid == null
                                               select a).ToList();

                controller.Minimum = 0;
                controller.Maximum = unmatched.Count();
                int co             = unmatched.Count();

                int matched    = 0;
                int notmatched = 0;

                controller.SetProgress(progress);
                controller.SetMessage("TOTAL: " + co + "\n\nMatched: " + matched + "\nUnmatched: " + notmatched);

                List <int[]> list = new List <int[]>();

                List <MOBY_Game> mgames = MOBY_Game.GetGames().ToList();

                bool cancel = false;

                foreach (MasterView m in unmatched)
                {
                    if (cancel == true)
                    {
                        break;
                    }

                    controller.SetProgress(progress);
                    controller.SetMessage("TOTAL: " + co + "\n\nMatched: " + matched + "\nUnmatched: " + notmatched);
                    progress++;
                    int gid = m.gid;
                    int pid = m.pid;

                    // build SearchObject
                    SearchObject so = new SearchObject();
                    so.searchId     = gid;
                    so.searchString = m.GDBTitle.Trim();
                    so.listToSearch = (from a in mgames
                                       where a.pid == pid
                                       select new SearchList {
                        id = a.mid, name = a.gameTitle
                    }).ToList();

                    // get search results
                    so = SearchFunctions.WordCountMatch(so);

                    // get results list separately
                    List <SearchResult> results = so.searchResults.OrderByDescending(a => a.score).ToList();

                    // if automatch on unique 100 score is selected
                    if (AutoMatchOnSingle100Score)
                    {
                        var hundreds = results.Where(a => a.score == 100).ToList();
                        if (hundreds.Count == 1)
                        {
                            Junction j = new Junction();
                            j.gid      = gid;
                            j.mid      = hundreds.First().resultId;
                            jList.Add(j);
                            matched++;
                            //controller.SetMessage("Saving to Database...");
                            //Junction.SaveToDatabase(jList);
                            //jList = new List<Junction>();
                            continue;
                        }
                        else
                        {
                            notmatched++;
                            continue;
                        }
                    }
                    else
                    {
                        // iterate through each result and prompt user to accept / as for next result / or skip completely
                        foreach (var res in results)
                        {
                            string title     = "Matching " + m.PlatformAlias + " - " + m.GDBTitle;
                            StringBuilder sb = new StringBuilder();
                            sb.Append("Potential match found for " + m.GDBTitle + " \n(" + m.PlatformAlias + "): ");
                            sb.Append(res.resultString);
                            sb.Append("\n\n");
                            sb.Append("Word score: " + res.score);
                            sb.Append("\n\n\n");
                            sb.Append("Press YES to accept this match and save to the database\n");
                            sb.Append("Press NO to show the next match for this entry\n");
                            sb.Append("Press CANCEL to skip this entirely and move to the next search object");
                            MessageBoxResult mbr = MessageBox.Show(sb.ToString(), title, MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.None, MessageBoxOptions.DefaultDesktopOnly);

                            if (mbr == MessageBoxResult.Yes)
                            {
                                // match has been confirmed. create a junction record
                                Junction j = new Junction();
                                j.gid      = gid;
                                j.mid      = res.resultId;
                                jList.Add(j);
                                matched++;
                                controller.SetMessage("Saving to Database...");
                                Junction.SaveToDatabase(jList);
                                jList = new List <Junction>();
                                break;
                            }
                            if (mbr == MessageBoxResult.No)
                            {
                                continue;
                            }
                            if (mbr == MessageBoxResult.Cancel)
                            {
                                break;
                            }
                            if (mbr == MessageBoxResult.None)
                            {
                                cancel = true;
                                break;
                            }
                        }
                    }

                    controller.SetProgress(progress);
                    controller.SetMessage("TOTAL: " + co + "\n\nMatched: " + matched + "\nUnmatched: " + notmatched);
                }

                if (AutoMatchOnSingle100Score)
                {
                    controller.SetMessage("Saving to Database...");
                    Junction.SaveToDatabase(jList);
                }
            });

            await controller.CloseAsync();

            if (controller.IsCanceled)
            {
                await mw.ShowMessageAsync("ExactMatch Matching", "Operation Cancelled");
            }
            else
            {
                await mw.ShowMessageAsync("ExactMatch Matching", "Scanning and Import Completed");
            }
        }
Пример #13
0
        public static void Search(string textToFind)
        {
            if (Options == null)
            {
                return;
            }

            if (textToFind == "NONE_SPECIFIED")
            {
                textToFind = Options.FindText;
            }

            Options.FindText = textToFind;
            SearchHelper.RunFind();

            if (SearchHelper.FoundLocations.Count == 0)
            {
                return;
            }

            if (CurrentIndex < 0)
            {
                CurrentIndex = 0;
            }

            if (CurrentIndex < SearchHelper.FoundLocations.Count - 1)
            {
                CurrentIndex++;
            }
            else if (SearchHelper.FoundLocations.Count >= 0)
            {
                CurrentIndex = 0;
            }

            bool found;

            // We now have a collection of indexes, so let's look for the actual words
            switch (searchFunctions)
            {
            case SearchFunctions.CurrentFunction:
                if (ContentItems.Templates.CurrentFile == null)
                {
                    return;
                }

                if (SearchHelper.FoundLocations.Count > 0 && SearchHelper.FoundLocations[0].ScriptFile != ContentItems.Templates.CurrentFile)
                {
                    scope           = SearchHelper.Scope.Both;
                    searchFunctions = SearchHelper.SearchFunctions.AllFunctions;
                    SearchHelper.RunFind();
                }
                SyntaxEditor editor          = ContentItems.Templates.Instance.SyntaxEditor;
                int          currentStartPos = editor.SelectedView.Selection.StartOffset + 1;
                CurrentIndex = -1;
                found        = false;

                for (int foundLocIndex = 0; foundLocIndex < SearchHelper.FoundLocations.Where(l => l.ScriptFile == ContentItems.Templates.CurrentFile).Count(); foundLocIndex++)
                {
                    if (CurrentIndex < 0)
                    {
                        CurrentIndex = foundLocIndex;
                    }

                    CurrentIndex = foundLocIndex;

                    if (SearchHelper.FoundLocations[foundLocIndex].StartPos > currentStartPos)
                    {
                        CurrentIndex = foundLocIndex;
                        found        = true;
                        break;
                    }
                }
                if (!found)
                {
                    CurrentIndex = 0;
                }

                if (CurrentIndex < 0)
                {
                    return;
                }

                editor.SelectedView.Selection.StartOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos;
                editor.SelectedView.Selection.EndOffset   = SearchHelper.FoundLocations[CurrentIndex].StartPos + SearchHelper.FoundLocations[CurrentIndex].Length;
                break;

            case SearchFunctions.AllFunctions:                    // This is just highlighting the text in all open functions
                // Make sure highlighting starts from the currently selected position
                CurrentIndex = -1;
                found        = false;

                if (ContentItems.Templates.CurrentFile != null)
                {
                    int selectedPos = ContentItems.Templates.Instance.SyntaxEditor.SelectedView.Selection.StartOffset + ContentItems.Templates.Instance.SyntaxEditor.SelectedView.Selection.Length;

                    if (SearchHelper.FoundLocations.Count > 0)
                    {
                        for (int i = 0; i < SearchHelper.FoundLocations.Count; i++)
                        {
                            if (SearchHelper.FoundLocations[i].ScriptFile == ContentItems.Templates.CurrentFile)
                            {
                                if (CurrentIndex < 0)
                                {
                                    CurrentIndex = i;
                                }

                                CurrentIndex = i;

                                if (SearchHelper.FoundLocations[i].StartPos > selectedPos)
                                {
                                    found = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (!found && SearchHelper.FoundLocations.Where(l => l.ScriptFile != ContentItems.Templates.CurrentFile).Count() > 0)
                {
                    if (CurrentIndex < SearchHelper.FoundLocations.Count - 1)
                    {
                        CurrentIndex++;
                    }
                    else
                    {
                        CurrentIndex = 0;
                    }

                    ContentItems.Templates.Instance.SelectFile(SearchHelper.FoundLocations[CurrentIndex].ScriptFile);
                }
                ContentItems.Templates.Instance.SyntaxEditor.SelectedView.Selection.StartOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos;
                ContentItems.Templates.Instance.SyntaxEditor.SelectedView.Selection.EndOffset   = SearchHelper.FoundLocations[CurrentIndex].StartPos + SearchHelper.FoundLocations[CurrentIndex].Length;
                break;

            default:
                throw new NotImplementedException("Not coded yet.");
            }
        }
Пример #14
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            if (searchClass == 0)
            {
                serchString.Visibility = Visibility.Hidden;

                CheckBox1.Visibility = Visibility.Hidden;
                CheckBox2.Visibility = Visibility.Hidden;

                LivingLabel1.Visibility = Visibility.Hidden;
                livingLabel2.Visibility = Visibility.Hidden;
                livingLabel3.Visibility = Visibility.Hidden;
                livingLabel4.Visibility = Visibility.Hidden;

                livingParam.Visibility = Visibility.Hidden;
                roomParam.Visibility   = Visibility.Hidden;

                Citizenship.Visibility = Visibility.Hidden;

                studentFac.Visibility = Visibility.Hidden;
                Form.Visibility       = Visibility.Hidden;

                livingTable.Visibility  = Visibility.Hidden;
                clearFilters.Visibility = Visibility.Hidden;

                roomLable1.Visibility = Visibility.Hidden;
                roomLabel2.Visibility = Visibility.Hidden;

                roomTable.Visibility = Visibility.Hidden;
                type.Visibility      = Visibility.Hidden;

                checkBox3.Visibility  = Visibility.Hidden;
                roomLabel3.Visibility = Visibility.Hidden;

                roomLabel4.Visibility = Visibility.Hidden;
                roomPlaces.Visibility = Visibility.Hidden;

                arcTable.Visibility = Visibility.Hidden;
                arcParam.Visibility = Visibility.Hidden;

                stayLimitLabel1.Visibility   = Visibility.Hidden;
                stayLimitLabel2.Visibility   = Visibility.Hidden;
                stayLimitComboBox.Visibility = Visibility.Hidden;
                stayLimitLabel3.Visibility   = Visibility.Hidden;

                evictedP.Visibility = Visibility.Hidden;

                arcDate1.Visibility  = Visibility.Hidden;
                arcDate2.Visibility  = Visibility.Hidden;
                arcLabel1.Visibility = Visibility.Hidden;
                arcLabel2.Visibility = Visibility.Hidden;
            }

            if (searchClass == 1)
            {
                serchString.Visibility = Visibility.Hidden;

                CheckBox1.Visibility = Visibility.Visible;
                CheckBox2.Visibility = Visibility.Visible;

                LivingLabel1.Visibility = Visibility.Visible;
                livingLabel2.Visibility = Visibility.Visible;
                livingLabel3.Visibility = Visibility.Visible;
                livingLabel4.Visibility = Visibility.Visible;

                livingParam.Visibility = Visibility.Visible;
                roomParam.Visibility   = Visibility.Hidden;

                Citizenship.Visibility = Visibility.Hidden;

                studentFac.Visibility = Visibility.Visible;
                Form.Visibility       = Visibility.Visible;

                livingTable.Visibility  = Visibility.Visible;
                clearFilters.Visibility = Visibility.Visible;

                roomLable1.Visibility = Visibility.Hidden;
                roomLabel2.Visibility = Visibility.Hidden;

                roomTable.Visibility = Visibility.Hidden;
                type.Visibility      = Visibility.Hidden;

                checkBox3.Visibility  = Visibility.Hidden;
                roomLabel3.Visibility = Visibility.Hidden;

                roomLabel4.Visibility = Visibility.Hidden;
                roomPlaces.Visibility = Visibility.Hidden;

                arcTable.Visibility = Visibility.Hidden;
                arcParam.Visibility = Visibility.Hidden;

                stayLimitLabel1.Visibility   = Visibility.Hidden;
                stayLimitLabel2.Visibility   = Visibility.Hidden;
                stayLimitComboBox.Visibility = Visibility.Hidden;
                stayLimitLabel3.Visibility   = Visibility.Hidden;

                arcDate1.Visibility  = Visibility.Hidden;
                arcDate2.Visibility  = Visibility.Hidden;
                arcLabel1.Visibility = Visibility.Hidden;
                arcLabel2.Visibility = Visibility.Hidden;

                evictedP.Visibility = Visibility.Visible;
                evictedP.IsEnabled  = false;

                CheckBox1.IsChecked       = true;
                Search.SelectedIndex      = 0;
                livingParam.SelectedIndex = -1;
                livingTable.ItemsSource   = SearchFunctions.commonSearch(globalConnection, true, false, "", "", false);
            }

            if (searchClass == 2)
            {
                serchString.Visibility = Visibility.Hidden;

                CheckBox1.Visibility = Visibility.Visible;
                CheckBox2.Visibility = Visibility.Visible;

                LivingLabel1.Visibility = Visibility.Hidden;
                livingLabel2.Visibility = Visibility.Visible;
                livingLabel3.Visibility = Visibility.Visible;
                livingLabel4.Visibility = Visibility.Visible;

                livingParam.Visibility = Visibility.Visible;
                roomParam.Visibility   = Visibility.Hidden;

                Citizenship.Visibility = Visibility.Hidden;

                studentFac.Visibility = Visibility.Visible;
                Form.Visibility       = Visibility.Visible;

                livingTable.Visibility  = Visibility.Visible;
                clearFilters.Visibility = Visibility.Visible;

                roomLable1.Visibility = Visibility.Hidden;
                roomLabel2.Visibility = Visibility.Hidden;

                roomTable.Visibility = Visibility.Hidden;
                type.Visibility      = Visibility.Hidden;

                checkBox3.Visibility  = Visibility.Hidden;
                roomLabel3.Visibility = Visibility.Hidden;

                roomLabel4.Visibility = Visibility.Hidden;
                roomPlaces.Visibility = Visibility.Hidden;

                arcTable.Visibility = Visibility.Hidden;
                arcParam.Visibility = Visibility.Hidden;

                stayLimitLabel1.Visibility   = Visibility.Visible;
                stayLimitLabel2.Visibility   = Visibility.Visible;
                stayLimitComboBox.Visibility = Visibility.Visible;
                stayLimitLabel3.Visibility   = Visibility.Visible;

                arcDate1.Visibility  = Visibility.Hidden;
                arcDate2.Visibility  = Visibility.Hidden;
                arcLabel1.Visibility = Visibility.Hidden;
                arcLabel2.Visibility = Visibility.Hidden;

                evictedP.Visibility = Visibility.Visible;

                stayLimitComboBox.IsEnabled = false;
                CheckBox1.IsChecked         = true;
                Search.SelectedIndex        = 0;
                livingParam.SelectedIndex   = 6;
                livingTable.ItemsSource     = SearchFunctions.search_byStayLimit(globalConnection, "", true, false, "", "");
            }

            if (searchClass == 3)
            {
                serchString.Visibility = Visibility.Hidden;

                CheckBox1.Visibility = Visibility.Visible;
                CheckBox2.Visibility = Visibility.Visible;

                LivingLabel1.Visibility = Visibility.Visible;
                livingLabel2.Visibility = Visibility.Visible;
                livingLabel3.Visibility = Visibility.Visible;
                livingLabel4.Visibility = Visibility.Visible;

                livingParam.Visibility = Visibility.Visible;
                roomParam.Visibility   = Visibility.Hidden;

                Citizenship.Visibility = Visibility.Hidden;

                studentFac.Visibility = Visibility.Visible;
                Form.Visibility       = Visibility.Visible;

                livingTable.Visibility  = Visibility.Visible;
                clearFilters.Visibility = Visibility.Visible;

                roomLable1.Visibility = Visibility.Hidden;
                roomLabel2.Visibility = Visibility.Hidden;

                roomTable.Visibility = Visibility.Hidden;
                type.Visibility      = Visibility.Hidden;

                checkBox3.Visibility  = Visibility.Hidden;
                roomLabel3.Visibility = Visibility.Hidden;

                roomLabel4.Visibility = Visibility.Hidden;
                roomPlaces.Visibility = Visibility.Hidden;

                arcTable.Visibility = Visibility.Hidden;
                arcParam.Visibility = Visibility.Hidden;

                stayLimitLabel1.Visibility   = Visibility.Hidden;
                stayLimitLabel2.Visibility   = Visibility.Hidden;
                stayLimitComboBox.Visibility = Visibility.Hidden;
                stayLimitLabel3.Visibility   = Visibility.Hidden;

                arcDate1.Visibility  = Visibility.Hidden;
                arcDate2.Visibility  = Visibility.Hidden;
                arcLabel1.Visibility = Visibility.Hidden;
                arcLabel2.Visibility = Visibility.Hidden;

                evictedP.Visibility = Visibility.Visible;
                evictedP.IsEnabled  = true;
                evictedP.IsChecked  = true;

                CheckBox1.IsChecked       = false;
                Search.SelectedIndex      = 0;
                livingParam.SelectedIndex = -1;
                livingTable.ItemsSource   = SearchFunctions.search_exEvicted(globalConnection);
                //livingTable.ItemsSource = SearchFunctions.commonSearch(globalConnection, true, false, "", "", false);
            }
        }
Пример #15
0
 public SearchFunctionsTests()
 {
     _function = new SearchFunctions(_client.Object);
 }
Пример #16
0
        public static void Search(string textToFind)
        {
            if (Options == null)
                return;

            if (textToFind == "NONE_SPECIFIED")
            {
                textToFind = Options.FindText;
            }
            Options.FindText = textToFind;
            SearchHelper.RunFind();
            if (SearchHelper.FoundLocations.Count == 0)
            {
                return;
            }
            if (CurrentIndex < 0) { CurrentIndex = 0; }

            if (CurrentIndex < SearchHelper.FoundLocations.Count - 1)
            {
                CurrentIndex++;
            }
            else if (SearchHelper.FoundLocations.Count >= 0)
            {
                CurrentIndex = 0;
            }
            bool found;

            // We now have a collection of indexes, so let's look for the actual words
            switch (searchFunctions)
            {
                case SearchFunctions.CurrentFunction:
                    ucFunction currentFunctionPage = Controller.Instance.MainForm.UcFunctions.GetCurrentlyDisplayedFunctionPage();

                    if (currentFunctionPage == null)
                    {
                        return;
                    }
                    if (SearchHelper.FoundLocations.Count > 0 &&
                        SearchHelper.FoundLocations[0].Function != currentFunctionPage.CurrentFunction)
                    {
                        scope = SearchHelper.Scope.Both;
                        searchFunctions = SearchHelper.SearchFunctions.AllFunctions;
                        SearchHelper.RunFind();
                    }
                    SyntaxEditor editor = currentFunctionPage.syntaxEditor1;
                    int currentStartPos = editor.SelectedView.Selection.StartOffset + 1;
                    CurrentIndex = -1;
                    found = false;

                    for (int foundLocIndex = 0; foundLocIndex < SearchHelper.FoundLocations.Count; foundLocIndex++)
                    {
                        if (SearchHelper.FoundLocations[foundLocIndex].Function == currentFunctionPage.CurrentFunction)
                        {
                            if (CurrentIndex < 0) { CurrentIndex = foundLocIndex; }

                            CurrentIndex = foundLocIndex;

                            if (SearchHelper.FoundLocations[foundLocIndex].StartPos > currentStartPos)
                            {
                                CurrentIndex = foundLocIndex;
                                found = true;
                                break;
                            }
                        }
                    }
                    if (!found) { CurrentIndex = 0; }

                    if (CurrentIndex < 0)
                    {
                        return;
                    }
                    editor.SelectedView.Selection.StartOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos;
                    editor.SelectedView.Selection.EndOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos + SearchHelper.FoundLocations[CurrentIndex].Length;
                    break;
                case SearchFunctions.OpenFunctions:
                case SearchFunctions.AllFunctions:// This is just highlighting the text in all open functions
                    // Make sure highlighting starts from the currently selected position
                    CurrentIndex = -1;
                    ucFunction currentFunctionPage2 = Controller.Instance.MainForm.UcFunctions.GetCurrentlyDisplayedFunctionPage();
                    found = false;

                    if (currentFunctionPage2 != null)
                    {
                        int selectedPos = currentFunctionPage2.syntaxEditor1.SelectedView.Selection.StartOffset + currentFunctionPage2.syntaxEditor1.SelectedView.Selection.Length;

                        if (SearchHelper.FoundLocations.Count > 0)
                        {
                            for (int i = 0; i < SearchHelper.FoundLocations.Count; i++)
                            {
                                if (SearchHelper.FoundLocations[i].Function == currentFunctionPage2.CurrentFunction)
                                {
                                    if (CurrentIndex < 0) { CurrentIndex = i; }

                                    CurrentIndex = i;

                                    if (SearchHelper.FoundLocations[i].StartPos > selectedPos)
                                    {
                                        found = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (!found)
                    {
                        if (SearchHelper.FoundLocations.Count > 0)
                        {
                            if (CurrentIndex < SearchHelper.FoundLocations.Count - 1)
                            {
                                CurrentIndex++;
                            }
                            else
                            {
                                CurrentIndex = 0;
                            }
                        }
                    }
                    for (int i = 0; i < Controller.Instance.MainForm.UcFunctions.tabStrip1.Tabs.Count; i++)
                    {
                        if (Controller.Instance.MainForm.UcFunctions.GetFunctionScreenByTabIndex(i).CurrentFunction == SearchHelper.FoundLocations[CurrentIndex].Function)
                        {
                            Controller.Instance.MainForm.UcFunctions.tabStrip1.SelectedTabIndex = i;
                        }
                    }
                    if (Controller.Instance.MainForm.UcFunctions.tabStrip1.SelectedTab != null)
                    {
                        currentFunctionPage2 = Controller.Instance.MainForm.UcFunctions.GetCurrentlyDisplayedFunctionPage();
                        currentFunctionPage2.syntaxEditor1.SelectedView.Selection.StartOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos;
                        currentFunctionPage2.syntaxEditor1.SelectedView.Selection.EndOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos + SearchHelper.FoundLocations[CurrentIndex].Length;
                        break;
                    }
                    break;
                default:
                    throw new NotImplementedException("Not coded yet.");
            }
        }
Пример #17
0
        public static void Search(string textToFind)
        {
            if (Options == null)
            {
                return;
            }

            if (textToFind == "NONE_SPECIFIED")
            {
                textToFind = Options.FindText;
            }
            Options.FindText = textToFind;
            SearchHelper.RunFind();
            if (SearchHelper.FoundLocations.Count == 0)
            {
                return;
            }
            if (CurrentIndex < 0)
            {
                CurrentIndex = 0;
            }

            if (CurrentIndex < SearchHelper.FoundLocations.Count - 1)
            {
                CurrentIndex++;
            }
            else if (SearchHelper.FoundLocations.Count >= 0)
            {
                CurrentIndex = 0;
            }
            bool found;

            // We now have a collection of indexes, so let's look for the actual words
            switch (searchFunctions)
            {
            case SearchFunctions.CurrentFunction:
                ucFunction currentFunctionPage = Controller.Instance.MainForm.UcFunctions.GetCurrentlyDisplayedFunctionPage();

                if (currentFunctionPage == null)
                {
                    return;
                }
                if (SearchHelper.FoundLocations.Count > 0 &&
                    SearchHelper.FoundLocations[0].Function != currentFunctionPage.CurrentFunction)
                {
                    scope           = SearchHelper.Scope.Both;
                    searchFunctions = SearchHelper.SearchFunctions.AllFunctions;
                    SearchHelper.RunFind();
                }
                SyntaxEditor editor          = currentFunctionPage.syntaxEditor1;
                int          currentStartPos = editor.SelectedView.Selection.StartOffset + 1;
                CurrentIndex = -1;
                found        = false;

                for (int foundLocIndex = 0; foundLocIndex < SearchHelper.FoundLocations.Count; foundLocIndex++)
                {
                    if (SearchHelper.FoundLocations[foundLocIndex].Function == currentFunctionPage.CurrentFunction)
                    {
                        if (CurrentIndex < 0)
                        {
                            CurrentIndex = foundLocIndex;
                        }

                        CurrentIndex = foundLocIndex;

                        if (SearchHelper.FoundLocations[foundLocIndex].StartPos > currentStartPos)
                        {
                            CurrentIndex = foundLocIndex;
                            found        = true;
                            break;
                        }
                    }
                }
                if (!found)
                {
                    CurrentIndex = 0;
                }

                if (CurrentIndex < 0)
                {
                    return;
                }
                editor.SelectedView.Selection.StartOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos;
                editor.SelectedView.Selection.EndOffset   = SearchHelper.FoundLocations[CurrentIndex].StartPos + SearchHelper.FoundLocations[CurrentIndex].Length;
                break;

            case SearchFunctions.OpenFunctions:
            case SearchFunctions.AllFunctions:    // This is just highlighting the text in all open functions
                // Make sure highlighting starts from the currently selected position
                CurrentIndex = -1;
                ucFunction currentFunctionPage2 = Controller.Instance.MainForm.UcFunctions.GetCurrentlyDisplayedFunctionPage();
                found = false;

                if (currentFunctionPage2 != null)
                {
                    int selectedPos = currentFunctionPage2.syntaxEditor1.SelectedView.Selection.StartOffset + currentFunctionPage2.syntaxEditor1.SelectedView.Selection.Length;

                    if (SearchHelper.FoundLocations.Count > 0)
                    {
                        for (int i = 0; i < SearchHelper.FoundLocations.Count; i++)
                        {
                            if (SearchHelper.FoundLocations[i].Function == currentFunctionPage2.CurrentFunction)
                            {
                                if (CurrentIndex < 0)
                                {
                                    CurrentIndex = i;
                                }

                                CurrentIndex = i;

                                if (SearchHelper.FoundLocations[i].StartPos > selectedPos)
                                {
                                    found = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (!found)
                {
                    if (SearchHelper.FoundLocations.Count > 0)
                    {
                        if (CurrentIndex < SearchHelper.FoundLocations.Count - 1)
                        {
                            CurrentIndex++;
                        }
                        else
                        {
                            CurrentIndex = 0;
                        }
                    }
                }
                for (int i = 0; i < Controller.Instance.MainForm.UcFunctions.tabStrip1.Tabs.Count; i++)
                {
                    if (Controller.Instance.MainForm.UcFunctions.GetFunctionScreenByTabIndex(i).CurrentFunction == SearchHelper.FoundLocations[CurrentIndex].Function)
                    {
                        Controller.Instance.MainForm.UcFunctions.tabStrip1.SelectedTabIndex = i;
                    }
                }
                if (Controller.Instance.MainForm.UcFunctions.tabStrip1.SelectedTab != null)
                {
                    currentFunctionPage2 = Controller.Instance.MainForm.UcFunctions.GetCurrentlyDisplayedFunctionPage();
                    currentFunctionPage2.syntaxEditor1.SelectedView.Selection.StartOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos;
                    currentFunctionPage2.syntaxEditor1.SelectedView.Selection.EndOffset   = SearchHelper.FoundLocations[CurrentIndex].StartPos + SearchHelper.FoundLocations[CurrentIndex].Length;
                    break;
                }
                break;

            default:
                throw new NotImplementedException("Not coded yet.");
            }
        }
Пример #18
0
        public static void Search(string textToFind)
        {
            if (Options == null)
                return;

            if (textToFind == "NONE_SPECIFIED")
                textToFind = Options.FindText;

            Options.FindText = textToFind;
            SearchHelper.RunFind();

            if (SearchHelper.FoundLocations.Count == 0)
                return;

            if (CurrentIndex < 0)
                CurrentIndex = 0;

            if (CurrentIndex < SearchHelper.FoundLocations.Count - 1)
                CurrentIndex++;
            else if (SearchHelper.FoundLocations.Count >= 0)
                CurrentIndex = 0;

            bool found;

            // We now have a collection of indexes, so let's look for the actual words
            switch (searchFunctions)
            {
                case SearchFunctions.CurrentFunction:
                    if (ContentItems.Templates.CurrentFile == null)
                        return;

                    if (SearchHelper.FoundLocations.Count > 0 && SearchHelper.FoundLocations[0].ScriptFile != ContentItems.Templates.CurrentFile)
                    {
                        scope = SearchHelper.Scope.Both;
                        searchFunctions = SearchHelper.SearchFunctions.AllFunctions;
                        SearchHelper.RunFind();
                    }
                    SyntaxEditor editor = ContentItems.Templates.Instance.SyntaxEditor;
                    int currentStartPos = editor.SelectedView.Selection.StartOffset + 1;
                    CurrentIndex = -1;
                    found = false;

                    for (int foundLocIndex = 0; foundLocIndex < SearchHelper.FoundLocations.Where(l => l.ScriptFile == ContentItems.Templates.CurrentFile).Count(); foundLocIndex++)
                    {
                        if (CurrentIndex < 0) { CurrentIndex = foundLocIndex; }

                        CurrentIndex = foundLocIndex;

                        if (SearchHelper.FoundLocations[foundLocIndex].StartPos > currentStartPos)
                        {
                            CurrentIndex = foundLocIndex;
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                        CurrentIndex = 0;

                    if (CurrentIndex < 0)
                        return;

                    editor.SelectedView.Selection.StartOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos;
                    editor.SelectedView.Selection.EndOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos + SearchHelper.FoundLocations[CurrentIndex].Length;
                    break;
                case SearchFunctions.AllFunctions:// This is just highlighting the text in all open functions
                    // Make sure highlighting starts from the currently selected position
                    CurrentIndex = -1;
                    found = false;

                    if (ContentItems.Templates.CurrentFile != null)
                    {
                        int selectedPos = ContentItems.Templates.Instance.SyntaxEditor.SelectedView.Selection.StartOffset + ContentItems.Templates.Instance.SyntaxEditor.SelectedView.Selection.Length;

                        if (SearchHelper.FoundLocations.Count > 0)
                        {
                            for (int i = 0; i < SearchHelper.FoundLocations.Count; i++)
                            {
                                if (SearchHelper.FoundLocations[i].ScriptFile == ContentItems.Templates.CurrentFile)
                                {
                                    if (CurrentIndex < 0) { CurrentIndex = i; }

                                    CurrentIndex = i;

                                    if (SearchHelper.FoundLocations[i].StartPos > selectedPos)
                                    {
                                        found = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (!found && SearchHelper.FoundLocations.Where(l => l.ScriptFile != ContentItems.Templates.CurrentFile).Count() > 0)
                    {

                        if (CurrentIndex < SearchHelper.FoundLocations.Count - 1)
                            CurrentIndex++;
                        else
                            CurrentIndex = 0;

                        ContentItems.Templates.Instance.SelectFile(SearchHelper.FoundLocations[CurrentIndex].ScriptFile);
                    }
                    ContentItems.Templates.Instance.SyntaxEditor.SelectedView.Selection.StartOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos;
                    ContentItems.Templates.Instance.SyntaxEditor.SelectedView.Selection.EndOffset = SearchHelper.FoundLocations[CurrentIndex].StartPos + SearchHelper.FoundLocations[CurrentIndex].Length;
                    break;
                default:
                    throw new NotImplementedException("Not coded yet.");
            }
        }