Beispiel #1
0
        public void ValidateSortReturnsSameLengthList()
        {
            var sortService = new SortService();
            var randomList  = GenerateRandomList(100);

            Assert.True(sortService.BubbleMethod(randomList)?.Count == randomList.Count);
        }
Beispiel #2
0
        public void ValidateSortNonConsecutiveList()
        {
            var sortService = new SortService();
            var randomList  = GenerateRandomList(1000, 100);

            Assert.True(IsListOrdered(sortService.BubbleMethod(randomList)));
        }
Beispiel #3
0
        public void ValidateSortReturnsSameNumbers()
        {
            var sortService = new SortService();
            var randomList  = GenerateRandomList(100);

            Assert.True(sortService.BubbleMethod(randomList).Intersect(randomList).Any());
        }
        static int jump         = 2000; // tamanho do salto na amostra



        static void Main(string[] args)
        {
            baseDictionary = BaseDictionaryService.InitializeBaseDictionary(baseDictionary);
            var savedDictionary = new List <SorterWord>();

            client.BaseAddress = new Uri("http://testes.ti.lemaf.ufla.br/api/Dicionario/");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            while (true)
            {
                Console.WriteLine("Por favor, digite a palavra e tecle ENTER para iniciar a pesquisa" + "\r\n" + "Ou somente ENTER para sair.");
                string word = Console.ReadLine();

                if (!String.IsNullOrEmpty(word))
                {
                    Task <SorterWord> callTask = Task.Run(() => SortService.SearchWord(client, savedDictionary, baseDictionary, jump, word));
                    callTask.Wait();
                    var astr = callTask.Result;
                    killedKitten = KilledKittens.ReturnKilledkitten();
                    if (astr != null)
                    {
                        Console.WriteLine("A palavra {0} está na posição {1}. Para encontrarmos a palavra, {2} gatinhos foram mortos." + "\r\n\r\n", word, astr.Position, killedKitten);
                    }
                    KilledKittens.ResetCounter();
                }
                else
                {
                    Environment.Exit(0);
                }
            }
        }
        public void Initialize()
        {
            var mockExternalService = new Mock <IExternalService>();

            mockExternalService
            .Setup(s => s.GetProductList())
            .Returns(Task.FromResult <List <ProductModel> >(new List <ProductModel>()
            {
                new ProductModel()
                {
                    Name = "ProductA", Price = 5.0, Quantity = 5
                },
                new ProductModel()
                {
                    Name = "ProductB", Price = 2.5, Quantity = 2
                },
                new ProductModel()
                {
                    Name = "ProductC", Price = 1, Quantity = 3
                },
            }));

            mockExternalService
            .Setup(s => s.GetShopperHistory())
            .Returns(Task.FromResult <List <ShopperHistoryModel> >(new List <ShopperHistoryModel>()
            {
                new ShopperHistoryModel()
                {
                    CustomerId = 1,
                    Products   = new List <ProductModel>()
                    {
                        new ProductModel()
                        {
                            Name = "ProductA", Price = 5.0, Quantity = 1
                        },
                        new ProductModel()
                        {
                            Name = "ProductB", Price = 2.5, Quantity = 2
                        },
                    }
                },
                new ShopperHistoryModel()
                {
                    CustomerId = 2,
                    Products   = new List <ProductModel>()
                    {
                        new ProductModel()
                        {
                            Name = "ProductB", Price = 5.0, Quantity = 3
                        },
                        new ProductModel()
                        {
                            Name = "ProductC", Price = 2.5, Quantity = 2
                        },
                    }
                }
            }));

            _sortService = new SortService(mockExternalService.Object);
        }
        public async Task SortService_ShouldSortByPurchasedQuantities_WhenSortOptionIsRecommended()
        {
            var shopperHistoryJson   = @"[{
                                            'customerId': 23,
                                            'products': [
                                                {
                                                'name': 'Test Product A',
                                                'price': 99.99,
                                                'quantity': 2
                                                },
                                                {
                                                'name': 'Test Product B',
                                                'price': 101.99,
                                                'quantity': 3
                                                },
                                                {
                                                'name': 'Test Product F',
                                                'price': 999999999999,
                                                'quantity': 1
                                                }
                                            ]
                                        }]";
            var shopperHistoryClient = Substitute.For <IShopperHistoryClient>();
            var shopperHistoryData   = JsonConvert.DeserializeObject <IEnumerable <ShopperHistory> >(shopperHistoryJson);

            shopperHistoryClient.GetShopperHistory().Returns(shopperHistoryData);

            var sut            = new SortService(shopperHistoryClient);
            var sortedProducts = await sut.Sort("Recommended", data);

            Assert.AreEqual("Test Product B", sortedProducts.First().Name);
        }
