Пример #1
0
 private void ButtonStopClick(object sender, System.Windows.RoutedEventArgs e)
 {
     try
     {
         timerStopWatch.Stop();
         dispatcherTimer.Stop();
         MessageBoxResult messResuly = MessageBox.Show("Are you want to save data ?", "Time Tracker", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (messResuly.Equals(MessageBoxResult.Yes))
         {
             var            sqltoLinqDataContract = new sqltoLinqDataDataContext();
             TimeTrickTable AddTime = new TimeTrickTable
             {
                 //Autoinc = 1,
                 EntryDate = DateTime.Today,
                 ETime     = TimeSpan.Parse(this.TextBlockTimer.Text)
             };
             sqltoLinqDataContract.TimeTrickTables.InsertOnSubmit(AddTime);
             sqltoLinqDataContract.SubmitChanges();
         }
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message, "Time Tracker", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Пример #2
0
 private void ButtonStopClick(object sender, System.Windows.RoutedEventArgs e)
 {
     try
     {
         timerStopWatch.Stop();
         dispatcherTimer.Stop();
         MessageBoxResult messResuly = MessageBox.Show("Are you want to save data ?", "Time Tracker", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (messResuly.Equals(MessageBoxResult.Yes))
         {
             var sqltoLinqDataContract = new sqltoLinqDataDataContext();
             TimeTrickTable AddTime = new TimeTrickTable
             {
                 //Autoinc = 1,
                 EntryDate = DateTime.Today,
                 ETime = TimeSpan.Parse(this.TextBlockTimer.Text)
             };
             sqltoLinqDataContract.TimeTrickTables.InsertOnSubmit(AddTime);
             sqltoLinqDataContract.SubmitChanges();
         }
     }
     catch(Exception error)
     {
          MessageBox.Show(error.Message, "Time Tracker", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 partial void DeleteTimeTrickTable(TimeTrickTable instance);
 partial void UpdateTimeTrickTable(TimeTrickTable instance);
 partial void InsertTimeTrickTable(TimeTrickTable instance);
 partial void DeleteTimeTrickTable(TimeTrickTable instance);
 partial void UpdateTimeTrickTable(TimeTrickTable instance);
 partial void InsertTimeTrickTable(TimeTrickTable instance);