@@ -54,62 +54,19 @@ public ObservableCollection<ProductSalesDetails> ProductInfo
5454 /// <returns></returns>
5555 public ObservableCollection < ProductSalesDetails > GetSalesInfo ( )
5656 {
57- /// Geography
58- string [ ] countries = new string [ ] { "Australia" , "Canada" , "France" , "Germany" , "United States" } ;
59- string [ ] ausStates = new string [ ] { "New South Wales" , "Queensland" , "South Australia" , "Tasmania" , "Victoria" } ;
60- string [ ] canadaStates = new string [ ] { "Alberta" , "British Columbia" , "Brunswick" , "Manitoba" , "Ontario" , "Quebec" } ;
61- string [ ] franceStates = new string [ ] { "Charente-Maritime" , "Essonne" , "Garonne (Haute)" , "Gers" , } ;
62- string [ ] germanyStates = new string [ ] { "Bayern" , "Brandenburg" , "Hamburg" , "Hessen" , "Nordrhein-Westfalen" , "Saarland" } ;
57+ _productInfo = new ObservableCollection < ProductSalesDetails > ( ) ;
58+ _productInfo . Add ( new ProductSalesDetails ( "Bike" , "Germany" , "Bayern" , 9 , 12 , 25000 ) ) ;
59+ _productInfo . Add ( new ProductSalesDetails ( "Bike" , "Germany" , "Brandenburg" , 8 , 14 , 36000 ) ) ;
60+ _productInfo . Add ( new ProductSalesDetails ( "Bike" , "Germany" , "Hamburg" , 5 , 8 , 40040 ) ) ;
61+ _productInfo . Add ( new ProductSalesDetails ( "Car" , "Germany" , "Hessen" , 3 , 10 , 10700 ) ) ;
62+ _productInfo . Add ( new ProductSalesDetails ( "Car" , "Germany" , "Bayern" , 8 , 13 , 20300 ) ) ;
63+ _productInfo . Add ( new ProductSalesDetails ( "Truck" , "Australia" , "Queensland" , 5 , 7 , 50700 ) ) ;
64+ _productInfo . Add ( new ProductSalesDetails ( "Van" , "Canada" , "Alberta" , 6 , 8 , 80100 ) ) ;
65+ _productInfo . Add ( new ProductSalesDetails ( "BiCycle" , "Canada" , "Brunswick" , 2 , 6 , 35000 ) ) ;
66+ _productInfo . Add ( new ProductSalesDetails ( "Car" , "France" , "Essonne" , 4 , 8 , 20030 ) ) ;
67+ _productInfo . Add ( new ProductSalesDetails ( "Bike" , "United States" , "New York" , 3 , 7 , 54000 ) ) ;
6368
64- string [ ] ussStates = new string [ ] { "New York" , "North Carolina" , "Alabama" , "California" , "Colorado" , "New Mexico" , "South Carolina" } ;
65-
66- /// Products
67- string [ ] products = new string [ ] { "Bike" , "Car" , "Truck" , "Van" , "BiCycle" } ;
68- Random r = new Random ( 0 ) ;
69-
70- int numberOfRecords = 10 ;
71- ObservableCollection < ProductSalesDetails > listOfProductSales = new ObservableCollection < ProductSalesDetails > ( ) ;
72- for ( int i = 0 ; i < numberOfRecords ; i ++ )
73- {
74- ProductSalesDetails sales = new ProductSalesDetails ( ) ;
75- sales . Country = countries [ r . Next ( 1 , countries . GetLength ( 0 ) ) ] ;
76- sales . Quantity = r . Next ( 1 , 12 ) ;
77- sales . Discount = r . Next ( 1 , 15 ) ;
78- sales . Amount = ( 30000 * sales . Quantity ) ;
79- sales . Product = products [ r . Next ( r . Next ( products . GetLength ( 0 ) + 1 ) ) ] ;
80- switch ( sales . Country )
81- {
82- case "Australia" :
83- {
84- sales . State = ausStates [ r . Next ( ausStates . GetLength ( 0 ) ) ] ;
85- break ;
86- }
87- case "Canada" :
88- {
89- sales . State = canadaStates [ r . Next ( canadaStates . GetLength ( 0 ) ) ] ;
90- break ;
91- }
92- case "France" :
93- {
94- sales . State = franceStates [ r . Next ( franceStates . GetLength ( 0 ) ) ] ;
95- break ;
96- }
97- case "Germany" :
98- {
99- sales . State = germanyStates [ r . Next ( germanyStates . GetLength ( 0 ) ) ] ;
100- break ;
101- }
102- case "United States" :
103- {
104- sales . State = ussStates [ r . Next ( ussStates . GetLength ( 0 ) ) ] ;
105- break ;
106- }
107- }
108-
109- listOfProductSales . Add ( sales ) ;
110- }
111-
112- return listOfProductSales ;
69+ return _productInfo ;
11370 }
11471 }
11572}
0 commit comments