Beispiel #7
0
        public ActionResult Index()
        {
            HomeViewModel homeViewModel = new HomeViewModel();

            homeViewModel.Sorts = SortService.GetEntities(s => true);
            return(View(homeViewModel));
        }
Beispiel #8
0
        private void SortSubtitleGrid(int sortColumnNumber)
        {
            try
            {
                if (_bluRaySummaryInfo.BluRayTitleInfo.Subtitles == null || _bluRaySummaryInfo.BluRayTitleInfo.Subtitles.Count() == 0)
                {
                    return;
                }

                string sortColumnName = dgvSubtitles.Columns[sortColumnNumber].DataPropertyName;
                _subtitleGridSortConfiguration.SortByColumnName = sortColumnName;
                ISortService <BluRayTitleSubtitle> sortService = new SortService <BluRayTitleSubtitle>(_subtitleGridSortConfiguration, _bluRaySummaryInfo.BluRayTitleInfo.Subtitles);

                IBindingListSortService <BluRayTitleSubtitle> bindingListSortService = new BindingListSortService <BluRayTitleSubtitle>(_bluRaySummaryInfo.BluRayTitleInfo.Subtitles, dgvSubtitles,
                                                                                                                                        _subtitleGridSortConfiguration, sortService);
                _bindingListBluRayTitleSubtitle = bindingListSortService.Sort();

                this.BindSubtitleGrid();
            }
            catch (Exception ex)
            {
                _displayErrorMessageService.LogAndDisplayError(new ErrorMessage()
                {
                    DisplayMessage = "There was a problem sorting the subtitle grid!", DisplayTitle = "Error.", Exception = ex, MethodNameWhereExceptionOccurred = MethodBase.GetCurrentMethod().Name
                });
            }
        }
        private void SortLogFilesGrid(int sortColumnNumber)
        {
            if (_bindingListLogFiles.Count() == 0)
            {
                return;
            }

            gbScreen.SetEnabled(false);

            List <X264LogFile> logFiles       = new List <X264LogFile>();
            string             sortColumnName = dgvLogFiles.Columns[sortColumnNumber].DataPropertyName;

            _logFilesGridSortConfiguration.SortByColumnName = sortColumnName;
            ISortService <X264LogFile> sortService = new SortService <X264LogFile>(_logFilesGridSortConfiguration, logFiles);

            foreach (X264LogFile log in _bindingListLogFiles)
            {
                logFiles.Add(new X264LogFile()
                {
                    FileNameOnly = log.FileNameOnly, FilePath = log.FilePath
                });
            }

            IBindingListSortService <X264LogFile> bindingListSortService = new BindingListSortService <X264LogFile>(logFiles, dgvLogFiles,
                                                                                                                    _logFilesGridSortConfiguration, sortService);

            _bindingListLogFiles = bindingListSortService.Sort();

            this.BindLogFilesGrid();

            gbScreen.SetEnabled(true);
        }
