/// <summary> /// Create a new Quantities object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="datetime">Initial value of the Datetime property.</param> /// <param name="productNumber">Initial value of the ProductNumber property.</param> /// <param name="count">Initial value of the Count property.</param> public static Quantities CreateQuantities(global::System.Int32 id, global::System.DateTime datetime, global::System.String productNumber, global::System.Int32 count) { Quantities quantities = new Quantities(); quantities.Id = id; quantities.Datetime = datetime; quantities.ProductNumber = productNumber; quantities.Count = count; return quantities; }
public static void Update(Product item) { try { using (var ctx = new tIMSdbEntities()) { // update product var product = ctx.Products.First(i => i.ProductNumber == item.ProductNumber); product.Description = item.Description; product.Active = item.Active; product.Category = item.Category; // insert new price var price = new Prices { ProductNumber = item.ProductNumber, Wholesale = item.WholesalePrice, Retail = item.RetailPrice, Datetime = DateTime.Now }; ctx.AddToPrices(price); // insert new quantity var quantity = new Quantities { ProductNumber = item.ProductNumber, Count = item.Quantity, Datetime = DateTime.Now }; ctx.Quantities.AddObject(quantity); ctx.SaveChanges(); } } catch(Exception ex) { } }
/// <summary> /// Deprecated Method for adding a new object to the Quantities EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToQuantities(Quantities quantities) { base.AddObject("Quantities", quantities); }