/// <summary> ///Update the items source from the ProductSalesCollection /// </summary> /// <param name="loc"></param> private void UpdateItemsSource(string loc) { ProductSales dr = null; switch (loc) { case "Add at Top": dr = new ProductSales { Country = "Canada", State = "Brunswick", Product = "Bike", Date = "FY 2003", Quantity = 1, Amount = 100d }; break; case "Add at Middle": dr = new ProductSales { Country = "Canada", State = "Brunswick", Product = "Bike", Date = "FY 2007", Quantity = 1, Amount = 200d }; break; case "Add at Bottom": dr = new ProductSales { Country = "Canada", State = "Brunswick", Product = "Bike", Date = "FY 2010", Quantity = 1, Amount = 300d }; break; } productSalesData.Add(dr); pivotGridControl1.Refresh(true); }
public static ProductSalesCollection GetSalesData() { // Geography string[] countries = { "Canada" }; string[] canadaStates = { "Alberta", "British Columbia", "Ontario" }; // Time string[] dates = { "FY 2005", "FY 2006", "FY 2007" }; // Products string[] products = { "Bike", "Car" }; Random r = new Random(123345345); int numberOfRecords = 2000; ProductSalesCollection listOfProductSales = new ProductSalesCollection(); for (int i = 0; i < numberOfRecords; i++) { ProductSales sales = new ProductSales(); sales.Country = countries[r.Next(0, countries.GetLength(0))]; sales.Quantity = r.Next(1, 12); // 1 percent discount for 1 quantity double discount = (30000 * sales.Quantity) * (double.Parse(sales.Quantity.ToString()) / 100); sales.Amount = (30000 * sales.Quantity) - discount; sales.Year = dates[r.Next(r.Next(dates.GetLength(0) + 1))]; sales.Product = products[r.Next(r.Next(products.GetLength(0) + 1))]; sales.State = canadaStates[r.Next(canadaStates.GetLength(0))]; listOfProductSales.Add(sales); } return listOfProductSales; }
public static ProductSalesCollection GetSalesData(int recordCount) { // Geography string[] countries = { "Canada" }; string[] canadaStates = { "Alberta", "British Columbia", "Ontario", "Manitoba", "New Brunswick", "Nova Scotia", "Quebec", "Nunavut", "Yukon" }; // Time string[] dates = { "FY 2005", "FY 2006", "FY 2007", "FY 2008", "FY 2009", "FY 2010", "FY 2011", "FY 2012", "FY 2013", "FY 2014", "FY 2015", "FY 2016" }; // Products string[] products = { "Bike", "Car" }; Random r = new Random(123345345); int numberOfRecords = recordCount; ProductSalesCollection listOfProductSales = new ProductSalesCollection(); for (int i = 0; i < numberOfRecords; i++) { ProductSales sales = new ProductSales(); sales.Country = countries[r.Next(0, countries.GetLength(0))]; sales.Quantity = r.Next(1, 12); // 1 percent discount for 1 quantity double discount = (30000 * sales.Quantity) * (double.Parse(sales.Quantity.ToString()) / 100); sales.Amount = (30000 * sales.Quantity) - discount; sales.Year = dates[r.Next(r.Next(dates.GetLength(0) + 1))]; sales.Product = products[r.Next(r.Next(products.GetLength(0) + 1))]; sales.State = canadaStates[r.Next(canadaStates.GetLength(0))]; listOfProductSales.Add(sales); } return(listOfProductSales); }
public static ProductSalesCollection UpdateSalesData(ProductSalesCollection dataToModify) { int numberOfRecords = 20; string[] ausStates = new string[] { "New South Wales", "Queensland", "South Australia", "Tasmania", "Victoria" }; // Time string[] dates = new string[] { "FY 2005", "FY 2006", "FY 2007", "FY 2008", "FY 2009" }; // Products string[] products = new string[] { "Bike", "Car" }; Random r = new Random(10022); for (int i = 0; i < numberOfRecords; i++) { ProductSales sales = new ProductSales(); sales.Country = "Australia"; sales.Quantity = r.Next(1, 12); // 1 percent discount for 1 quantity double discount = (30000 * sales.Quantity) * (double.Parse(sales.Quantity.ToString()) / 100); sales.Amount = (30000 * sales.Quantity) - discount; sales.Date = dates[r.Next(r.Next(dates.GetLength(0) + 1))]; sales.Product = products[r.Next(r.Next(products.GetLength(0) + 1))]; switch (sales.Country) { case "Australia": { sales.State = ausStates[r.Next(ausStates.GetLength(0))]; break; } } dataToModify.Add(sales); } return(dataToModify); }
public static ProductSalesCollection GetSalesData() { /// Geography string[] countries = new string[] { "Australia", "Canada", "France", "Germany", "United Kingdom", "United States" }; string[] ausStates = new string[] { "New South Wales", "Queensland", "South Australia", "Tasmania", "Victoria" }; string[] canadaStates = new string[] { "Alberta", "British Columbia", "Brunswick", "Manitoba", "Ontario", "Quebec" }; string[] franceStates = new string[] { "Charente-Maritime", "Essonne", "Garonne (Haute)", "Gers", }; string[] germanyStates = new string[] { "Bayern", "Brandenburg", "Hamburg", "Hessen", "Nordrhein-Westfalen", "Saarland" }; string[] ukStates = new string[] { "England" }; string[] ussStates = new string[] { "New York", "North Carolina", "Alabama", "California", "Colorado", "New Mexico", "South Carolina" }; /// Time string[] dates = new string[] { "FY 2005", "FY 2006", "FY 2007", "FY 2008", "FY 2009" }; /// Products string[] products = new string[] { "Bike", "Car" }; Random r = new Random(123345345); int numberOfRecords = 2000; ProductSalesCollection listOfProductSales = new ProductSalesCollection(); for (int i = 0; i < numberOfRecords; i++) { ProductSales sales = new ProductSales(); sales.Country = countries[r.Next(1, countries.GetLength(0))]; sales.Quantity = r.Next(1, 12); /// 1 percent discount for 1 quantity double discount = (30000 * sales.Quantity) * (double.Parse(sales.Quantity.ToString()) / 100); sales.Amount = (30000 * sales.Quantity) - discount; sales.Date = dates[r.Next(r.Next(dates.GetLength(0) + 1))]; sales.Product = products[r.Next(r.Next(products.GetLength(0) + 1))]; sales.DateRequired = DateTime.Now.AddDays(r.Next(1000)); switch (sales.Country) { case "Australia": { sales.State = ausStates[r.Next(ausStates.GetLength(0))]; break; } case "Canada": { sales.State = canadaStates[r.Next(canadaStates.GetLength(0))]; break; } case "France": { sales.State = franceStates[r.Next(franceStates.GetLength(0))]; break; } case "Germany": { sales.State = germanyStates[r.Next(germanyStates.GetLength(0))]; break; } case "United Kingdom": { sales.State = ukStates[r.Next(ukStates.GetLength(0))]; break; } case "United States": { sales.State = ussStates[r.Next(ussStates.GetLength(0))]; break; } } listOfProductSales.Add(sales); } return(listOfProductSales); }
/// <summary> /// Make a data for Data Source /// </summary> public static ProductSalesCollection GetSalesData() { // Geography string[] countries = { "Australia", "Canada", "France", "Germany", "United Kingdom" }; string[] ausStates = { "New South Wales", "Queensland", "South Australia" }; string[] canadaStates = { "Alberta", "British Columbia", "Brunswick" }; string[] franceStates = { "Charente Maritime", "Essonne", "Garonne (Haute)" }; string[] germanyStates = { "Bayern", "Brandenburg", "Hamburg", "Hessen" }; string[] ukStates = { "England" }; // Time string[] dates = { "FY 2005", "FY 2006", "FY 2007", "FY 2008" }; // Products string[] products = { "Bike", "Car" }; Random r = new Random(123345345); int numberOfRecords = 2000; ProductSalesCollection listOfProductSales = new ProductSalesCollection(); for (int i = 0; i < numberOfRecords; i++) { ProductSales sales = new ProductSales(); sales.Country = countries[r.Next(1, countries.GetLength(0))]; sales.Quantity = r.Next(1, 12); // 1 percent discount for 1 quantity double discount = (3000 * sales.Quantity) * (double.Parse(sales.Quantity.ToString()) / 100); sales.Amount = (3000 * sales.Quantity) - discount; sales.TotalPrice = sales.Amount * sales.Quantity; sales.UnitPrice = sales.Amount / sales.Quantity; sales.Date = dates[r.Next(r.Next(dates.GetLength(0) + 1))]; sales.Product = products[r.Next(r.Next(products.GetLength(0) + 1))]; switch (sales.Country) { case "Australia": { sales.State = ausStates[r.Next(ausStates.GetLength(0))]; break; } case "Canada": { sales.State = canadaStates[r.Next(canadaStates.GetLength(0))]; break; } case "France": { sales.State = franceStates[r.Next(franceStates.GetLength(0))]; break; } case "Germany": { sales.State = germanyStates[r.Next(germanyStates.GetLength(0))]; break; } case "United Kingdom": { sales.State = ukStates[r.Next(ukStates.GetLength(0))]; break; } } listOfProductSales.Add(sales); } return(listOfProductSales); }
/// <summary> /// Data collections for Data Source /// </summary> /// <returns></returns> public static ProductSalesCollection GetSalesData() { // Geography string[] countries = { "Australien", "Kanada", "Frankreich", "Deutschland", "Vereinigtes Königreich", "Vereinigte Staaten" }; string[] ausStates = { "New South Wales", "Queensland", "South Australia", "Tasmania", "Victoria" }; string[] canadaStates = { "Albertaien", "Britisch-Kolumbien", "Braunschweig", "Manitoba", "Ontario", "Quebec" }; string[] franceStates = { "Charente Maritime", "Essonne", "Garonne (Haute)", "Gers" }; string[] germanyStates = { "Bayern", "Brandenburg", "Hamburg", "Hessen", "Nordrhein Westfalen", "Saarland" }; string[] ukStates = { "England" }; string[] ussStates = { "New York", "North Carolina", "Alabama", "California", "Colorado", "New Mexico", "South Carolina" }; // Time string[] dates = { "Geschäf 2005", "Geschäf 2006", "Geschäf 2007", "Geschäf 2008", "Geschäf 2009" }; // Products string[] products = { "Fahrrad", "Auto" }; Random r = new Random(123345345); int numberOfRecords = 2000; ProductSalesCollection listOfProductSales = new ProductSalesCollection(); for (int i = 0; i < numberOfRecords; i++) { ProductSales sales = new ProductSales(); sales.Country = countries[r.Next(1, countries.GetLength(0))]; sales.Quantity = r.Next(1, 12); // 1 percent discount for 1 quantity double discount = (300 * sales.Quantity) * (double.Parse(sales.Quantity.ToString()) / 100); sales.Amount = (300 * sales.Quantity) - discount; sales.TotalPrice = sales.Amount * sales.Quantity; sales.UnitPrice = sales.Amount / sales.Quantity; sales.Date = dates[r.Next(r.Next(dates.GetLength(0) + 1))]; sales.Product = products[r.Next(r.Next(products.GetLength(0) + 1))]; switch (sales.Country) { case "Australien": { sales.State = ausStates[r.Next(ausStates.GetLength(0))]; break; } case "Kanada": { sales.State = canadaStates[r.Next(canadaStates.GetLength(0))]; break; } case "Frankreich": { sales.State = franceStates[r.Next(franceStates.GetLength(0))]; break; } case "Deutschland": { sales.State = germanyStates[r.Next(germanyStates.GetLength(0))]; break; } case "Vereinigtes Königreich": { sales.State = ukStates[r.Next(ukStates.GetLength(0))]; break; } case "Vereinigte Staaten": { sales.State = ussStates[r.Next(ussStates.GetLength(0))]; break; } } listOfProductSales.Add(sales); } return(listOfProductSales); }
/// <summary> /// Returns the collection of objects from item source. /// </summary> /// <returns></returns> public static ProductSalesCollection GetSalesData() { // Geography string[] countries = new string[] { "Germany", "Canada", "United States" }; string[] ausStates = new string[] { "New South Wales", "Queensland", }; string[] canadaStates = new string[] { "Ontario", "Quebec" }; string[] germanyStates = new string[] { "Bayern", "Brandenburg" }; string[] ussStates = new string[] { "New York", "Colorado", "New Mexico" }; // Time string[] dates = new string[] { "FY 2008", "FY 2009", "FY 2010", "FY 2012" }; // Products string[] products = new string[] { "Bike", "Car" }; Random r = new Random(123345); int numberOfRecords = 2000; ProductSalesCollection listOfProductSales = new ProductSalesCollection(); for (int i = 0; i < numberOfRecords; i++) { ProductSales sales = new ProductSales(); sales.Country = countries[r.Next(1, countries.GetLength(0))]; sales.Quantity = r.Next(1, 12); // 1 percent discount for 1 quantity double discount = (30000 * sales.Quantity) * (double.Parse(sales.Quantity.ToString()) / 100); sales.Amount = (30000 * sales.Quantity) - discount; sales.TotalPrice = sales.Amount * sales.Quantity; sales.UnitPrice = sales.Amount / sales.Quantity; sales.Date = dates[r.Next(r.Next(dates.GetLength(0) + 1))]; sales.Product = products[r.Next(r.Next(products.GetLength(0) + 1))]; switch (sales.Country) { case "Australia": { sales.State = ausStates[r.Next(ausStates.GetLength(0))]; break; } case "Canada": { sales.State = canadaStates[r.Next(canadaStates.GetLength(0))]; break; } case "Germany": { sales.State = germanyStates[r.Next(germanyStates.GetLength(0))]; break; } case "United States": { sales.State = ussStates[r.Next(ussStates.GetLength(0))]; break; } } listOfProductSales.Add(sales); } return(listOfProductSales); }