Beispiel #10
0
        public void Sort_Int_Desc()
        {
            var rnd    = new Random();
            var source = Enumerable.Range(0, 20000)
                         .Select(x => new KeyValuePair <BsonValue, PageAddress>(rnd.Next(1, 30000), PageAddress.Empty))
                         .ToArray();

            var pragmas = new EnginePragmas(null);

            pragmas.Set(Pragmas.COLLATION, Collation.Binary.ToString(), false);

            using (var tempDisk = new SortDisk(_factory, 10 * 8192, pragmas))
                using (var s = new SortService(tempDisk, Query.Descending, pragmas))
                {
                    s.Insert(source);

                    s.Count.Should().Be(20000);
                    s.Containers.Count.Should().Be(3);

                    s.Containers.ElementAt(0).Count.Should().Be(8192);
                    s.Containers.ElementAt(1).Count.Should().Be(8192);
                    s.Containers.ElementAt(2).Count.Should().Be(3616);

                    var output = s.Sort().ToArray();

                    output.Should().Equal(source.OrderByDescending(x => x.Key).ToArray());
                }
        }
Beispiel #11
0
        public void SortByAnagrams_Test()
        {
            var input  = new[] { "bad", "a", "dab", "can", "a", "nac" };
            var actual = SortService.SortByAnagrams(input);

            Assert.AreEqual(new string[] { "a", "a", "bad", "dab", "can", "nac" }, actual);
        }
Beispiel #12
0
        /// <summary>
        /// 一级分类
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            ViveViewModel viewmode = new ViveViewModel();

            viewmode.TopSorts = SortService.GetEntities(s => s.UpCode != null);
            return(View(viewmode));
        }
Beispiel #13
0
        public void Sort_Int_Desc()
        {
            var rnd    = new Random();
            var source = Enumerable.Range(0, 20000)
                         .Select(x => new KeyValuePair <BsonValue, PageAddress>(rnd.Next(1, 30000), PageAddress.Empty))
                         .ToArray();


            using (var tempDisk = new SortDisk(_factory, 10 * 8192, false))
                using (var s = new SortService(tempDisk, Query.Descending))
                {
                    s.Insert(source);

                    Assert.AreEqual(20000, s.Count);
                    Assert.AreEqual(3, s.Containers.Count);

                    Assert.AreEqual(8192, s.Containers.ElementAt(0).Count);
                    Assert.AreEqual(8192, s.Containers.ElementAt(1).Count);
                    Assert.AreEqual(3616, s.Containers.ElementAt(2).Count);

                    var output = s.Sort().ToArray();

                    CollectionAssert.AreEqual(source.OrderByDescending(x => x.Key).ToArray(), output);
                }
        }
