コード例 #1
0
ファイル: ReportWizard.cs プロジェクト: rshyffer/LapTracker
 public ReportWizard(Laps laps, Runners runners)
 {
     _laps = laps;
     _runners = runners;
     InitializeComponent();
     SetDateRange();
 }
コード例 #2
0
ファイル: Report.cs プロジェクト: rshyffer/LapTracker
        public void Create(DateTime startDate, DateTime endDate, Laps laps, Runners runners)
        {
            this.startDate = startDate;
            this.endDate = endDate;

            var relevantLaps = from Lap lap in laps.AsEnumerable()
                               where lap.Time >= startDate && lap.Time <= endDate
                               select lap;

            var barcodeIds = (from Lap row in relevantLaps select row.BarcodeId).Distinct();
            foreach (var id in barcodeIds)
            {
                var matchingRunner = (from Runner runner in runners.AsEnumerable()
                                      where runner.BarcodeId == id
                                      select runner).FirstOrDefault();
                if (matchingRunner != null)
                {
                    var runnerLaps = (from Lap lap in relevantLaps where lap.BarcodeId == id select lap);
                    var row = CreateNewRow();
                    row.FirstName = matchingRunner.FirstName.Trim();
                    row.LastName = matchingRunner.LastName.Trim();
                    row.Grade = matchingRunner.Grade.Trim();
                    row.TeacherName = matchingRunner.TeacherName.Trim();
                    row.Laps = runnerLaps.Count();
                    row.ParticipationDays = (from Lap lap in runnerLaps select lap.Time.Date).Distinct().Count();
                    Rows.Add(row);
                }
            }
        }
コード例 #3
0
ファイル: RunnersWizard.cs プロジェクト: rshyffer/LapTracker
 private void SetRunnersDatasource(Runners runners)
 {
     Runners = (Runners)runners.Copy();
     runnerGridView.DataSource = Runners;
     runnerGridView.AutoResizeColumns();
     var idColumn = runnerGridView.Columns["Id"];
     if (idColumn != null) idColumn.Visible = false;
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: rshyffer/LapTracker
        private void manageRunnersButton_Click(object sender, EventArgs e)
        {
            var window = new RunnersWizard(_runners);
            var result = window.ShowDialog(this);
            if (result == DialogResult.OK)
            {
                _runners.Dispose();
                _runners = window.Runners;
                SaveRunners();

            }
            else
            {
                _runners.Dispose();
                SetRunnersDatasource();
            }
        }
コード例 #5
0
ファイル: RunnersWizard.cs プロジェクト: rshyffer/LapTracker
 public RunnersWizard(Runners runners)
 {
     InitializeComponent();
     SetRunnersDatasource(runners);
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: rshyffer/LapTracker
 private void SetRunnersDatasource()
 {
     _runners = new Runners();
     _runners.Load(RunnersFile);
 }