示例#1
0
        /// <summary>
        /// CTOR
        /// </summary>
        /// <param name="databaseConfiguration"></param>
        public AuditProvider(DatabaseAuditingConfiguration databaseConfiguration)
        {
            var databaseDataProvider = new DatabaseDataProvider(databaseConfiguration);

            CreateAuditTableIfNotExist(databaseConfiguration);
            Configuration.DataProvider = databaseDataProvider;
        }
示例#2
0
        public DatabaseLocalizationTests()
        {
            // Create instance

            var databaseConfig       = new DatabaseDataProviderConfiguration(ConnectionString);
            var databaseDataProvider = new DatabaseDataProvider(databaseConfig);

            _provider = new LocalizationProvider(databaseDataProvider);
        }
        public DateTime?GetLastTime(string conStr)
        {
            var sql = "SELECT max(Time) FROM Table_TradePrice ";
            var dh  = new DatabaseDataProvider();
            var t   = dh.GetQueryResult <DateTime>(sql, conStr);

            if (t != null && t.Count == 1)
            {
                return(t[0]);
            }
            return(null);
        }
示例#4
0
        void SaveToDB()
        {
            var dh            = new DatabaseDataProvider();
            var connectionStr = ConfigurationManager.ConnectionStrings["MarketDataConnectionString"].ConnectionString;

            dh.GetDatabaseConnection = () => { return(new SqlConnection(connectionStr)); };

            dh.DeleteBatch(null, "Table_TradePrice", new List <string>()
            {
                "Ticker,Time"
            }, MarketDataList.Cast <object>().ToList());
            dh.InsertBatch(null, "Table_TradePrice", MarketDataList.Cast <object>().ToList());
        }
        public void WriteToDB(string connectionStr)
        {
            var dh = new DatabaseDataProvider();

            dh.GetDatabaseConnection = () => CreateConnection(connectionStr);
            //dh.DeleteBatch(null, "marketminuteprice", "UID", MarketDataList.Cast<object>().ToList());
            //dh.InsertBatch(null, "marketminuteprice", MarketDataList.Cast<object>().ToList());
            var l = MarketDataList.Cast <object>().ToList();

            if (LimitBeginTime != null)
            {
                l = MarketDataList.Where(v => v.Time > LimitBeginTime).Cast <object>().ToList();
            }
            dh.DeleteBatch(null, "Table_TradePrice", new List <string>()
            {
                "Time", "Ticker"
            }, l);
            dh.InsertBatch(null, "Table_TradePrice", l);
        }
示例#6
0
            public void Search_MunicipalityCodeAndSize_5([Values("851")] string municipalityCode)
            {
                var searchCriteria = new SoegInputType1()
                {
                    SoegObjekt = new SoegObjektType()
                    {
                        SoegAttributListe = new SoegAttributListeType()
                        {
                            SoegRegisterOplysning = new RegisterOplysningType[]
                            {
                                new RegisterOplysningType()
                                {
                                    Item = new CprBorgerType()
                                    {
                                        FolkeregisterAdresse = new AdresseType()
                                        {
                                            Item = new DanskAdresseType()
                                            {
                                                AddressComplete = new AddressCompleteType()
                                                {
                                                    AddressAccess = new AddressAccessType()
                                                    {
                                                        MunicipalityCode = municipalityCode
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    MaksimalAntalKvantitet   = "5",
                    FoersteResultatReference = "0"
                };
                var prov = new DatabaseDataProvider();
                var ret  = prov.Search(searchCriteria);

                Assert.AreEqual(5, ret.Length);
            }
示例#7
0
        public IActionResult GetReport([FromBody] ReportRequestDto reportRequest)
        {
            ReportTemplateLoader loader   = new ReportTemplateLoader();
            StiReport            report   = new StiReport();
            IDataProvider        provider = null;

            try
            {
                loader.Load(report, reportRequest.Report);

                if (reportRequest.DataProvider.ToLower() == "xml")
                {
                    provider = new XmlFileDataProvider(reportRequest.Data["filename"].Value <string>());
                    report.RegData(provider.GetData());
                }
                else if (reportRequest.DataProvider.ToLower() == "database")
                {
                    StimulsoftRepository repository     = new StimulsoftRepository();
                    ReportSettings       reportSettings = repository.GetReportSettings(reportRequest.Report);

                    foreach (var tableName in reportSettings.TableNames)
                    {
                        provider = new DatabaseDataProvider(tableName, reportSettings.ConnectionString, reportRequest.Data);
                        report.RegData(provider.GetData());
                    }
                }
                else if (reportRequest.DataProvider.ToLower() == "url")
                {
                    provider = new UrlDataProvider("URL");
                    report.RegData(provider.GetData());
                }

                ExportFormat exporter = new ExportFormat();
                return(exporter.ExportReport(report, reportRequest.Output.ToLower()));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }