public void queryReadHardDrive(HardDrive hardDriveNode, List <HardDrive> listHardDrive) { // This query is to return the HardDrive node. initClientConnection(); var result = this.client.Cypher .Match(" (h:Hardeschijf)") .Where("h.Opslag >= " + hardDriveNode.MinimumOpslag + " AND h.Opslag <= " + hardDriveNode.MaximumOpslag) .AndWhere((HardDrive h) => h.Soort == hardDriveNode.Soort) .ReturnDistinct((h) => new { listH = h.As <HardDrive>(), }) .Limit(500) .Results; foreach (var a in result) { listHardDrive.Add(a.listH); } }
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); }