예제 #1
0
        public List <DashboardBackgroundProcessStatsEntity> Adapt(DataTable dt)
        {
            List <DashboardBackgroundProcessStatsEntity> results = new List <DashboardBackgroundProcessStatsEntity>();

            foreach (DataRow rw in dt.Rows)
            {
                DashboardBackgroundProcessStatsEntity matchCode = new DashboardBackgroundProcessStatsEntity();
                matchCode = AdaptItem(rw);
                results.Add(matchCode);
            }
            return(results);
        }
예제 #2
0
        public DashboardBackgroundProcessStatsEntity AdaptItem(DataRow rw)
        {
            DashboardBackgroundProcessStatsEntity result = new DashboardBackgroundProcessStatsEntity();

            if (rw.Table.Columns["ETLType"] != null)
            {
                result.ETLType = SafeHelper.GetSafestring(rw["ETLType"]);
            }

            if (rw.Table.Columns["NbrSuccess"] != null)
            {
                result.NbrSuccess = SafeHelper.GetSafeint(rw["NbrSuccess"]);
            }

            if (rw.Table.Columns["NbrFailures"] != null)
            {
                result.NbrFailures = SafeHelper.GetSafeint(rw["NbrFailures"]);
            }

            if (rw.Table.Columns["NbrRunning"] != null)
            {
                result.NbrRunning = SafeHelper.GetSafeint(rw["NbrRunning"]);
            }

            if (rw.Table.Columns["LastExecutionMinutes"] != null)
            {
                result.LastExecutionMinutes = SafeHelper.GetSafeint(rw["LastExecutionMinutes"]);
            }

            if (rw.Table.Columns["ProcessPaused"] != null)
            {
                result.ProcessPaused = SafeHelper.GetSafebool(rw["ProcessPaused"]);
            }

            if (rw.Table.Columns["Message1"] != null)
            {
                result.Message1 = SafeHelper.GetSafestring(rw["Message1"]);
            }

            if (rw.Table.Columns["Message2"] != null)
            {
                result.Message2 = SafeHelper.GetSafestring(rw["Message2"]);
            }

            if (rw.Table.Columns["NextExecutionTimeSeconds"] != null)
            {
                result.NextExecutionTimeSeconds = SafeHelper.GetSafeint(rw["NextExecutionTimeSeconds"]);
            }

            if (rw.Table.Columns["AverageRunDuration"] != null)
            {
                result.AverageRunDuration = SafeHelper.GetSafeDateTime(rw["AverageRunDuration"]);
            }

            if (rw.Table.Columns["MaxRunDuration"] != null)
            {
                result.MaxRunDuration = SafeHelper.GetSafeDateTime(rw["MaxRunDuration"]);
            }

            if (rw.Table.Columns["MinRunDuration"] != null)
            {
                result.MinRunDuration = SafeHelper.GetSafeDateTime(rw["MinRunDuration"]);
            }

            result.NextExecutionTimeSpan = result.NextExecutionTimeSeconds > 0 ? TimeSpan.FromSeconds(result.NextExecutionTimeSeconds) : TimeSpan.FromSeconds(0);

            return(result);
        }