public void Persist(VehicleEvent ev) { VehicleEventDto dto = VehicleEventAssembler.FromDomainObjectToDto(ev); service.SubmitVehicleEventCompleted += OnChangesSubmitted; service.SubmitVehicleEventAsync(dto); }
public void Delete(VehicleEvent ev) { VehicleEventDto dto = VehicleEventAssembler.FromDomainObjectToDto(ev); service.DeleteVehicleEventCompleted += OnRemoved; service.DeleteVehicleEventAsync(dto); }
public void SetEventMessage(VehicleEvent @event) { switch (@event) { case VehicleEvent.EXCESS_ACCELERATION: Title = "Excées d'accélération"; Message = $"{EventUtc}: Excées d'accélération"; break; case VehicleEvent.FAST_CORNER: Title = "Virage serré"; Message = $"{EventUtc}: Virage serré"; break; case VehicleEvent.SUDDEN_BRAKING: Title = "FREINAGE SOUDAINe"; Message = $"{EventUtc}: FREINAGE SOUDAIN"; break; case VehicleEvent.EXCESS_SPEED: Title = "Excées de vitesse"; Message = $"{EventUtc}: Excées de vitesse {Speed}"; break; } }
private void CreateNewClicked(object sender, RoutedEventArgs e) { VehicleEvent ve = new VehicleEvent(); VehicleEventViewModel vm = new VehicleEventViewModel(ve, selectedVehicle.Model); VehicleEventWindow w = new VehicleEventWindow(vm); w.Closed += DialogWindowStatus.OnDialogClosed; w.Show(); }
public static void CopyEntityProperties(VehicleEvent source, VehicleEvent target) { target.Id = source.Id; target.Comment = source.Comment; target.Date = source.Date; target.Mileage = source.Mileage; target.NextReplacementPeriod = source.NextReplacementPeriod; target.RedMileage = source.RedMileage; target.Type = source.Type; target.VehicleEntityId = source.VehicleEntityId; target.YellowMileage = source.YellowMileage; }
// GET: VehicleEvent public ActionResult Index() { //var vehicleEvents = _context.Events; var vehicleEvents = new VehicleEvent { EventCars = _context.Cars, EventMoto = _context.Moto, CustomerVehicles = _context.Customers }; return(View(vehicleEvents)); }
public static VehicleEvent FromDtoToDomainObject(VehicleEventDto source) { VehicleEvent target = new VehicleEvent(); target.Id = source.Id; target.Comment = source.Comment; target.Date = source.Date; target.Mileage = source.Mileage; target.NextReplacementPeriod = source.NextReplacementPeriod; target.RedMileage = source.RedMileage; target.Type = (VehicleEventType)source.Type; target.VehicleId = source.VehicleId; target.YellowMileage = source.YellowMileage; return(target); }
public static VehicleEventDto FromEntityToDto(VehicleEvent source) { VehicleEventDto target = new VehicleEventDto(); target.Id = source.Id; target.Comment = source.Comment; target.Date = source.Date; target.Mileage = source.Mileage; target.NextReplacementPeriod = source.NextReplacementPeriod; target.RedMileage = source.RedMileage; target.Type = source.Type; target.VehicleId = source.VehicleEntityId; target.YellowMileage = source.YellowMileage; return(target); }
public static VehicleEventDto FromDomainObjectToDto(VehicleEvent source) { var target = new VehicleEventDto(); target.Comment = source.Comment; target.Date = source.Date; target.Id = source.Id; target.Mileage = source.Mileage; target.NextReplacementPeriod = source.NextReplacementPeriod; target.RedMileage = source.RedMileage; target.Type = (int)source.Type; target.VehicleId = source.VehicleId; target.YellowMileage = source.YellowMileage; return(target); }
public VehicleEventViewModel(VehicleEvent model, Vehicle vehicle) { if (model == null) { throw new ArgumentNullException("model"); } this.vehicle = vehicle; this.model = model; model.VehicleId = vehicle.Id; foreach (VehicleEventType type in Enum.GetValues(typeof(VehicleEventType))) { availableTypes.Add(new VehicleEventTypeViewModel(type)); } selectedType = availableTypes. FirstOrDefault(t => t.Model == model.Type); if (model.RedMileage != null) { MileageUntilChange = model.RedMileage.Value - model.Mileage; } showDescriptionCommand = new DelegateCommand(ShowDescription); }
public VehicleEventViewModel(VehicleEvent model, Vehicle vehicle) { if (model == null) { throw new ArgumentNullException("model"); } this.vehicle = vehicle; this.model = model; model.VehicleId = vehicle.Id; // Init avail types foreach (VehicleEventType type in Enum.GetValues(typeof(VehicleEventType))) { availableTypes.Add(new VehicleEventTypeViewModel(type)); } selectedType = availableTypes. FirstOrDefault(t => t.Model == model.Type); if (model.RedMileage != null) { UseRecurring = true; MileageUntilChange = model.RedMileage.Value - model.Mileage; } }