Example #1
0
        public List <MonitoringNotificationJobSettingsEntity> Adapt(DataTable dt)
        {
            List <MonitoringNotificationJobSettingsEntity> results = new List <MonitoringNotificationJobSettingsEntity>();

            foreach (DataRow rw in dt.Rows)
            {
                MonitoringNotificationJobSettingsEntity ExportJob = new MonitoringNotificationJobSettingsEntity();
                ExportJob = AdaptItem(rw, dt);
                results.Add(ExportJob);
            }
            return(results);
        }
Example #2
0
        public MonitoringNotificationJobSettingsEntity AdaptItem(DataRow rw, DataTable dt)
        {
            MonitoringNotificationJobSettingsEntity result = new MonitoringNotificationJobSettingsEntity();

            if (dt.Columns.Contains("Id"))
            {
                result.Id = SafeHelper.GetSafeint(rw["Id"]);
            }

            if (dt.Columns.Contains("UserId"))
            {
                result.UserId = SafeHelper.GetSafeint(rw["UserId"]);
            }

            if (dt.Columns.Contains("MarkAsExported"))
            {
                result.MarkAsExported = SafeHelper.GetSafebool(rw["MarkAsExported"]);
            }

            if (dt.Columns.Contains("Format"))
            {
                result.Format = SafeHelper.GetSafestring(rw["Format"]);
            }

            if (dt.Columns.Contains("FilePath"))
            {
                result.FilePath = SafeHelper.GetSafestring(rw["FilePath"]);
            }

            if (dt.Columns.Contains("RequestedDate"))
            {
                result.RequestedDate = SafeHelper.GetSafeDateTime(rw["RequestedDate"]);
            }

            if (dt.Columns.Contains("ProcessStartDate"))
            {
                if (rw["ProcessStartDate"] == DBNull.Value)
                {
                    result.ProcessStartDate = null;
                }
                else
                {
                    result.ProcessStartDate = Convert.ToDateTime(rw["ProcessStartDate"]);
                }
            }

            if (dt.Columns.Contains("ProcessEndDate"))
            {
                result.ProcessEndDate = SafeHelper.GetSafeDateTime(rw["ProcessEndDate"]);
            }

            if (dt.Columns.Contains("IsProcessComplete"))
            {
                result.IsProcessComplete = SafeHelper.GetSafebool(rw["IsProcessComplete"]);
            }

            if (dt.Columns.Contains("IsAlreadyDownloaded"))
            {
                result.IsAlreadyDownloaded = SafeHelper.GetSafebool(rw["IsAlreadyDownloaded"]);
            }

            if (dt.Columns.Contains("ApplicationId"))
            {
                result.ApplicationId = SafeHelper.GetSafeint(rw["ApplicationId"]);
            }

            if (dt.Columns.Contains("LastDownloadedDate"))
            {
                result.LastDownloadedDate = SafeHelper.GetSafeDateTime(rw["LastDownloadedDate"]);
            }

            if (dt.Columns.Contains("LastDownloadedUserId"))
            {
                result.LastDownloadedUserId = SafeHelper.GetSafeint(rw["LastDownloadedUserId"]);
            }

            if (dt.Columns.Contains("Delimiter"))
            {
                result.Delimiter = SafeHelper.GetSafestring(rw["Delimiter"]);
            }

            if (dt.Columns.Contains("IsEmailSent"))
            {
                result.IsEmailSent = SafeHelper.GetSafebool(rw["IsEmailSent"]);
            }

            if (dt.Columns.Contains("IsMonitoringNotifications"))
            {
                result.IsMonitoringNotifications = SafeHelper.GetSafebool(rw["IsMonitoringNotifications"]);
            }

            if (dt.Columns.Contains("APILayer"))
            {
                result.APILayer = SafeHelper.GetSafestring(rw["APILayer"]);
            }

            if (dt.Columns.Contains("IsCancelled"))
            {
                result.IsCancelled = SafeHelper.GetSafebool(rw["IsCancelled"]);
            }

            if (dt.Columns.Contains("ProcessCancelledDateTime"))
            {
                result.ProcessCancelledDateTime = SafeHelper.GetSafeDateTime(rw["ProcessCancelledDateTime"]);
            }

            if (dt.Columns.Contains("ExportType"))
            {
                result.ExportType = SafeHelper.GetSafestring(rw["ExportType"]);
            }

            if (dt.Columns.Contains("RetryCount"))
            {
                result.RetryCount = SafeHelper.GetSafeint(rw["RetryCount"]);
            }

            if (dt.Columns.Contains("ErrorMessage"))
            {
                result.ErrorMessage = SafeHelper.GetSafestring(rw["ErrorMessage"]);
            }

            return(result);
        }