示例#1
0
    public static IList <AdventureWorks.Product> GetProducts()
    {
        if (_products != null)
        {
            return(_products);
        }

        _products = new List <AdventureWorks.Product>();

        var lines = System.IO.File.ReadAllLines(@"textData\products.txt");

        foreach (var line in lines)
        {
            var columns = line.Split('\t');

            //,[Name]
            //  ,[ProductNumber]
            //  ,[rowguid]
            //  ,[ModifiedDate]

            var p = new AdventureWorks.Product();
            p.Id   = new Guid(columns[0]);
            p.Code = columns[1];

            p.Name = columns[2];

            DateTime modifiedOn;
            if (DateTime.TryParse(columns[3], out modifiedOn))
            {
                p.ModifiedOn = modifiedOn.ToUniversalTime();
            }
            else
            {
                p.ModifiedOn = DateTime.UtcNow;
            }

            _products.Add(p);
        }


        return(_products);
    }
 /// <summary>
 /// Create a new Product object.
 /// </summary>
 /// <param name="productID">Initial value of the ProductID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="productNumber">Initial value of the ProductNumber property.</param>
 /// <param name="makeFlag">Initial value of the MakeFlag property.</param>
 /// <param name="finishedGoodsFlag">Initial value of the FinishedGoodsFlag property.</param>
 /// <param name="safetyStockLevel">Initial value of the SafetyStockLevel property.</param>
 /// <param name="reorderPoint">Initial value of the ReorderPoint property.</param>
 /// <param name="standardCost">Initial value of the StandardCost property.</param>
 /// <param name="listPrice">Initial value of the ListPrice property.</param>
 /// <param name="daysToManufacture">Initial value of the DaysToManufacture property.</param>
 /// <param name="sellStartDate">Initial value of the SellStartDate property.</param>
 /// <param name="rowguid">Initial value of the rowguid property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Product CreateProduct(global::System.Int32 productID, global::System.String name, global::System.String productNumber, global::System.Boolean makeFlag, global::System.Boolean finishedGoodsFlag, global::System.Int16 safetyStockLevel, global::System.Int16 reorderPoint, global::System.Decimal standardCost, global::System.Decimal listPrice, global::System.Int32 daysToManufacture, global::System.DateTime sellStartDate, global::System.Guid rowguid, global::System.DateTime modifiedDate)
 {
     Product product = new Product();
     product.ProductID = productID;
     product.Name = name;
     product.ProductNumber = productNumber;
     product.MakeFlag = makeFlag;
     product.FinishedGoodsFlag = finishedGoodsFlag;
     product.SafetyStockLevel = safetyStockLevel;
     product.ReorderPoint = reorderPoint;
     product.StandardCost = standardCost;
     product.ListPrice = listPrice;
     product.DaysToManufacture = daysToManufacture;
     product.SellStartDate = sellStartDate;
     product.rowguid = rowguid;
     product.ModifiedDate = modifiedDate;
     return product;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProducts(Product product)
 {
     base.AddObject("Products", product);
 }
 /// <summary>
 /// Create a new Product object.
 /// </summary>
 /// <param name="productID">Initial value of the ProductID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="productNumber">Initial value of the ProductNumber property.</param>
 /// <param name="standardCost">Initial value of the StandardCost property.</param>
 /// <param name="listPrice">Initial value of the ListPrice property.</param>
 /// <param name="sellStartDate">Initial value of the SellStartDate property.</param>
 /// <param name="rowguid">Initial value of the rowguid property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Product CreateProduct(global::System.Int32 productID, global::System.String name, global::System.String productNumber, global::System.Decimal standardCost, global::System.Decimal listPrice, global::System.DateTime sellStartDate, global::System.Guid rowguid, global::System.DateTime modifiedDate)
 {
     Product product = new Product();
     product.ProductID = productID;
     product.Name = name;
     product.ProductNumber = productNumber;
     product.StandardCost = standardCost;
     product.ListPrice = listPrice;
     product.SellStartDate = sellStartDate;
     product.rowguid = rowguid;
     product.ModifiedDate = modifiedDate;
     return product;
 }
 partial void DeleteProduct(Product instance);
 partial void UpdateProduct(Product instance);
 partial void InsertProduct(Product instance);
		private void detach_Products(Product entity)
		{
			this.SendPropertyChanging();
			entity.ProductSubcategory = null;
		}