Beispiel #1
0
 /// <summary>
 /// Create a new Prices 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>
 public static Prices CreatePrices(global::System.Int32 id, global::System.DateTime datetime, global::System.String productNumber)
 {
     Prices prices = new Prices();
     prices.Id = id;
     prices.Datetime = datetime;
     prices.ProductNumber = productNumber;
     return prices;
 }
Beispiel #2
0
        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)
            {

            }
        }
Beispiel #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Prices EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPrices(Prices prices)
 {
     base.AddObject("Prices", prices);
 }