Files
MauiCourse/AdventureWorks.DataLayer/DataClasses/ProductRepository.cs

519 lines
17 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using AdventureWorks.EntityLayer;
using Common.Library;
namespace AdventureWorks.DataLayer;
/// <summary>
/// This class creates some fake data for Products.
/// </summary>
public partial class ProductRepository : IRepository<Product>
{
#region Get Method
/// <summary>
/// Get all Product objects
/// </summary>
/// <returns>A list of Product objects</returns>
public ObservableCollection<Product> Get()
{
return new ObservableCollection<Product>
{
new Product {
ProductID = 680,
Name = @"HL Road Frame - Black, 58",
ProductNumber = @"FR-R92B-58",
Color = @"Black",
StandardCost = 1059.3100m,
ListPrice = 1431.5000m,
Size = @"58",
Weight = 1016.04m,
ProductCategoryID = 18,
ProductModelID = 6,
SellStartDate = Convert.ToDateTime("6/1/2002 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 706,
Name = @"HL Road Frame - Red, 58",
ProductNumber = @"FR-R92R-58",
Color = @"Red",
StandardCost = 1059.3100m,
ListPrice = 1431.5000m,
Size = @"58",
Weight = 1016.04m,
ProductCategoryID = 18,
ProductModelID = 6,
SellStartDate = Convert.ToDateTime("6/1/2002 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 707,
Name = @"Sport-100 Helmet, Red",
ProductNumber = @"HL-U509-R",
Color = @"Red",
StandardCost = 13.0863m,
ListPrice = 34.9900m,
Size = string.Empty,
Weight = null,
ProductCategoryID = 35,
ProductModelID = 33,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 708,
Name = @"Sport-100 Helmet, Black",
ProductNumber = @"HL-U509",
Color = @"Black",
StandardCost = 13.0863m,
ListPrice = 34.9900m,
Size = string.Empty,
Weight = null,
ProductCategoryID = 35,
ProductModelID = 33,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 709,
Name = @"Mountain Bike Socks, M",
ProductNumber = @"SO-B909-M",
Color = @"White",
StandardCost = 3.3963m,
ListPrice = 9.5000m,
Size = @"M",
Weight = null,
ProductCategoryID = 27,
ProductModelID = 18,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 710,
Name = @"Mountain Bike Socks, L",
ProductNumber = @"SO-B909-L",
Color = @"White",
StandardCost = 3.3963m,
ListPrice = 9.5000m,
Size = @"L",
Weight = null,
ProductCategoryID = 27,
ProductModelID = 18,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 711,
Name = @"Sport-100 Helmet, Blue",
ProductNumber = @"HL-U509-B",
Color = @"Blue",
StandardCost = 13.0863m,
ListPrice = 34.9900m,
Size = string.Empty,
Weight = null,
ProductCategoryID = 35,
ProductModelID = 33,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 712,
Name = @"AWC Logo Cap",
ProductNumber = @"CA-1098",
Color = @"Multi",
StandardCost = 6.9223m,
ListPrice = 8.9900m,
Size = string.Empty,
Weight = null,
ProductCategoryID = 23,
ProductModelID = 2,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 713,
Name = @"Long-Sleeve Logo Jersey, S",
ProductNumber = @"LJ-0192-S",
Color = @"Multi",
StandardCost = 38.4923m,
ListPrice = 49.9900m,
Size = @"S",
Weight = null,
ProductCategoryID = 25,
ProductModelID = 11,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 714,
Name = @"Long-Sleeve Logo Jersey, M",
ProductNumber = @"LJ-0192-M",
Color = @"Multi",
StandardCost = 38.4923m,
ListPrice = 49.9900m,
Size = @"M",
Weight = null,
ProductCategoryID = 25,
ProductModelID = 11,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 715,
Name = @"Long-Sleeve Logo Jersey, L",
ProductNumber = @"LJ-0192-L",
Color = @"Multi",
StandardCost = 38.4923m,
ListPrice = 49.9900m,
Size = @"L",
Weight = null,
ProductCategoryID = 25,
ProductModelID = 11,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 716,
Name = @"Long-Sleeve Logo Jersey, XL",
ProductNumber = @"LJ-0192-X",
Color = @"Multi",
StandardCost = 38.4923m,
ListPrice = 49.9900m,
Size = @"XL",
Weight = null,
ProductCategoryID = 25,
ProductModelID = 11,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 717,
Name = @"HL Road Frame - Red, 62",
ProductNumber = @"FR-R92R-62",
Color = @"Red",
StandardCost = 868.6342m,
ListPrice = 1431.5000m,
Size = @"62",
Weight = 1043.26m,
ProductCategoryID = 18,
ProductModelID = 6,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 718,
Name = @"HL Road Frame - Red, 44",
ProductNumber = @"FR-R92R-44",
Color = @"Red",
StandardCost = 868.6342m,
ListPrice = 1431.5000m,
Size = @"44",
Weight = 961.61m,
ProductCategoryID = 18,
ProductModelID = 6,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 719,
Name = @"HL Road Frame - Red, 48",
ProductNumber = @"FR-R92R-48",
Color = @"Red",
StandardCost = 868.6342m,
ListPrice = 1431.5000m,
Size = @"48",
Weight = 979.75m,
ProductCategoryID = 18,
ProductModelID = 6,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 720,
Name = @"HL Road Frame - Red, 52",
ProductNumber = @"FR-R92R-52",
Color = @"Red",
StandardCost = 868.6342m,
ListPrice = 1431.5000m,
Size = @"52",
Weight = 997.90m,
ProductCategoryID = 18,
ProductModelID = 6,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 721,
Name = @"HL Road Frame - Red, 56",
ProductNumber = @"FR-R92R-56",
Color = @"Red",
StandardCost = 868.6342m,
ListPrice = 1431.5000m,
Size = @"56",
Weight = 1016.04m,
ProductCategoryID = 18,
ProductModelID = 6,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 722,
Name = @"LL Road Frame - Black, 58",
ProductNumber = @"FR-R38B-58",
Color = @"Black",
StandardCost = 204.6251m,
ListPrice = 337.2200m,
Size = @"58",
Weight = 1115.83m,
ProductCategoryID = 18,
ProductModelID = 9,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 723,
Name = @"LL Road Frame - Black, 60",
ProductNumber = @"FR-R38B-60",
Color = @"Black",
StandardCost = 204.6251m,
ListPrice = 337.2200m,
Size = @"60",
Weight = 1124.90m,
ProductCategoryID = 18,
ProductModelID = 9,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 724,
Name = @"LL Road Frame - Black, 62",
ProductNumber = @"FR-R38B-62",
Color = @"Black",
StandardCost = 204.6251m,
ListPrice = 337.2200m,
Size = @"62",
Weight = 1133.98m,
ProductCategoryID = 18,
ProductModelID = 9,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = null,
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 725,
Name = @"LL Road Frame - Red, 44",
ProductNumber = @"FR-R38R-44",
Color = @"Red",
StandardCost = 187.1571m,
ListPrice = 337.2200m,
Size = @"44",
Weight = 1052.33m,
ProductCategoryID = 18,
ProductModelID = 9,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 726,
Name = @"LL Road Frame - Red, 48",
ProductNumber = @"FR-R38R-48",
Color = @"Red",
StandardCost = 187.1571m,
ListPrice = 337.2200m,
Size = @"48",
Weight = 1070.47m,
ProductCategoryID = 18,
ProductModelID = 9,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 727,
Name = @"LL Road Frame - Red, 52",
ProductNumber = @"FR-R38R-52",
Color = @"Red",
StandardCost = 187.1571m,
ListPrice = 337.2200m,
Size = @"52",
Weight = 1088.62m,
ProductCategoryID = 18,
ProductModelID = 9,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 728,
Name = @"LL Road Frame - Red, 58",
ProductNumber = @"FR-R38R-58",
Color = @"Red",
StandardCost = 187.1571m,
ListPrice = 337.2200m,
Size = @"58",
Weight = 1115.83m,
ProductCategoryID = 18,
ProductModelID = 9,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 729,
Name = @"LL Road Frame - Red, 60",
ProductNumber = @"FR-R38R-60",
Color = @"Red",
StandardCost = 187.1571m,
ListPrice = 337.2200m,
Size = @"60",
Weight = 1124.90m,
ProductCategoryID = 18,
ProductModelID = 9,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 730,
Name = @"LL Road Frame - Red, 62",
ProductNumber = @"FR-R38R-62",
Color = @"Red",
StandardCost = 187.1571m,
ListPrice = 337.2200m,
Size = @"62",
Weight = 1133.98m,
ProductCategoryID = 18,
ProductModelID = 9,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 731,
Name = @"ML Road Frame - Red, 44",
ProductNumber = @"FR-R72R-44",
Color = @"Red",
StandardCost = 352.1394m,
ListPrice = 594.8300m,
Size = @"44",
Weight = 1006.97m,
ProductCategoryID = 18,
ProductModelID = 16,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 732,
Name = @"ML Road Frame - Red, 48",
ProductNumber = @"FR-R72R-48",
Color = @"Red",
StandardCost = 352.1394m,
ListPrice = 594.8300m,
Size = @"48",
Weight = 1025.11m,
ProductCategoryID = 18,
ProductModelID = 16,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 733,
Name = @"ML Road Frame - Red, 52",
ProductNumber = @"FR-R72R-52",
Color = @"Red",
StandardCost = 352.1394m,
ListPrice = 594.8300m,
Size = @"52",
Weight = 1043.26m,
ProductCategoryID = 18,
ProductModelID = 16,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
},
new Product {
ProductID = 734,
Name = @"ML Road Frame - Red, 58",
ProductNumber = @"FR-R72R-58",
Color = @"Red",
StandardCost = 352.1394m,
ListPrice = 594.8300m,
Size = @"58",
Weight = 1070.47m,
ProductCategoryID = 18,
ProductModelID = 16,
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
DiscontinuedDate = null,
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
}
};
}
#endregion
#region Get(id) Method
/// <summary>
/// Get a single Product object
/// </summary>
/// <param name="id">The value to locate</param>
/// <returns>A valid Product object object, or null if not found</returns>
public Product? Get(int id)
{
return Get().Where(row => row.ProductID == id).FirstOrDefault();
}
#endregion
}