public void DeleteVehicleMaintenanceLineItem(VehicleMaintenanceLineItem vehicleMaintenanceLineItem)
 {
     if ((vehicleMaintenanceLineItem.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(vehicleMaintenanceLineItem, EntityState.Deleted);
     }
     else
     {
         this.ObjectContext.VehicleMaintenanceLineItems.Attach(vehicleMaintenanceLineItem);
         this.ObjectContext.VehicleMaintenanceLineItems.DeleteObject(vehicleMaintenanceLineItem);
     }
 }
        public void UpdateVehicleMaintenanceLineItem(VehicleMaintenanceLineItem currentVehicleMaintenanceLineItem)
        {
            currentVehicleMaintenanceLineItem.LastModified = DateTime.UtcNow;
            currentVehicleMaintenanceLineItem.LastModifyingUserId = CurrentUserAccount().Id;

            this.ObjectContext.VehicleMaintenanceLineItems.AttachAsModified(currentVehicleMaintenanceLineItem);
        }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the VehicleMaintenanceLineItems EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVehicleMaintenanceLineItems(VehicleMaintenanceLineItem vehicleMaintenanceLineItem)
 {
     base.AddObject("VehicleMaintenanceLineItems", vehicleMaintenanceLineItem);
 }
        // Get, Insert, Update, and Delete VehicleMaintenanceLineItems
        public void InsertVehicleMaintenanceLineItem(VehicleMaintenanceLineItem vehicleMaintenanceLineItem)
        {
            if ((vehicleMaintenanceLineItem.EntityState == EntityState.Detached))
                this.ObjectContext.VehicleMaintenanceLineItems.Attach(vehicleMaintenanceLineItem);

            if ((vehicleMaintenanceLineItem.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(vehicleMaintenanceLineItem, EntityState.Added);
            }
            else
            {
                this.ObjectContext.VehicleMaintenanceLineItems.AddObject(vehicleMaintenanceLineItem);
            }
        }
Example #5
0
 /// <summary>
 /// Create a new VehicleMaintenanceLineItem object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="vehicleMaintenanceLogEntryId">Initial value of the VehicleMaintenanceLogEntryId property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 public static VehicleMaintenanceLineItem CreateVehicleMaintenanceLineItem(global::System.Guid id, global::System.Guid vehicleMaintenanceLogEntryId, global::System.DateTime createdDate)
 {
     VehicleMaintenanceLineItem vehicleMaintenanceLineItem = new VehicleMaintenanceLineItem();
     vehicleMaintenanceLineItem.Id = id;
     vehicleMaintenanceLineItem.VehicleMaintenanceLogEntryId = vehicleMaintenanceLogEntryId;
     vehicleMaintenanceLineItem.CreatedDate = createdDate;
     return vehicleMaintenanceLineItem;
 }