Inheritance: System.Data.Objects.DataClasses.EntityObject
 public void DeleteSparePart(SparePart sparePart)
 {
     this.carServiceEntities.DeleteObject(sparePart);
 }
 public void CreateSparePart(SparePart sparePart)
 {
     this.carServiceEntities.SpareParts.AddObject(sparePart);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the SpareParts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSpareParts(SparePart sparePart)
 {
     base.AddObject("SpareParts", sparePart);
 }
 /// <summary>
 /// Create a new SparePart object.
 /// </summary>
 /// <param name="partId">Initial value of the PartId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="price">Initial value of the Price property.</param>
 /// <param name="isActive">Initial value of the IsActive property.</param>
 public static SparePart CreateSparePart(global::System.Int32 partId, global::System.String name, global::System.Decimal price, global::System.Boolean isActive)
 {
     SparePart sparePart = new SparePart();
     sparePart.PartId = partId;
     sparePart.Name = name;
     sparePart.Price = price;
     sparePart.IsActive = isActive;
     return sparePart;
 }
 private void SaveSparePart(int partId, string partName, decimal partPrice, bool isPartActive)
 {
     SparePart updatedSparePart = this.persister.GetSparePartById(partId);
     if (updatedSparePart == null)
     {
         updatedSparePart = new SparePart()
         {
             PartId = partId,
             Name = partName,
             Price = partPrice,
             IsActive = isPartActive
         };
         this.persister.CreateSparePart(updatedSparePart);
     }
     else
     {
         updatedSparePart.Name = partName;
         updatedSparePart.Price = partPrice;
         updatedSparePart.IsActive = isPartActive;
     }
     this.persister.SaveChanges();
 }
 private void LoadSparePartInformation(SparePart sparePart)
 {
     this.PartName.Text = sparePart.Name;
     this.PartPrice.Text = sparePart.Price.ToString();
     this.PartActive.SelectedValue = (sparePart.IsActive ? 1.ToString() : 0.ToString());
 }