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;
 }
Esempio n. 3
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;
        }
Esempio n. 4
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;
        }