private void DisplayParaInfo(string snInfo, string startTime, string endTime) { var station = tbStationName.Text; var conStr = ConfigurationManager.AppSettings.Get("connectionstring") ?? @"Data Source=<Station>\SQLEXPRESS;Initial Catalog=BMS37;Persist Security Info=True;User ID=sa;Password=cml@shg629;Pooling=False".Replace("<Station>", station); var dbstore = DataServiceFactory.CreateDatabaseService(conStr); //var summayTable = new DataTable(); //if (radioButtonSn.Checked) //{ // summayTable = dbstore.GetBiRecord(ConvertToList(snInfo).ToArray()); //} //else //{ // summayTable = dbstore.GetBiRecord(Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); //} var summayTable = dbstore.GetBiRecord(ConvertToList(snInfo).ToArray(), Convert.ToDateTime(startTime), Convert.ToDateTime(endTime)); dataGridBiSummary.DataSource = summayTable; var biDataTable = new DataTable(); foreach (DataRow row in summayTable.Rows) { var table = dbstore.GetBiData(new Guid(row["DataSetId"].ToString())); biDataTable.Merge(table); } dataGridBiData.DataSource = biDataTable; }
private void InitDataBase() { _logger.Info("Start remote bak service"); _localConStr = ConfigurationManager.AppSettings.Get("connectionstring"); if (_localConStr == null) { _localConStr = $"Data Source = {_configInfo.DataSource}; Initial Catalog = {_configInfo.DataBaseName}; Persist Security Info = True; User ID = { _configInfo.UserId}; Password = {_configInfo.Password}; Pooling = False"; } _dataService = DataServiceFactory.CreateDatabaseService(_localConStr); _dataService.SetBakupPeriod(_configInfo.BakupPeriodMinutes); _dataService.SetDeletePeriod(_configInfo.DeletePeriodDays); _remoteConStr = $"Data Source = {_configInfo.RemoteDataSource}; Initial Catalog = {_configInfo.RemoteDataBaseName}; Persist Security Info = True; User ID = { _configInfo.RemoteUserId}; Password = {_configInfo.RemotePassword}; Pooling = False"; _dataService.SetRemoteConStr(_remoteConStr); var isExist = true; if (!_dataService.IsTableExist(_localConStr, _configInfo.LocalBiDataSummaryTable)) { isExist = false; _logger.Info(_configInfo.LocalBiDataSummaryTable + " is not exist"); } if (!_dataService.IsTableExist(_remoteConStr, _configInfo.RemoteSummaryBiDataTable)) { isExist = false; _logger.Info(_configInfo.RemoteSummaryBiDataTable + " is not exist"); } if (!_dataService.IsTableExist(_localConStr, _configInfo.LocalBiDataTable)) { isExist = false; _logger.Info(_configInfo.LocalBiDataTable + " is not exist"); } if (!_dataService.IsTableExist(_remoteConStr, _configInfo.RemoteBiDataTable)) { isExist = false; _logger.Info(_configInfo.RemoteBiDataTable + " is not exist"); } if (isExist) { _dataService.StartBakService(true); } }