Exemple #1
0
        public DataBlocksEntity AdaptItem(DataRow rw)
        {
            DataBlocksEntity result = new DataBlocksEntity();

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

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

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

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

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

            return(result);
        }
Exemple #2
0
        public List <DataBlocksEntity> Adapt(DataTable dt)
        {
            List <DataBlocksEntity> results = new List <DataBlocksEntity>();

            foreach (DataRow rw in dt.Rows)
            {
                DataBlocksEntity dataBlocks = new DataBlocksEntity();
                dataBlocks = AdaptItem(rw);
                results.Add(dataBlocks);
            }
            return(results);
        }