コード例 #1
0
ファイル: QueryManager.cs プロジェクト: Zammstein/PCbuilder
        public void queryReadOpticalDrive(OpticalDrive optischeDrivesNode, List <OpticalDrive> listOptischeDrives)
        {
            // This query is to return the OpticalDrive node.

            initClientConnection();
            var result =
                this.client.Cypher
                .Match(" (o:Optischedrives)")
                .Where((OpticalDrive o) => o.Categorie == optischeDrivesNode.Categorie)
                .ReturnDistinct((o) => new
            {
                listO = o.As <OpticalDrive>(),
            })
                .Limit(500)
                .Results;


            foreach (var a in result)
            {
                listOptischeDrives.Add(a.listO);
            }
        }
コード例 #2
0
ファイル: QueryManager.cs プロジェクト: Zammstein/PCbuilder
        public void runAllQuery(SearchPropertiesModel searchPropertiesModel, List <Motherboard> listMotherboard, List <Processor> listProcessor, List <RAM> listRAM, List <OpticalDrive> listOpticalDrive,
                                List <HardDrive> listHardDrive, List <GraphicCard> listGraphicCard, List <ProcessorCooler> listProcessorCooler,
                                List <PowerSupply> listPowerSupply, List <ComputerCase> listComputerCase)
        {
            //Create objects With the properties needed to run the queries.

            Motherboard motherboardNode = new Motherboard();

            motherboardNode.Geheugenslots = searchPropertiesModel.memorySlots;


            Processor processorNode = new Processor();

            processorNode.Cores = searchPropertiesModel.processorcores;
            processorNode.Model = searchPropertiesModel.processorType;
            processorNode.MinimumKloksnelheid = processorNode.setMinimumRange(searchPropertiesModel.processorClockSpeed);
            processorNode.MaximumKloksnelheid = processorNode.setMaximumRange(searchPropertiesModel.processorClockSpeed);

            RAM ramNode = new RAM();

            ramNode.Geheugenslots = searchPropertiesModel.memorySlots;
            ramNode.Geheugen      = searchPropertiesModel.memorySpeed;

            HardDrive hardDriveNode = new HardDrive();

            hardDriveNode.Soort         = searchPropertiesModel.hardDrivetype;
            hardDriveNode.MinimumOpslag = hardDriveNode.setMinimumRange(searchPropertiesModel.hardDriveCapacity);
            hardDriveNode.MaximumOpslag = hardDriveNode.setMaximumRange(searchPropertiesModel.hardDriveCapacity);

            GraphicCard graphicCardNode = new GraphicCard();

            graphicCardNode.Videogeheugen = searchPropertiesModel.graphicCardSpeed;
            graphicCardNode.Typegeheugen  = searchPropertiesModel.graphicCardType;

            OpticalDrive opticalDriveNode = new OpticalDrive();

            opticalDriveNode.Categorie = searchPropertiesModel.opticalDriveCategory;

            //Check if the cpu

            if ((isMotherboardPropertiesFilled(motherboardNode)) && (isRAMPropertiesFilled(ramNode)) && (isCPUPropertiesFilled(processorNode)))
            {
                queryReadMotherboard(motherboardNode, processorNode, ramNode, listMotherboard);
                queryReadProcessor(motherboardNode, processorNode, ramNode, listProcessor);
                queryReadRAM(motherboardNode, processorNode, ramNode, listRAM);
            }
            else if (isCPUPropertiesFilled(processorNode))
            {
                if (isMotherboardPropertiesFilled(motherboardNode))
                {
                    //Run Query with CPU and Motherboard defined
                    queryReadProcessorMotherboardDefined(processorNode, motherboardNode, listProcessor, listMotherboard, listRAM);
                }
                else if (isRAMPropertiesFilled(ramNode))
                {
                    //Run Query with CPU and RAM defined
                    queryReadProcessorRAMDefined(processorNode, ramNode, listProcessor, listMotherboard, listRAM);
                }
                else
                {
                    //Run Query with CPU only defined.
                    queryReadProcessorOnlyDefined(processorNode, listProcessor, listMotherboard, listRAM);
                }
            }
            else
            {
                //Abort operation.
            }



            //Run all the queries necesary to retrieve the nodes

            /*
             * queryReadMotherboard(motherboardNode, processorNode, ramNode, listMotherboard);
             * queryReadProcessor(motherboardNode, processorNode, ramNode, listProcessor);
             * queryReadRAM(motherboardNode, processorNode, ramNode, listRAM);
             */
            queryReadComputerCase(motherboardNode, processorNode, listComputerCase);
            queryReadHardDrive(hardDriveNode, listHardDrive);
            queryReadGraphicCard(graphicCardNode, listGraphicCard);
            queryReadOpticalDrive(opticalDriveNode, listOpticalDrive);
            queryReadCooler(processorNode, listProcessorCooler);
            queryReadPowerSupply(listPowerSupply);
        }