Пример #1
0
 private void LoadData()
 {
     if (maintID != null)
     {
         var maintRecord = from maintInfo mi in App.ViewModel.Database.maintInfo
                           where mi.CarID == int.Parse(carID) && mi.MaintID == int.Parse(maintID)
                           select mi;
         CurrentMaintInfo = maintRecord.FirstOrDefault();
     }
     else if (CurrentMaintInfo == null)
     {
         CurrentMaintInfo = new maintInfo {
             Date = DateTime.Now, DateStr = DateTime.Now.ToShortDateString(), CarID = int.Parse(carID)
         };
     }
     this.DataContext = CurrentMaintInfo;
 }
Пример #2
0
 public void DeleteMaint(maintInfo toDelete)
 {
     carDataDb.maintInfo.DeleteOnSubmit(toDelete);
     Maint.Remove(toDelete);
     carDataDb.SubmitChanges();
 }
Пример #3
0
 public void AddMaint(maintInfo newMaint)
 {
     carDataDb.maintInfo.InsertOnSubmit(newMaint);
     carDataDb.SubmitChanges();
     Maint.Add(newMaint);
 }