//LINQ Query for browser details object private List <Frame> getFramesByQuery(BrowserDetails browserDetails) { //Select var frames = from frame in this.frames where browserDetails.gender.Contains(frame.getFrameProperties().gender) && //frame.getFrameProperties().faceShapes.All(temp => browserDetails.faceShape.Contains(temp)) && browserDetails.faceShape.Any(temp => frame.getFrameProperties().faceShapes.Contains(temp)) && browserDetails.colours.Contains(frame.getFrameProperties().colour) && browserDetails.materials.Contains(frame.getFrameProperties().material) && browserDetails.types.Contains(frame.getFrameProperties().type) && browserDetails.sideLengths.Contains(frame.getFrameProperties().patientSideLength) && browserDetails.faceWidths.Contains(frame.getFrameProperties().patientFaceWidth) select frame; //Only filter by vari if true, else just all frames are returned //I.e when you filter by vari you get all suitable vari frames and //when you dont you get all frames if (browserDetails.isVari) { frames = from frame in frames where frame.getFrameProperties().vari == browserDetails.isVari select frame; } if (browserDetails.isSunglass) { frames = from frame in frames where frame.getFrameProperties().isSunglass == browserDetails.isSunglass select frame; } //Sorting foreach (var sortWord in browserDetails.sortWords) { frames = orderBySortWord(frames, sortWord); } return(frames.ToList <Frame>()); }
//Generates a list based on browser details object public List <Frame> generateFrameList(BrowserDetails browserDetails) { List <Frame> frames = getFramesByQuery(browserDetails); return(frames); }
public void setBrowserDetails(BrowserDetails browserDetails) { this.browserDetails = browserDetails; }