Beispiel #1
0
        public List <QuestionsBase <string> > GroupLaptops(LaptopsSelector laptopsSelector, 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),
                _questionsCreator.GroupDisplays(dBQuestions)
            };

            if (laptopsSelector.HaveFloppyDrives == null || laptopsSelector.HaveFloppyDrives.Contains(true))
            {
                questions.Add(_questionsCreator.GroupFloppyDrivesCount(dBQuestions));
            }
            questions.AddRange(GroupComputerTechnologies(laptopsSelector, dBQuestions));
            return(questions);
        }
        public List <SqlParameter> GetLaptopsParameters(LaptopsSelector laptopsSelector)
        {
            List <SqlParameter> sqlParameters = new List <SqlParameter>();

            sqlParameters.AddRange(GetComputerTechnologiesParameters(laptopsSelector));
            if (laptopsSelector.AmountOfRAMs != null)
            {
                sqlParameters.Add(CreateAmountOfRAMParameter(laptopsSelector.AmountOfRAMs));
            }
            if (laptopsSelector.CPUFrequencies != null)
            {
                sqlParameters.Add(CreateCpuFrequenciesParameter(laptopsSelector.CPUFrequencies));
            }
            if (laptopsSelector.Length != null)
            {
                sqlParameters.Add(CreateLengthParameter(laptopsSelector.Length));
            }
            if (laptopsSelector.Height != null)
            {
                sqlParameters.Add(CreateHeightParameter(laptopsSelector.Height));
            }
            if (laptopsSelector.Width != null)
            {
                sqlParameters.Add(CreateWidthParameter(laptopsSelector.Width));
            }
            if (laptopsSelector.HaveFloppyDrives != null)
            {
                sqlParameters.Add(CreateHaveFloppyDrivesParameter(laptopsSelector.HaveFloppyDrives));
            }
            if (laptopsSelector.SSDMemory != null)
            {
                sqlParameters.Add(CreateSSDMemoryParameter(laptopsSelector.SSDMemory));
            }
            if (laptopsSelector.HardDiskMemory != null)
            {
                sqlParameters.Add(CreateHardDiskMemoryParameter(laptopsSelector.HardDiskMemory));
            }
            if (laptopsSelector.CPUSocketTypes != null)
            {
                sqlParameters.Add(CreateCPUSocketTypesParameter(laptopsSelector.CPUSocketTypes));
            }
            if (laptopsSelector.ComputerDriveTypes != null)
            {
                sqlParameters.Add(CreateComputerDriveTypesParameter(laptopsSelector.ComputerDriveTypes));
            }
            if (laptopsSelector.NumberOfCores != null)
            {
                sqlParameters.Add(CreateNumberOfCoresParameter(laptopsSelector.NumberOfCores));
            }
            if (laptopsSelector.FloppyDrivesCount != null && (laptopsSelector.HaveFloppyDrives == null || laptopsSelector.HaveFloppyDrives.Contains(true)))
            {
                sqlParameters.Add(CreateFloppyDrivesCountParameter(laptopsSelector.FloppyDrivesCount));
            }
            if (laptopsSelector.Displays != null)
            {
                sqlParameters.Add(CreateDisplaysParameter(laptopsSelector.Displays));
            }
            return(sqlParameters);
        }
Beispiel #3
0
        public async Task <List <GoodCellModel> > SearchLaptopGoodCells(LaptopsSelector laptopsSelector)
        {
            var parameters = _parametersCreator.GetLaptopsParameters(laptopsSelector)
                             .Append(_parametersCreator.CreateDiscriminatorParameter <Laptop>()).ToArray();
            var goodsDbInformation = await _context.GetGoodsDbInformation("GetLaptops", parameters);

            return(goodsDbInformation.GoodCells);
        }
Beispiel #4
0
        public async Task <GoodsInformation <string> > SearchLaptopsInformation(LaptopsSelector laptopsSelector)
        {
            var parameters = _parametersCreator.GetLaptopsParameters(laptopsSelector)
                             .Append(_parametersCreator.CreateDiscriminatorParameter <Laptop>()).ToArray();
            var goodsDbInformation = await _context.GetGoodsDbInformation("GetLaptops", parameters);

            var questions = _questionsGrouper.GroupLaptops(laptopsSelector, goodsDbInformation.DBQuestions);

            return(new GoodsInformation <string>(_parametersCreator.GetCount(parameters), goodsDbInformation.GoodCells, questions));
        }
Beispiel #5
0
 public LaptopsInformationSearcherFactory(IGoodsInformationSearcher goodsInformationSearcher,
                                          IGoodCellsSearcher goodCellsSearcher,
                                          ICacheKeyCreator keyCreator,
                                          LaptopsSelector laptopsSelector)
 {
     _goodsInformationSearcher = goodsInformationSearcher;
     _goodCellsSearcher        = goodCellsSearcher;
     _keyCreator      = keyCreator;
     _laptopsSelector = laptopsSelector;
 }
 public async Task <GoodsInformation <string> > GetLaptopsInformation([FromBody] LaptopsSelector laptopsSelector)
 {
     return(await _goodsInformationCreator.CreateGoodsInformation(laptopsSelector, new LaptopsInformationSearcherFactory(_goodsInformationSearcher, _goodCellsSearcher, _keyCreator, laptopsSelector)));
 }