Exemple #1
0
        public Collection <ImportFileBatch> GetImportFileBatches()
        {
            var importFileBatches = new Collection <ImportFileBatch>();
            var mapper            = new ImportFileBatchDataMapper();

            SetSqlConnection();

            using (Connection)
                using (var command = CreateSqlCommand(StoredProcedures.GetImportFileBatches))
                {
                    Connection.Open();
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            importFileBatches = mapper.MapAll(reader);
                        }
                    }
                }

            return(MapImportFileTypesToImportFileBatches(importFileBatches));
        }
Exemple #2
0
        public Collection <ImportFileBatch> GetImportFileBatchesByTypeAndDate(ImportFileType importFileType, DateTime fromDate)
        {
            var importFileBatches = new Collection <ImportFileBatch>();
            var mapper            = new ImportFileBatchDataMapper(importFileType);

            SetSqlConnection();

            using (Connection)
                using (var command = CreateSqlCommand(StoredProcedures.GetImportFileBatchesByTypeAndDate))
                {
                    AddParameter(command, DbType.Byte, "ImportFileTypeId", importFileType.ImportFileTypeId);
                    AddParameter(command, DbType.DateTime, "DateFrom", fromDate);
                    Connection.Open();
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            importFileBatches = mapper.MapAll(reader);
                        }
                    }
                }

            return(importFileBatches);
        }