Example #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);
     }
 }
 private void ButtonSearchbyDateClick(object sender, System.Windows.RoutedEventArgs e)
 {
     var sqlDataContract = new sqltoLinqDataDataContext();
     var reportmaker = from timedb in sqlDataContract.TimeTrickTables where timedb.EntryDate ==Convert.ToDateTime(DatePickerTimer.Text) select timedb;
     DataGridReportMaker.ItemsSource = reportmaker;
     sqlDataContract.Dispose();
 }
Example #3
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);
     }
 }
Example #4
0
        private void ButtonSearchbyMonthClick(object sender, System.Windows.RoutedEventArgs e)
        {
            var sqlDataContract = new sqltoLinqDataDataContext();
            var monthely        = from u in sqlDataContract.TimeTrickTables group u by u.EntryDate.Value.Month into g select new { EntryDate = g.Key, ETime = new TimeSpan(g.Sum(r => r.ETime.Value.Ticks)) };

            DataGridReportMaker.ItemsSource = monthely;
            sqlDataContract.Dispose();
        }
Example #5
0
        private void ButtonSearchbyDateClick(object sender, System.Windows.RoutedEventArgs e)
        {
            var sqlDataContract = new sqltoLinqDataDataContext();
            var reportmaker     = from timedb in sqlDataContract.TimeTrickTables where timedb.EntryDate == Convert.ToDateTime(DatePickerTimer.Text) select timedb;

            DataGridReportMaker.ItemsSource = reportmaker;
            sqlDataContract.Dispose();
        }
 private void ButtonReportByMonthClick(object sender, System.Windows.RoutedEventArgs e)
 {
     this.ButtonReport.IsEnabled = false;
     Mouse.OverrideCursor = Cursors.Wait;
     var sqlDataContract = new sqltoLinqDataDataContext();
     var reportmaker = from u in sqlDataContract.TimeTrickTables group u by u.EntryDate.Value.Month into g select new { EntryDate = g.Key, ETime = new TimeSpan(g.Sum(r => r.ETime.Value.Ticks)) };
     TimerDataSet reportDataset = new TimerDataSet();
     foreach (var item in reportmaker)
     {
         reportDataset.TimerDataTable.Rows.Add(item.EntryDate, item.ETime);
     }
     WindowReportViewer reportVew = new WindowReportViewer();
     CrystalReport1 cyReport = new CrystalReport1();
     cyReport.SetDataSource(reportDataset);
     reportVew.ReportViewerView.ViewerCore.ReportSource = cyReport;
     reportVew.Show();
     sqlDataContract.Dispose();
     reportDataset.Dispose();
     this.ButtonReport.IsEnabled = true;
     Mouse.OverrideCursor = null;
 }
 private void ButtonReportByDateClick(object sender, System.Windows.RoutedEventArgs e)
 {
     this.ButtonReport.IsEnabled = false;
     Mouse.OverrideCursor = Cursors.Wait;
     var sqlDataContract = new sqltoLinqDataDataContext();
     var reportmaker = from timedb in sqlDataContract.TimeTrickTables where timedb.EntryDate == Convert.ToDateTime(DatePickerTimer.Text) select timedb;
     TimerDataSet reportDataset = new TimerDataSet();
     foreach (var item in reportmaker)
     {
         reportDataset.TimerDataTable.Rows.Add(item.EntryDate, item.ETime);
     }
     WindowReportViewer reportVew = new WindowReportViewer();
     CrystalReport1 cyReport = new CrystalReport1();
     cyReport.SetDataSource(reportDataset);
     reportVew.ReportViewerView.ViewerCore.ReportSource=cyReport;
     reportVew.Show();
     sqlDataContract.Dispose();
     reportDataset.Dispose();
     this.ButtonReport.IsEnabled = true;
     Mouse.OverrideCursor = null;
 }
Example #8
0
        private void ButtonReportByMonthClick(object sender, System.Windows.RoutedEventArgs e)
        {
            this.ButtonReport.IsEnabled = false;
            Mouse.OverrideCursor        = Cursors.Wait;
            var          sqlDataContract = new sqltoLinqDataDataContext();
            var          reportmaker     = from u in sqlDataContract.TimeTrickTables group u by u.EntryDate.Value.Month into g select new { EntryDate = g.Key, ETime = new TimeSpan(g.Sum(r => r.ETime.Value.Ticks)) };
            TimerDataSet reportDataset   = new TimerDataSet();

            foreach (var item in reportmaker)
            {
                reportDataset.TimerDataTable.Rows.Add(item.EntryDate, item.ETime);
            }
            WindowReportViewer reportVew = new WindowReportViewer();
            CrystalReport1     cyReport  = new CrystalReport1();

            cyReport.SetDataSource(reportDataset);
            reportVew.ReportViewerView.ViewerCore.ReportSource = cyReport;
            reportVew.Show();
            sqlDataContract.Dispose();
            reportDataset.Dispose();
            this.ButtonReport.IsEnabled = true;
            Mouse.OverrideCursor        = null;
        }
Example #9
0
        private void ButtonReportByDateClick(object sender, System.Windows.RoutedEventArgs e)
        {
            this.ButtonReport.IsEnabled = false;
            Mouse.OverrideCursor        = Cursors.Wait;
            var          sqlDataContract = new sqltoLinqDataDataContext();
            var          reportmaker     = from timedb in sqlDataContract.TimeTrickTables where timedb.EntryDate == Convert.ToDateTime(DatePickerTimer.Text) select timedb;
            TimerDataSet reportDataset   = new TimerDataSet();

            foreach (var item in reportmaker)
            {
                reportDataset.TimerDataTable.Rows.Add(item.EntryDate, item.ETime);
            }
            WindowReportViewer reportVew = new WindowReportViewer();
            CrystalReport1     cyReport  = new CrystalReport1();

            cyReport.SetDataSource(reportDataset);
            reportVew.ReportViewerView.ViewerCore.ReportSource = cyReport;
            reportVew.Show();
            sqlDataContract.Dispose();
            reportDataset.Dispose();
            this.ButtonReport.IsEnabled = true;
            Mouse.OverrideCursor        = null;
        }
 private void ButtonSearchbyMonthClick(object sender, System.Windows.RoutedEventArgs e)
 {
     var sqlDataContract = new sqltoLinqDataDataContext();
     var monthely = from u in sqlDataContract.TimeTrickTables group u by u.EntryDate.Value.Month into g select new { EntryDate = g.Key, ETime = new TimeSpan(g.Sum(r => r.ETime.Value.Ticks)) };
     DataGridReportMaker.ItemsSource = monthely;
     sqlDataContract.Dispose();
 }