Cassie Mod

Cassie Mod

  • NA
  • 488
  • 69.9k

get all items from model

Feb 1 2016 5:18 AM
  1. 01.<script type="text/javascript">    
  2. 02.    $(document).ready(function () {    
  3. 03.    
  4. 04. $("#collectorscompleted").kendoChart({    
  5. 05.        legend: {    
  6. 06.            visible: false    
  7. 07.        },    
  8. 08.        seriesDefaults: {    
  9. 09.            type: "column"    
  10. 10.        },    
  11. 11.        series: [{    
  12. 12.            name: "Completed",    
  13. 13.            data: [@Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID==1), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 2), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 3), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 4),    
  14. 14.                   @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 5), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 6), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 7), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 8),    
  15. 15.                   @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 9), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 10), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 13), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 14),    
  16. 16.                   @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 15), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 16), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 17), @Model.CollectorStatus.Count(c => c.BatchCompleted == true && c.CollectorID == 18)]    
  17. 17.                   // This needs to be in less code   
  18.   
  19. 18.        }, {    
  20. 19.            name: "Failed",    
  21. 20.            data: [@Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID==1), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 2), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 3), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 4),    
  22. 21.                   @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 5), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 6), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 7), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 8),    
  23. 22.                   @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 9), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 10), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 13), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 14),    
  24. 23.                   @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 15), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 16), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 17), @Model.CollectorStatus.Count(c => !c.BatchCompleted == true && c.CollectorID == 18)]    
  25. 24.                   // this needs to be in less code    
  26.   
  27. 25.        }],    
  28. 26.        valueAxis: {    
  29. 27.            labels: {    
  30. 28.                visible: false    
  31. 29.            },    
  32. 30.            line: {    
  33. 31.                visible: false    
  34. 32.            },    
  35. 33.            majorGridLines: {    
  36. 34.                visible: false    
  37. 35.            }    
  38. 36.        },    
  39. 37.        categoryAxis: {    
  40. 38.            categories: [1,2,3,4,5,6,7,8,9,10,13,14,15,16,17,18],    // this needs to be changed
  41.   
  42. 39.             // needs to be replaces  
  43.   
  44. 40.            line: {    
  45. 41.                visible: false    
  46. 42.            },    
  47. 43.            majorGridLines: {    
  48. 44.                visible: false    
  49. 45.            }    
  50. 46.        },    
  51. 47.        chartArea: {    
  52. 48.            background: "none"    
  53. 49.        },    
  54. 50.        tooltip: {    
  55. 51.            visible: true,    
  56. 52.            format: "{0}",    
  57. 53.            template"#= series.name #: #= value #"    
  58. 54.        }    
  59. 55.    });    
  60. 56.});    
  61. 57.    
  62. 58.</script>    
HI Ive got the following question. How can i get an array wich contains all the collector ID's from the Model.CollectorStatus (asp.net) ?? Now it it hard typed wich is wrong. thnx guys

Answers (1)