Ejemplo n.º 1
0
 public virtual void ImportFromCsv(string filePath, bool shapeColumnNames)
 {
     _entities = DataTableToList(CsvParser.ParseFromFile(
                                     filePath,
                                     true,
                                     EntityReader.GetDataTable(shapeColumnNames, _entityType).Columns.Count));
 }
Ejemplo n.º 2
0
        public virtual DataTable GetDataTable(
            Dictionary <string, object> properties,
            bool exactMatch,
            bool shapeColumnNames,
            string entityIdColumnName)
        {
            bool      includeEntityIdColumn = !string.IsNullOrEmpty(entityIdColumnName);
            DataTable result = EntityReader.GetDataTable(shapeColumnNames, _entityType);

            if (includeEntityIdColumn)
            {
                Type entityIdType = typeof(Guid);
                result.Columns.Add(new DataColumn(entityIdColumnName)
                {
                    Caption  = entityIdColumnName,
                    DataType = entityIdType
                });
            }
            Dictionary <Guid, object> entities = GetEntitiesByProperties(properties, exactMatch);

            foreach (Guid id in entities.Keys)
            {
                object  e   = entities[id];
                DataRow row = EntityReader.PopulateDataRow(e, result.NewRow(), shapeColumnNames, _entityType);
                if (includeEntityIdColumn)
                {
                    row[entityIdColumnName] = id;
                }
                result.Rows.Add(row);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static DataTable GetDataTableFromEntities(List <object> entities, Type entityType)
        {
            DataTable result = EntityReader.GetDataTable(false, entityType);

            foreach (object o in entities)
            {
                DataRow row = EntityReader.PopulateDataRow(o, result.NewRow(), false, entityType);
                result.Rows.Add(row);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public virtual DataTable GetDataTable(object wildCardSearchValue, bool exactMatch, bool shapeColumnNames)
        {
            DataTable     result   = EntityReader.GetDataTable(shapeColumnNames, _entityType);
            List <object> entities = GetEntitiesByWildCardSearch(wildCardSearchValue, exactMatch);

            foreach (object e in entities)
            {
                DataRow row = EntityReader.PopulateDataRow(e, result.NewRow(), shapeColumnNames, _entityType);
                result.Rows.Add(row);
            }
            return(result);
        }
Ejemplo n.º 5
0
        public virtual DataTable GetDataTable(Dictionary <string, object> properties, bool exactMatch, bool shapeColumnNames)
        {
            DataTable     result   = EntityReader.GetDataTable(shapeColumnNames, _entityType);
            List <object> entities = GetEntitiesByProperties(properties, exactMatch);

            foreach (object e in entities)
            {
                DataRow row = EntityReader.PopulateDataRow(e, result.NewRow(), shapeColumnNames, _entityType);
                result.Rows.Add(row);
            }
            return(result);
        }