Beispiel #1
0
 /// <summary>
 /// Add fill
 /// </summary>
 /// <param name="fill"></param>
 public void AddFill(Fill fill)
 {
     //find right record
     var before = baseData.Fills.Where(e => e.Date >= fill.Date).Count();
     baseData.Fills.Insert(before, fill);
     //save data
     this.Save();
     OnPropertyChanged("Fills");
     OnPropertyChanged("AverageConsumption");
     OnPropertyChanged("AvailableSpace");
 }
Beispiel #2
0
 /// <summary>
 /// Remove fill
 /// </summary>
 /// <param name="fill"></param>
 public void RemoveFill(Fill fill)
 {
     baseData.Fills.Remove(fill);
     this.Save();
     OnPropertyChanged("Fills");
     OnPropertyChanged("AverageConsumption");
     OnPropertyChanged("AvailableSpace");
 }
Beispiel #3
0
 /// <summary>
 /// Save fuel
 /// </summary>
 private void saveFuel()
 {
     //get exchange
     var rate = UnitExchange.GetExchangeUnitFor(UnitExchange.CurrentUnit, CoreData.Unit.Liters);
     //create fill, all fills are in liters
     CoreData.Fill fill = new CoreData.Fill();
     fill.Odometer = new CoreData.Odometer(this.odometer, DataController.Distance);
     fill.Date = this.Date;
     fill.Full = this.isTankFull;
     fill.Price = new CoreData.Price(this.fuelPrice, DataController.Currency);
     fill.Refueled = this.units * rate;
     fill.UnitPrice = new CoreData.Price(this.pricePerUnit / rate, DataController.Currency);
     DataController.AddFill(fill);
 }