Beispiel #14
0
        public void Sort_String_Asc()
        {
            var source = Enumerable.Range(0, 2000)
                         .Select(x => Guid.NewGuid().ToString())
                         .Select(x => new KeyValuePair <BsonValue, PageAddress>(x, PageAddress.Empty))
                         .ToArray();

            var pragmas = new EnginePragmas(null);

            pragmas.Set("COLLATION", Collation.Binary.ToString(), false);

            using (var tempDisk = new SortDisk(_factory, 10 * 8192, pragmas))
                using (var s = new SortService(tempDisk, Query.Ascending, pragmas))
                {
                    s.Insert(source);

                    s.Count.Should().Be(2000);
                    s.Containers.Count.Should().Be(2);

                    s.Containers.ElementAt(0).Count.Should().Be(1905);
                    s.Containers.ElementAt(1).Count.Should().Be(95);

                    var output = s.Sort().ToArray();

                    output.Should().Equal(source.OrderBy(x => x.Key).ToArray());
                }
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            var            helper        = new Helper();
            var            db            = new MyContext();
            var            request       = helper.GenerateQueryRequest();
            ISearchService searchService = new SearchService();
            ISortService   sortService   = new SortService();
            IProjectionMapper <DocumentInfo, DocumentInfoViewModel> projection = new DocumentToViewModelProjectionMapper();
            var predicateBuilder = PredicateBuilder.New <DocumentInfoViewModel>();

            var dt = DateTime.UtcNow.AddMonths(-6);
            Expression <Func <DocumentInfoViewModel, bool> > linqImplementation = predicateBuilder.And(x =>
                                                                                                       !x.Name.Contains("letin") &&
                                                                                                       x.Date > dt &&
                                                                                                       !x.IsDeleted &&
                                                                                                       x.Price > 5 &&
                                                                                                       x.Pages == 2);

            Expression <Func <DocumentInfoViewModel, bool> > searchImplementation = searchService.Filter <DocumentInfoViewModel>(request.Filters);

            var oldWhereImp = db.DocumentInfos.Select(projection.Map()).AsExpandable().Where(linqImplementation);
            var oldSortImp  = oldWhereImp.OrderBy(x => x.Name).ThenByDescending(x => x.Price);
            var oldImp      = oldSortImp.ToList();

            var newWhereImp = db.DocumentInfos.Select(projection.Map()).AsExpandable().Where(searchImplementation);
            var newSortImp  = sortService.Sort(newWhereImp, request.SortBy);
            var newImp      = newSortImp.ToList();

            Console.ReadLine();
        }
        public void SortPhoto_ValidDateTimeName_yyyymmDirectoryExist()
        {
            /// Description
            /// Tests that it is possible to rename and sort photo if the directories exist.

            /// Expectation
            /// Calls renameServiceMock.FindPhotoDateTime and renameServiceMock.RenameFile exactly ONCE!

            // Mock IRenameService
            var renameServiceMock = new Mock <IRenameService>();

            // Creates a temp directory for testing
            var outputPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            Directory.CreateDirectory(outputPath);

            // Create temp photo
            var photoPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            File.Create(photoPath)
            .Close();

            var photo = new Photo(photoPath);

            var today            = DateTime.Today;
            var yearString       = today.Year.ToString();
            var monthString      = today.Month.ToString("D2");
            var expectedDateTime = today.ToString("yyyyMMdd_HHmmss");
            var yyyymmPath       = Path.Combine(outputPath, yearString, monthString);

            Directory.CreateDirectory(yyyymmPath);

            // Generate a temp IConfiguration object
            var configuration = CreateInMemoryConfiguration(outputPath);

            // Mock the IRenameService.RenameFile to create file in unknown directory
            renameServiceMock.Setup(mock => mock.RenameFile(It.IsAny <string>(), It.IsAny <string>()));

            // Mock the IRenameService.FindPhotoDateTime to return datetime name
            renameServiceMock.Setup(mock => mock.FindPhotoDateTime(It.IsAny <Photo>(), It.IsAny <string>()))
            .Returns(expectedDateTime);

            // Get the mocked objects
            var renameService = renameServiceMock.Object;

            // Construct the sort service and get the output directories structure
            var sortService = new SortService(logger, configuration, renameService);

            sortService.SortPhoto(photo);

            // Verify mock calls
            renameServiceMock.Verify(mock => mock.RenameFile(It.IsAny <string>(), It.IsAny <string>()), Times.Once);
            renameServiceMock.Verify(mock => mock.FindPhotoDateTime(It.IsAny <Photo>(), It.IsAny <string>()), Times.Once);

            // Assert that unknown directory does not exist
            var unknownDirectoryPath = Path.Combine(outputPath, UNKNOWN_DIRNAME);

            Assert.False(Directory.Exists(unknownDirectoryPath));
        }
Beispiel #17
0
        public void MergeArraysTest_Intertwined_Test()
        {
            var a = new[] { 1, 7, 10, 15, 19, 0, 0, 0, 0 };
            var b = new[] { 2, 8, 20, 21 };

            SortService.MergeSortedArrays(a, b, 5, 4);
            Assert.AreEqual(new[] { 1, 2, 7, 8, 10, 15, 19, 20, 21 }, a);
        }
