コード例 #1
0
        public async Task <List <GoodCellModel> > SearchComputersGoodCells(ComputersSelector computersSelector)
        {
            var normalParameters = _parametersCreator.GetComputersParameters(computersSelector)
                                   .Append(_parametersCreator.CreateDiscriminatorParameter <Computer>()).ToArray();
            var goodsDbInformation = await _context.GetGoodsDbInformation("GetComputers", normalParameters);

            return(goodsDbInformation.GoodCells);
        }
 public ComputersInformationSearcherFactory(IGoodsInformationSearcher goodsInformationSearcher,
                                            IGoodCellsSearcher goodCellsSearcher,
                                            ICacheKeyCreator keyCreator,
                                            ComputersSelector computersSelector)
 {
     _goodsInformationSearcher = goodsInformationSearcher;
     _goodCellsSearcher        = goodCellsSearcher;
     _keyCreator        = keyCreator;
     _computersSelector = computersSelector;
 }
コード例 #3
0
        public async Task <GoodsInformation <string> > SearchComputersInformation(ComputersSelector computersSelector)
        {
            var normalParameters = _parametersCreator.GetComputersParameters(computersSelector)
                                   .Append(_parametersCreator.CreateDiscriminatorParameter <Computer>()).ToArray();
            var goodsDbInformation = await _context.GetGoodsDbInformation("GetComputers", normalParameters);

            var questions = _questionsGrouper.GroupComputers(computersSelector, goodsDbInformation.DBQuestions);

            return(new GoodsInformation <string>(_parametersCreator.GetCount(normalParameters), goodsDbInformation.GoodCells, questions));
        }
コード例 #4
0
        public List <SqlParameter> GetComputersParameters(ComputersSelector computersSelector)
        {
            List <SqlParameter> sqlParameters = new List <SqlParameter>();

            sqlParameters.AddRange(GetComputerTechnologiesParameters(computersSelector));
            if (computersSelector.AmountOfRAMs != null)
            {
                sqlParameters.Add(CreateAmountOfRAMParameter(computersSelector.AmountOfRAMs));
            }
            if (computersSelector.CPUFrequencies != null)
            {
                sqlParameters.Add(CreateCpuFrequenciesParameter(computersSelector.CPUFrequencies));
            }
            if (computersSelector.Length != null)
            {
                sqlParameters.Add(CreateLengthParameter(computersSelector.Length));
            }
            if (computersSelector.Height != null)
            {
                sqlParameters.Add(CreateHeightParameter(computersSelector.Height));
            }
            if (computersSelector.Width != null)
            {
                sqlParameters.Add(CreateWidthParameter(computersSelector.Width));
            }
            if (computersSelector.HaveFloppyDrives != null)
            {
                sqlParameters.Add(CreateHaveFloppyDrivesParameter(computersSelector.HaveFloppyDrives));
            }
            if (computersSelector.SSDMemory != null)
            {
                sqlParameters.Add(CreateSSDMemoryParameter(computersSelector.SSDMemory));
            }
            if (computersSelector.HardDiskMemory != null)
            {
                sqlParameters.Add(CreateHardDiskMemoryParameter(computersSelector.HardDiskMemory));
            }
            if (computersSelector.CPUSocketTypes != null)
            {
                sqlParameters.Add(CreateCPUSocketTypesParameter(computersSelector.CPUSocketTypes));
            }
            if (computersSelector.ComputerDriveTypes != null)
            {
                sqlParameters.Add(CreateComputerDriveTypesParameter(computersSelector.ComputerDriveTypes));
            }
            if (computersSelector.NumberOfCores != null)
            {
                sqlParameters.Add(CreateNumberOfCoresParameter(computersSelector.NumberOfCores));
            }
            if (computersSelector.FloppyDrivesCount != null && (computersSelector.HaveFloppyDrives == null || computersSelector.HaveFloppyDrives.Contains(true)))
            {
                sqlParameters.Add(CreateFloppyDrivesCountParameter(computersSelector.FloppyDrivesCount));
            }
            return(sqlParameters);
        }
コード例 #5
0
        public List <QuestionsBase <string> > GroupComputers(ComputersSelector computersSelector, List <DBQuestionBase> dBQuestions)
        {
            var questions = new List <QuestionsBase <string> >()
            {
                _questionsCreator.GroupAmountOfRAMs(dBQuestions),
                _questionsCreator.GroupCPUFrequencies(dBQuestions),
                _questionsCreator.GroupHeight(dBQuestions),
                _questionsCreator.GroupWidth(dBQuestions),
                _questionsCreator.GroupLength(dBQuestions),
                _questionsCreator.GroupHaveFloppyDrives(dBQuestions),
                _questionsCreator.GroupSSDMemory(dBQuestions),
                _questionsCreator.GroupHardDiskMemory(dBQuestions),
                _questionsCreator.GroupCPUSocketTypes(dBQuestions),
                _questionsCreator.GroupComputerDriveTypes(dBQuestions),
                _questionsCreator.GroupNumberOfCores(dBQuestions)
            };

            if (computersSelector.HaveFloppyDrives == null || computersSelector.HaveFloppyDrives.Contains(true))
            {
                questions.Add(_questionsCreator.GroupFloppyDrivesCount(dBQuestions));
            }
            questions.AddRange(GroupComputerTechnologies(computersSelector, dBQuestions));
            return(questions);
        }
コード例 #6
0
 public async Task <GoodsInformation <string> > GetComputersInformation([FromBody] ComputersSelector computersSelector)
 {
     return(await _goodsInformationCreator.CreateGoodsInformation(computersSelector, new ComputersInformationSearcherFactory(_goodsInformationSearcher, _goodCellsSearcher, _keyCreator, computersSelector)));
 }