Пример #1
0
        /// <summary>
        /// Business Element
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public List <MonitoringProductElementEntity> AdaptElement(DataTable dt)
        {
            List <MonitoringProductElementEntity> results = new List <MonitoringProductElementEntity>();

            foreach (DataRow rw in dt.Rows)
            {
                MonitoringProductElementEntity productDataEntity = new MonitoringProductElementEntity();
                productDataEntity = AdaptElementItem(rw, dt);
                results.Add(productDataEntity);
            }
            return(results);
        }
Пример #2
0
        public MonitoringProductElementEntity AdaptElementItem(DataRow rw, DataTable dt)
        {
            MonitoringProductElementEntity result = new MonitoringProductElementEntity();

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

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

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

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

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

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

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

            result.ElementTypeWithId = SafeHelper.GetSafeint(rw["ProductElementID"]) + "@#$" + SafeHelper.GetSafestring(rw["ElementType"]);
            return(result);
        }