Beispiel #18
0
        private static void Main(string[] args)
        {
            var         basePath    = $"C:\\Users\\{Environment.UserName}\\Downloads";
            FileHandler fileHandler = new FileHandler(basePath);
            SortService sortService = new SortService(fileHandler, basePath);

            sortService.Sort();
        }
Beispiel #19
0
        public void SearchString_InSortedStringArray_NotFound_STest()
        {
            var input = new[] { "bla", "", "car", "", "", "forest", "", "" };

            var index = SortService.Search(input, "zus");

            Assert.AreEqual(-1, index);
        }
Beispiel #20
0
        public void MergeArraysTest_NotIntertwined_aLast_Test()
        {
            var a = new[] { 19, 20, 21, 29, 30, 0, 0, 0, 0 };
            var b = new[] { 1, 2, 3, 4 };

            SortService.MergeSortedArrays(a, b, 5, 4);
            Assert.AreEqual(new[] { 1, 2, 3, 4, 19, 20, 21, 29, 30 }, a);
        }
Beispiel #21
0
        public void FindElementInSortedRotatedArray_NotFound_Test()
        {
            var input = new[] { 15, 16, 19, 20, 25, 1, 3, 4, 5, 7, 10, 14 };

            var index = SortService.FindElementInSortedRotatedArray(input, 111);

            Assert.AreEqual(-1, index);
        }
Beispiel #22
0
        /// <summary>
        /// 二级分类
        /// </summary>
        /// <param name="upcode"></param>
        /// <returns></returns>
        public ActionResult ChiSort(string upcode)
        {
            ViveViewModel viewmode = new ViveViewModel();

            //Contains 匹配数据库中是否出现的字符  相当于模糊查询
            viewmode.LowSorts = SortService.GetEntities(r => r.Code.Contains(upcode));
            return(View(viewmode));
        }
Beispiel #23
0
        public void Sort_VariableTest_TestSuccess(string input, string expected)
        {
            var sysUnderTest = new SortService();

            var result = sysUnderTest.Sort(input);

            result.Should().Be(expected);
        }
        public async Task SortService_ShouldCallShopperHistoryApi_WhenSortOptionIsRecommended()
        {
            var shopperHistoryClient = Substitute.For <IShopperHistoryClient>();

            var sut            = new SortService(shopperHistoryClient);
            var sortedProducts = await sut.Sort("Recommended", data);

            await shopperHistoryClient.Received(1).GetShopperHistory();
        }
        public async Task <string> SortService_ShouldSortByPrice_WhenSortOptionIsLow(string sortOption)
        {
            var shopperHistoryClient = Substitute.For <IShopperHistoryClient>();

            var sut            = new SortService(shopperHistoryClient);
            var sortedProducts = await sut.Sort(sortOption, data);

            return(sortedProducts.First().Name);
        }
Beispiel #26
0
 public void HeapSortTest()
 {
     int[] arr = { 1, 2, 3, 4, 42, 5, 6, 8, 1, 2, 3, 25 };
     SortService.HeapSort(arr);
     for (int i = 0; i < arr.Length; i++)
     {
         Console.WriteLine(arr[i]);
     }
 }
Beispiel #27
0
        public IActionResult GetAllMovies(bool ascending = true)
        {
            var sorter     = new SortService();
            var service    = MovieService.GetServiceInstance();
            var allMovies  = service.GetAllMovies();
            var sortedList = sorter.SortList(allMovies, ascending);

            return(new OkObjectResult(sortedList));
        }
Beispiel #28
0
        /// <summary>
        /// 三级分类  综合 畅销 价格
        /// </summary>
        /// <param name="codeSort"></param>
        /// <returns></returns>
        public ActionResult DetailList(string codeSort)
        {
            //获取二级分类下的所有商品
            viewmode.Products = SortService.GetEntity(p => p.Code == codeSort).Products;
            //0  代表热销 查询二级分类下的所有商品中商品对应的图片表中的No为0的商品


            return(View(viewmode));
        }
