Exemple #1
0
        private void RefreshData()
        {
            List <FleetStatusRow> fleetData;
            var mergedParameters = generalParams.GetParameterDictionary();

            var type = PercentageDivisorType.Values;

            if (mergedParameters.ContainsKey(DictionaryParameter.PercentageCalculation) &&
                mergedParameters[DictionaryParameter.PercentageCalculation] != string.Empty)
            {
                type = (PercentageDivisorType)Enum.Parse(typeof(PercentageDivisorType), mergedParameters[DictionaryParameter.PercentageCalculation]);
            }

            var startDate  = mergedParameters.GetDateFromDictionary(DictionaryParameter.StartDate);
            var endDate    = mergedParameters.GetDateFromDictionary(DictionaryParameter.EndDate);
            var todaysData = startDate.Date == DateTime.Now.Date && endDate == DateTime.Now.Date;

            ucHistoricalTrendChart.HourlySeries = todaysData;
            ucHistoricalTrendGrid.HourlySeries  = todaysData;
            using (var dataAccess = new HistoricalTrendDataAccess(mergedParameters))
            {
                lblLastUpdate.Text = LastUpdatedFromFleetNow.GetLastUpdatedDateTime(dataAccess);
                fleetData          = todaysData ? dataAccess.GetCurrentTrend() : dataAccess.GetHistoricalTrend();
            }
            upnlUpdatedTime.Update();
            ucHistoricalTrendChart.LoadChart(fleetData, type);
            ucHistoricalTrendGrid.LoadGrid(fleetData, type);
        }
Exemple #2
0
        public void TestDays()
        {
            List <FleetStatusRow> fleetData;

            using (var dataAccess = new HistoricalTrendDataAccess(GetDayParameters()))
            {
                fleetData = dataAccess.GetHistoricalTrend();
            }

            var dt = GetOldDayData();

            fleetData = fleetData.OrderBy(d => d.Day).ToList();

            Assert.AreNotEqual(dt.Rows.Count, 0, "No Data from old system");

            foreach (DataRow row in dt.Rows)
            {
                var repDateOld = DateTime.Parse(row["REP_DATE"].ToString());

                var newData = fleetData.FirstOrDefault(d => d.Day == repDateOld);

                if (newData == null)
                {
                    continue;
                }

                var tfOld = int.Parse(row["TOTAL_FLEET"].ToString());
                var tfNew = newData.TotalFleet;

                Assert.AreEqual(tfOld, tfNew);

                var orOld = int.Parse(row["ON_RENT"].ToString());
                var orNew = newData.OnRent;

                Assert.AreEqual(orOld, orNew);

                var idleOld = int.Parse(row["RT"].ToString());
                var idleNew = newData.Idle;

                Assert.AreEqual(idleOld, idleNew);
            }


            Assert.IsTrue(true);
        }