Guest User

Untitled

a guest
Jan 22nd, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.60 KB | None | 0 0
  1. <Recordset>
  2. <AUCCars>
  3. <Web_Series>5 Series</Web_Series>
  4. <Body_Desc>Sedan</Body_Desc>
  5. <Model_Type>550i (E60)</Model_Type>
  6. <Model_Year>2006</Model_Year>
  7. <Ext_Colour>Alpine White III - Non-Metallic</Ext_Colour>
  8. <Int_Colour>Leather Dakota Black - Dakota Leather</Int_Colour>
  9. <Price>R 579000</Price>
  10. <Search_Price>579000</Search_Price>
  11. <Province>Gauteng</Province>
  12. <AucID>106288</AucID>
  13. <DealerID>45</DealerID>
  14. <DealerCode>29968</DealerCode>
  15. <DealerName>Lyndhurst Auto</DealerName>
  16. <Transmission>Automatic</Transmission>
  17. <AirCon>n/a</AirCon>
  18. <Radio>Yes</Radio>
  19. <PSteering>Yes</PSteering>
  20. <ABS>Yes</ABS>
  21. <Airbag>Yes</Airbag>
  22. <Sunroof>Yes</Sunroof>
  23. <Km>11500</Km>
  24. <Motorplan>Yes</Motorplan>
  25. <Warranty>N</Warranty>
  26. <BodyNo>6CR76051</BodyNo>
  27. <ModelOEM>NB52</ModelOEM>
  28. <ColourOEM>300</ColourOEM>
  29. <TrimOEM>LCSW</TrimOEM>
  30. <WheelsOEM></WheelsOEM>
  31. <Sold>N</Sold>
  32. <Notes> </Notes>
  33. <Moreoptions>Automatic Transmission with Steptronic
  34. Interior trim finishers, Fine-wood, Poplar Grain Brown, high-gloss
  35. Park Distance Control (PDC),front and rear</Moreoptions>
  36. <Picture>Vehicle_PicturesE60LIfrontview_big_P0300.jpg</Picture>
  37. <PictureRear>Vehicle_PicturesE60LIrearview_big_P0300.jpg</PictureRear>
  38. <Interior>Vehicle_PicturesE60LIInteriorbig_Fo_LCSW.jpg</Interior>
  39. </AUCCars>
  40. <AUCCars>
  41. <Web_Series>5 Series</Web_Series>
  42. <Body_Desc>Sedan</Body_Desc>
  43. <Model_Type>550i (E60)</Model_Type>
  44. <Model_Year>2006</Model_Year>
  45. <Ext_Colour>Black Sapphire - Metallic</Ext_Colour>
  46. <Int_Colour>Amethyst Black Exclusive Leather - Exclusive Leather</Int_Colour>
  47. <Price>R 529990</Price>
  48. <Search_Price>529990</Search_Price>
  49. <Province>KwaZulu Natal</Province>
  50. <AucID>111922</AucID>
  51. <DealerID>17</DealerID>
  52. <DealerCode>2485</DealerCode>
  53. <DealerName>Supertech</DealerName>
  54. <Transmission>Automatic</Transmission>
  55. <AirCon> Yes</AirCon>
  56. <Radio>Yes</Radio>
  57. <PSteering>Yes</PSteering>
  58. <ABS>Yes</ABS>
  59. <Airbag>Yes</Airbag>
  60. <Sunroof>n/a</Sunroof>
  61. <Km>7000</Km>
  62. <Motorplan>n/a</Motorplan>
  63. <Warranty>N</Warranty>
  64. <BodyNo>6CR75567</BodyNo>
  65. <ModelOEM>NB52</ModelOEM>
  66. <ColourOEM>475</ColourOEM>
  67. <TrimOEM>LDRH</TrimOEM>
  68. <WheelsOEM></WheelsOEM>
  69. <Sold>N</Sold>
  70. <Notes> </Notes>
  71. <Moreoptions>Automatic Transmission with Steptronic
  72. Electric Rear Screen Roller Sun Blind with manual Side Blinds
  73. Interior trim finishers, Fine-wood, Poplar Grain Brown, high-gloss
  74. High Beam Assist
  75. Head-up display (not with SA354)</Moreoptions>
  76. <Picture>Vehicle_PicturesE60LIfrontview_big_P0475.jpg</Picture>
  77. <PictureRear>Vehicle_PicturesE60LIrearview_big_P0475.jpg</PictureRear>
  78. <Interior>Vehicle_PicturesE60LIInteriorbig_Fo_LDRH.jpg</Interior>
  79. </AUCCars>
  80. <Recordset>
  81.  
  82. // get data from file
  83. XElement aucCars = XElement.Load("data.xml");
  84. private void cmbSeries_SelectedIndexChanged(object sender, EventArgs e)
  85. {
  86. if (cmbSeries.SelectedItem != null)
  87. {
  88. string currentSeries = cmbSeries.SelectedItem.ToString();
  89. var models = (from a in aucCars.Elements()
  90. where a.Element("Web_Series").Value == currentSeries
  91. select a.Element("Model_Type").Value).Distinct().ToList();
  92. cmbModel.DataSource = models;
  93. }
  94. showAucCars();
  95. }
  96. private void cmbModel_SelectedIndexChanged(object sender, EventArgs e)
  97. {
  98. if (cmbModel.SelectedItem != null)
  99. {
  100. string currentSeries = cmbSeries.SelectedItem.ToString();
  101. string currentModel = cmbModel.SelectedItem.ToString();
  102.  
  103. var years = (from a in aucCars.Elements()
  104. where a.Element("Web_Series").Value == currentSeries &&
  105. a.Element("Model_Type").Value == currentModel
  106. select a.Element("Model_Year").Value).Distinct().ToList();
  107. cmbYear.DataSource = years;
  108. }
  109. showAucCars();
  110. }
  111. private void cmbYear_SelectedIndexChanged(object sender, EventArgs e)
  112. {
  113. showAucCars();
  114. }
  115. private void frmXmlLoad_Load(object sender, EventArgs e)
  116. {
  117. var series = (from a in aucCars.Elements()
  118. select a.Element("Web_Series").Value).Distinct().ToList();
  119. cmbSeries.DataSource = series;
  120. }
  121. private void showAucCars()
  122. {
  123. var filterCars = aucCars.Elements();
  124. if (cmbSeries.SelectedItem!=null)
  125. {
  126. string currentSeries = cmbSeries.SelectedItem.ToString();
  127. filterCars = from a in filterCars
  128. where a.Element("Web_Series").Value == currentSeries
  129. select a;
  130. }
  131. if (cmbSeries.SelectedItem != null)
  132. {
  133. string currentModel = cmbModel.SelectedItem.ToString();
  134. filterCars = from a in filterCars
  135. where a.Element("Model_Type").Value == currentModel
  136. select a;
  137. }
  138. if (cmbSeries.SelectedItem != null)
  139. {
  140. string currentYear = cmbYear.SelectedItem.ToString();
  141. filterCars = from a in filterCars
  142. where a.Element("Model_Year").Value == currentYear
  143. select a;
  144. }
  145. // will show all the element data
  146. // add a new linq stmt to select specific elements
  147. listBox1.DataSource = filterCars.ToList();
  148. }
Add Comment
Please, Sign In to add comment