Beispiel #29
0
        static void Main(string[] args)
        {
            int[]       arr  = new int[] { 5, 3, 6, 1, 4, 8, 2, 7 };
            SortService sort = new SortService();

            sort.InsertSort(arr);
            foreach (var i in arr)
            {
                Console.Write(i + " ");
            }
        }
Beispiel #30
0
        public ActionResult Search_list(int code)
        {
            if (code == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }

            homeviewmodel.Product     = SortService.GetEntity(s => s.Code == code).Products;
            homeviewmodel.ShoppingNum = ShoppingCartService.GetCount(s => s.CusId == (int)Session["Custid"]);
            return(View(homeviewmodel));
        }
Beispiel #31
0
 public void sortservice_will_update_sort_configuration_lastsortbycolumn_test()
 {
     //given a list
     List<BluRaySummaryInfo> unsortedList = new List<BluRaySummaryInfo>() { new BluRaySummaryInfo() { Eac3ToId = "8)", BluRayTitleInfo = new BluRayTitleInfo() { EpisodeNumber = "8"} }, new BluRaySummaryInfo() { Eac3ToId = "1)",  BluRayTitleInfo = new BluRayTitleInfo() { EpisodeNumber = "1"} },
         new BluRaySummaryInfo() { Eac3ToId = "4)", BluRayTitleInfo = new BluRayTitleInfo() { EpisodeNumber = "4"} } };
     //when i attempt to sort by a column in desc order
     SortConfiguration config = new SortConfiguration() { LastSortByColumnName = string.Empty, SortByColumnName = "EpisodeNumber", SortDirection = EnumSortDirection.Asc };
     ISortService<BluRaySummaryInfo> service = new SortService<BluRaySummaryInfo>(config, unsortedList);
     //list should be ordered by column in desc order
     List<BluRaySummaryInfo> sortedList = service.Sort();
     config.LastSortByColumnName.Should().Be("EpisodeNumber");
 }
Beispiel #32
0
        public void Test()
        {
            var list = new List<int>()
            {
                6,3,3,6,4,12,343,45,47,65,8,56,45,
            };

            var sortService = new SortService<int>(list, (i, i1) => (i > i1));

            foreach (var value in sortService.GetSortedListByQuickSort())
            {
                Console.Write(value + "  ");
            }
        }
