Esempio n. 1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            string carIDStr;

            NavigationContext.QueryString.TryGetValue("id", out carIDStr);
            int.TryParse(carIDStr, out this.carID);

            if (this.carID != 0)
            {
                var carsInDb = from carInfo cInfo in App.ViewModel.Database.carInfo
                               where cInfo.CarID == carID
                               select cInfo;
                CurrentCar = carsInDb.First();
            }
            else
            {
                CurrentCar = new carInfo {
                    CarRegExpiry = DateTime.Now, CarInsExpiry = DateTime.Now
                }
            };

            this.DataContext = CurrentCar;
            //ErrorLogging.Analytics(this.GetType().ToString(), "AddCar", e.NavigationMode.ToString(), string.Empty);
            base.OnNavigatedTo(e);
        }
Esempio n. 2
0
        public void LoadCollectionFromDB()
        {
            var carsInDb = from carInfo cInfo in carDataDb.carInfo
                           select cInfo;

            Cars = new ObservableCollection <carInfo>(carsInDb);
            var settingDB = from settingsInfo data in carDataDb.settingsInfo
                            select data;

            SetInfo         = new ObservableCollection <settingsInfo>(settingDB);
            SingleCarRecord = new carInfo();
        }
Esempio n. 3
0
 public void DeleteCar(carInfo toDelete)
 {
     carDataDb.carInfo.DeleteOnSubmit(toDelete);
     Cars.Remove(toDelete);
     carDataDb.SubmitChanges();
 }
Esempio n. 4
0
 public void Addcar(carInfo newCar)
 {
     carDataDb.carInfo.InsertOnSubmit(newCar);
     carDataDb.SubmitChanges();
     //Cars.Add(newCar);
 }