コード例 #1
0
        public void BindFormData(cFilm film)
        {
            _film = film;

            if (_film.pHasEncryptedPictureFiles)
            {
                _film.applyStats();

                clearDisplay();

                if (!_film.pHasErrors)
                {
                    cPictureFile pic = film.getFirstValidPictureFile();

                    lblCamDate.Text       = pic.pOffenceDateStringDD_MM_YYYY;
                    lblAveSpeed.Text      = film.pAverageSpeed.ToString("0.0") + " km/h";
                    lblCaptureErrors.Text = film.pCaptureErrors.ToString();
                    if (film.pEndDate.HasValue)
                    {
                        lblEndDate.Text = film.pEndDate.Value.ToString("dd MMM yyyy HH:mm:ss");
                    }
                    else
                    {
                        lblEndDate.Text = "";
                    }

                    lblHighestSpeed.Text  = film.pHighestSpeed + " km/h";
                    lblHighSpeed.Text     = film.pHighSpeedCount.ToString();
                    lblInfringements.Text = film.pInfringements.ToString();
                    lblLocationCode.Text  = pic.pLocationCode;
                    lblLowSpeed.Text      = film.pLowSpeedCount.ToString();
                    lblMeasureErrors.Text = film.pMeasurementErrors.ToString();
                    lblTestPhotos.Text    = film.pTestPhotos.ToString();
                    lblSessionName.Text   = pic.pSession;
                    if (film.pStartDate.HasValue)
                    {
                        lblStartDate.Text = film.pStartDate.Value.ToString("dd MMM yyyy HH:mm:ss");
                    }
                    else
                    {
                        lblStartDate.Text = "";
                    }
                    lblVehiclesChecked.Text = film.pVehiclesChecked.ToString();
                    lblJammers.Text         = film.pJammerCount.ToString();
                }
            }
        }
コード例 #2
0
        public void BindFormData(cFilm film)
        {
            string statsFileName;

            if (film.pHasEncryptedPictureFiles)
            {
                film.applyStats();

                //*****First Record is the Operator and Stats
                ReportSource rsMain = new ReportSource
                {
                    AverageSpeed         = film.pAverageSpeed,
                    CountOfInfringements = film.pInfringements,
                    ErrorsCount          = film.pCaptureErrors,
                    HighestSpeed         = film.pHighestSpeed,
                    JammerCount          = film.pJammerCount,
                    TestPhotoCount       = film.pTestPhotos,
                    VehiclesChecked      = film.pVehiclesChecked
                };

                statsFileName = film.pStatsFileName == string.Empty ? "None" : film.pStatsFileName;

                if (film.pStartDate != null && film.pEndDate != null)
                {
                    rsMain.Time = film.pStartDate.Value.ToString("HH:mm:ss tt") + "-" + film.pEndDate.Value.ToString("HH:mm:ss tt");
                }

                _rs.Add(rsMain);

                int locationCounter = 0;

                var groupByDate = from f in film.getPicturesFiles()
                                  where f.pHasError == false
                                  group f by f.pOffenceDateStringDD_MM_YYYY into g
                                  select g;

                List <string> lst   = new List <string>();
                List <string> camId = new List <string>();

                foreach (IGrouping <string, cPictureFile> pictureFilesDate in groupByDate)
                {
                    var groupByLocation = from f in pictureFilesDate
                                          where f.pHasError == false
                                          group f by f.pLocationCode into g
                                          select g;

                    foreach (IGrouping <string, cPictureFile> pictureFilesLocation in groupByLocation)
                    {
                        locationCounter++;
                        ReportSource rs = new ReportSource {
                            CamDate = pictureFilesLocation.First().pOffenceDateStringDD_MM_YYYY, Session = "Actual", LocationCode = pictureFilesLocation.First().pLocationCode
                        };

                        foreach (cPictureFile pictureFile in pictureFilesLocation)
                        {
                            if (!lst.Contains(pictureFile.pOperatorId))
                            {
                                lst.Add(pictureFile.pOperatorId);
                            }

                            if (pictureFile.pIsTest)
                            {
                                rs.TestPhotoCount++;
                            }
                            else if (pictureFile.pIsJammer)
                            {
                                rs.JammerCount++;
                            }
                            else if (pictureFile.pHasError)
                            {
                                rs.ErrorsCount++;
                            }
                            else
                            {
                                rs.CountOfInfringements++;
                            }

                            if (!camId.Contains(pictureFile.pMachineId))
                            {
                                camId.Add(pictureFile.pMachineId);
                            }
                        }

                        DateTime?start = pictureFilesLocation.First().pOffenceDate;
                        DateTime?end   = pictureFilesLocation.Last().pOffenceDate;
                        if (start != null && end != null)
                        {
                            rs.Time = start.Value.ToString("HH:mm:ss tt") + "-" + end.Value.ToString("HH:mm:ss tt");
                        }

                        _rs.Add(rs);
                    }
                }

                StringBuilder sb = new StringBuilder();
                foreach (string s in lst)
                {
                    sb.Append(s);
                    sb.Append(",");
                }

                rsMain.Operators = sb.ToString().TrimEnd(',');

                cPictureFile pic = film.getFirstValidPictureFile();

                if (pic != null)
                {
                    rsMain.LocationCode = locationCounter > 1 ? "*VARIOUS" : pic.pLocationCode;
                    rsMain.CamDate      = pic.pOffenceDateStringDD_MM_YYYY;
                    rsMain.Session      = pic.pFormattedSession;
                }

                sb.Clear();
                foreach (string c in camId)
                {
                    sb.Append(c);
                    sb.Append(",");
                }

                rsMain.CamID = sb.ToString().TrimEnd(',');

                rsMain.StatsFileName = string.IsNullOrWhiteSpace(statsFileName) ? "No  File" : statsFileName;

                ConnectionStringSettings setting = ConfigurationManager.ConnectionStrings["CoreContext"];
                var data = new cDataAccess(setting.ConnectionString);

                string userDetail = data.getUserDetail(userId);
                rsMain.LoggedBy = userDetail;
            }
        }