Beispiel #33
0
        private void SortSubtitleGrid(int sortColumnNumber)
        {
            try
            {
                if (_bluRaySummaryInfo.BluRayTitleInfo.Subtitles == null || _bluRaySummaryInfo.BluRayTitleInfo.Subtitles.Count() == 0)
                    return;

                string sortColumnName = dgvSubtitles.Columns[sortColumnNumber].DataPropertyName;
                _subtitleGridSortConfiguration.SortByColumnName = sortColumnName;
                ISortService<BluRayTitleSubtitle> sortService = new SortService<BluRayTitleSubtitle>(_subtitleGridSortConfiguration, _bluRaySummaryInfo.BluRayTitleInfo.Subtitles);

                IBindingListSortService<BluRayTitleSubtitle> bindingListSortService = new BindingListSortService<BluRayTitleSubtitle>(_bluRaySummaryInfo.BluRayTitleInfo.Subtitles, dgvSubtitles,
                    _subtitleGridSortConfiguration, sortService);
                _bindingListBluRayTitleSubtitle = bindingListSortService.Sort();

                this.BindSubtitleGrid();
            }
            catch (Exception ex)
            {
                _displayErrorMessageService.DisplayError(new ErrorMessage() { DisplayMessage = "There was a problem sorting the subtitle grid!", DisplayTitle = "Error.", Exception = ex, MethodNameWhereExceptionOccurred = MethodBase.GetCurrentMethod().Name });
            }
        }
        private void SortFilesGrid(int sortColumnNumber)
        {
            if (_bindingListFiles.Count() == 0)
                return;

            string sortColumnName = dgvFiles.Columns[sortColumnNumber].DataPropertyName;
            _filesGridSortConfiguration.SortByColumnName = sortColumnName;
            List<X264File> x264Files = this.GetX264Files();
            ISortService<X264File> sortService = new SortService<X264File>(_filesGridSortConfiguration, x264Files);

            IBindingListSortService<X264File> bindingListSortService = new BindingListSortService<X264File>(x264Files, dgvFiles,
                _filesGridSortConfiguration, sortService);
            _bindingListFiles = bindingListSortService.Sort();

            this.BindFilesGrid();
        }
        private void SortBluRayDiscGrid(int sortColumnNumber)
        {
            if (_bindingListBluRayDiscInfo.Count() == 0)
                return;

            string sortColumnName = dgvBluRayDiscInfo.Columns[sortColumnNumber].DataPropertyName;
            _bluRayDiscGridSortConfiguration.SortByColumnName = sortColumnName;
            List<BluRayDiscInfo> discs = this.GetBluRayDiscInfoList();
            ISortService<BluRayDiscInfo> sortService = new SortService<BluRayDiscInfo>(_bluRayDiscGridSortConfiguration, discs);

            IBindingListSortService<BluRayDiscInfo> bindingListSortService = new BindingListSortService<BluRayDiscInfo>(discs, dgvBluRayDiscInfo, _bluRayDiscGridSortConfiguration, sortService);
            _bindingListBluRayDiscInfo = bindingListSortService.Sort();

            this.BindDgvBluRayDiscInfoGrid();
        }
        private void SortBluRaySummaryGrid(int sortColumnNumber)
        {
            if (_currentBluRayDiscInfo == null)
                return;

            string sortColumnName = dgvBluRaySummary.Columns[sortColumnNumber].DataPropertyName;
            _bluRaySummaryGridSortConfiguration.SortByColumnName = sortColumnName;
            ISortService<BluRaySummaryInfo> sortService = new SortService<BluRaySummaryInfo>(_bluRaySummaryGridSortConfiguration, _currentBluRayDiscInfo.BluRaySummaryInfoList);

            IBindingListSortService<BluRaySummaryInfo> bindingListSortService = new BindingListSortService<BluRaySummaryInfo>(_currentBluRayDiscInfo.BluRaySummaryInfoList,
                dgvBluRaySummary, _bluRaySummaryGridSortConfiguration, sortService);

            _bindingListBluRaySummaryInfo = bindingListSortService.Sort();

            this.BindDgvBluRaySummaryGrid();
        }
Beispiel #37
0
        private void SortLogFilesGrid(int sortColumnNumber)
        {
            if (_bindingListLogFiles.Count() == 0)
                return;

            gbScreen.SetEnabled(false);

            List<X264LogFile> logFiles = new List<X264LogFile>();
            string sortColumnName = dgvLogFiles.Columns[sortColumnNumber].DataPropertyName;
            _logFilesGridSortConfiguration.SortByColumnName = sortColumnName;
            ISortService<X264LogFile> sortService = new SortService<X264LogFile>(_logFilesGridSortConfiguration, logFiles);

            foreach (X264LogFile log in _bindingListLogFiles)
            {
                logFiles.Add(new X264LogFile() { FileNameOnly = log.FileNameOnly, FilePath = log.FilePath });
            }

            IBindingListSortService<X264LogFile> bindingListSortService = new BindingListSortService<X264LogFile>(logFiles, dgvLogFiles,
                _logFilesGridSortConfiguration, sortService);
            _bindingListLogFiles = bindingListSortService.Sort();

            this.BindLogFilesGrid();

               gbScreen.SetEnabled(true);
        }