예제 #1
0
 /// <summary>
 /// Create a new Bin object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="category">Initial value of the Category property.</param>
 /// <param name="phigidSlot">Initial value of the PhigidSlot property.</param>
 public static Bin CreateBin(global::System.Int32 id, global::System.Int32 category, global::System.Int32 phigidSlot)
 {
     Bin bin = new Bin();
     bin.ID = id;
     bin.Category = category;
     bin.PhigidSlot = phigidSlot;
     return bin;
 }
예제 #2
0
        public bool SaveBins(ObservableCollection< OnTheSpot.Models.Bin> CleaningBins)
        {
            foreach (OnTheSpot.Models.Bin bin in CleaningBins)
            {
                Bin binDB = db.Bins.Where(b => b.ID == bin.ID).SingleOrDefault();
                if (binDB == null)
                {
                    binDB = new Bin();
//                    binDB.Category1 = new Category();
                    db.Bins.AddObject(binDB);

                }
                binDB.MaxWeight = bin.MaxWeight;
                binDB.BarCode = bin.BarCode;
                binDB.Category1 = db.Categories.Where(c => c.ID == bin.Category.ID).SingleOrDefault();
                binDB.PhigidSlot = bin.PhidgetSlot;
            }
                
            db.SaveChanges();
            return true;
        }
예제 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Bins EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBins(Bin bin)
 {
     base.AddObject("Bins", bin);
 }