private void DSTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (DSTypeComboBox.SelectedValue.ToString() == DataSourceBase.eDSType.MSAccess.ToString() && mDSDetails.GetType() != typeof(AccessDataSource)) { mDSDetails = new AccessDataSource(); } if (DSTypeComboBox.SelectedValue.ToString() == DataSourceBase.eDSType.MSAccess.ToString()) { mFileType = "mdb"; mDSDetails.FilePath = mTargetFolder.FolderRelativePath + @"\GingerDataSource.mdb"; FilePathTextBox.Text = mDSDetails.FilePath; DSName.Text = "GingerDataSource"; } if (DSTypeComboBox.SelectedValue.ToString() == DataSourceBase.eDSType.LiteDataBase.ToString() && mDSDetails.GetType() != typeof(GingerLiteDB)) { mDSDetails = new GingerLiteDB(); mDSDetails.DSType = DataSourceBase.eDSType.LiteDataBase; } if (DSTypeComboBox.SelectedValue.ToString() == DataSourceBase.eDSType.LiteDataBase.ToString()) { mFileType = "db"; mDSDetails.FilePath = mTargetFolder.FolderRelativePath + @"\LiteDB.db"; FilePathTextBox.Text = mDSDetails.FilePath; DSName.Text = "LiteDB"; } }
/// <summary> /// Initializes the data source connected to this band. /// </summary> public void InitDataSource() { if (DataSource == null) { DataSource = new VirtualDataSource(); DataSource.SetReport(Report); } if (DataSource is VirtualDataSource) { (DataSource as VirtualDataSource).VirtualRowsCount = RowCount; } DataSourceBase parentDataSource = ParentDataBand == null ? null : ParentDataBand.DataSource; bool collectChildRows = ParentDataBand == null ? false : ParentDataBand.CollectChildRows; if (Relation != null) { DataSource.Init(Relation, Filter, Sort, collectChildRows); } else { DataSource.Init(parentDataSource, Filter, Sort, collectChildRows); } }
internal static void Log(MessageType type, string message) { const string logSource = "YahooDataSource"; if (IsLoggable(type)) { switch (type) { case MessageType.Error: DataSourceBase.DotNetLog(logSource, "Error", message); break; case MessageType.Warning: DataSourceBase.DotNetLog(logSource, "Warning", message); break; case MessageType.Info: DataSourceBase.DotNetLog(logSource, "Info", message); break; case MessageType.Trace: DataSourceBase.DotNetLog(logSource, "Trace", message); break; } } }
/// <summary> /// Merges the calculated data. /// </summary> /// <param name="table">The table.</param> /// <param name="side">The side.</param> /// <param name="field">The field.</param> /// <param name="sql">The SQL.</param> /// <param name="dataSource">The data source.</param> /// <param name="cancelToken">The cancel token.</param> /// <returns>System.Data.DataTable.</returns> private DataTable MergeCalculatedData(DataTable table, string side, string field, string sql, DataSourceBase dataSource, CancellationTokenSource cancelToken) { string name = side + "_" + field; string file = Alias.Debug + this.Model.GetName() + "." + name + ".sql"; var query = new QueryMessageModel(sql, name); query.LogQuery(file); var results = dataSource.ExecuteQuery(sql, cancelToken.Token); query.SetCount(results); query.LogQuery(file); this.Model.Queries.Add(query); if (results.Tables.Count == 0) { return(null); } var data = results.MergeAll(); // var data = results.Tables[0]; data = data.ListAggr(); data.Columns[0].ColumnName = Alias.Primary_Key; data.PrimaryKey = new[] { data.Columns[0] }; table.InnerJoin <string>(Alias.Primary_Key, data); data.Columns[1].ColumnName = side + "_" + field; return(data); }
private void ListBox_RacerOrSources_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ListBox_RacerOrSources.SelectedIndex >= 0) { DataSourceBase ds = null; if (inRacerConfigScreen) { if (dsOnDisplay.Count > 0) { ds = dsOnDisplay[ListBox_RacerOrSources.SelectedIndex]; populateDistanceBox(ds.getSportType()); } } else { ds = configuredRacers[ListBox_RacerOrSources.SelectedIndex].dataSource; Button_RacerAddOrFinish.IsEnabled = true; Button_RacerRemoveOrCancel.IsEnabled = true; } Image_SelectionImage.Source = RacerInfoPanel.getRaceDisplayBitmap(ds.getSportType()); } else { Image_SelectionImage.Source = RacerInfoPanel.getRaceDisplayBitmap(racerSportType.Unknown); ComboBox_RaceLength.Items.Clear(); } }
private void Table1_ManualBuild(object sender, EventArgs e) { // get the data source by its name DataSourceBase rowData = Report.GetDataSource("OPU"); // init the data source rowData.Init(); // print the first table row - it is a header Table1.PrintRow(0); // each PrintRow call must be followed by either PrintColumn or PrintColumns call // to print cells on the row Table1.PrintColumns(); // now enumerate the data source and print the table body while (rowData.HasMoreRows) { // print the table body Table1.PrintRow(1); Table1.PrintColumns(); // go next data source row rowData.Next(); } }
private void _tickClient_MessageReceived(object sender, TinyMessageReceivedEventArgs e) { var tick = (MarketTick)ByteArrayToObject(e.Message); var tickerData = tickers.GetTickerData(tick.ticker); try { tickerData.RecentInfo.Ask = tick.ask; tickerData.RecentInfo.Bid = tick.bid; tickerData.RecentInfo.Last = tick.last; tickerData.RecentInfo.TotalVol = tick.vol; tickerData.RecentInfo.TradeVol = tick.vol; var now = DateTime.Now; var lastTickDate = now.Year * 10000 + now.Month * 100 + now.Day; var lastTickTime = now.Hour * 10000 + now.Minute * 100 + now.Second; tickerData.RecentInfo.DateChange = lastTickDate; tickerData.RecentInfo.TimeChange = lastTickTime; tickerData.RecentInfo.DateUpdate = lastTickDate; tickerData.RecentInfo.TimeUpdate = lastTickTime; DataSourceBase.NotifyRecentInfoUpdate(tickerData.Ticker, ref tickerData.RecentInfo); } catch (Exception ex) { LogAndMessage.LogMessage(MessageType.Error, ex.Message); } }
private void ShowGroupFooter(GroupHeaderBand header) { // finish group event OnStateChanged(header, EngineState.GroupFinished); // rollback to previous data row to print the header condition in the footer. DataBand dataBand = header.GroupDataBand; DataSourceBase dataSource = dataBand.DataSource; dataSource.Prior(); GroupFooterBand footer = header.GroupFooter; if (footer != null) { footer.AbsRowNo++; footer.RowNo++; } RemoveReprint(footer); ShowBand(footer); RemoveReprint(header); // restore current row dataSource.Next(); OutlineUp(header); if (header.KeepTogether) { EndKeep(); } if (footer != null && footer.KeepWithData) { EndKeep(); } }
public bool changeRacerSource(DataSourceBase dsb, double targetVal) { if (!dsb.Equals(dataSource)) { if (dataSource != null && dataSource.isRunning()) { return(false); } if (dsb.isInUse) { return(false); } if (dataSource != null) { dataSource.isInUse = false; //Make sure the old one is marked as free } _dataSource = dsb; dsb.isInUse = true; } targetValue = targetVal; racePanel = new RacerInfoPanel(dataSource.getSportType(), targetVal); return(true); }
private void SetDataTable() { if (mActDSTableElement.DSList == null) { mActDSTableElement.DSList = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <DataSourceBase>(); } DataSourceBase dataSource = null; var tableName = mActDSTableElement.DSTableName; if (string.IsNullOrEmpty(tableName)) { return; } foreach (var ds in mActDSTableElement.DSList) { if (ds.Name == mActDSTableElement.DSName) { dataSource = ds; } } mDataTable = dataSource.GetTable(tableName); foreach (DataSourceTable dst in dataSource.GetTablesList()) { if (dst.Name == mActDSTableElement.DSTableName) { mDataSourceTable = dst; break; } } }
private void RenderMultiColumnBand(DataBand dataBand, int rowCount) { if (dataBand.Columns.Layout == ColumnLayout.AcrossThenDown) { RenderBandAcrossThenDown(dataBand, rowCount); } else { DataSourceBase dataSource = dataBand.DataSource; int saveRow = dataSource.CurrentRowNo; // calc height of each data row. This list is shared across RenderBandDownThenAcross calls. Hashtable heights = new Hashtable(); for (int i = 0; i < rowCount; i++) { dataSource.CurrentRowNo = i + saveRow; heights[i + saveRow] = CalcHeight(dataBand); } dataSource.CurrentRowNo = saveRow; while (rowCount > 0) { rowCount = RenderBandDownThenAcross(dataBand, rowCount, heights); } } }
private GroupTreeItem MakeGroupTree(GroupHeaderBand groupBand) { GroupTreeItem rootItem = new GroupTreeItem(null); DataSourceBase dataSource = groupBand.DataSource; bool isFirstRow = true; // cycle through rows dataSource.First(); while (dataSource.HasMoreRows) { if (isFirstRow) { InitGroupItem(groupBand, rootItem); } else { CheckGroupItem(groupBand, rootItem); } dataSource.Next(); isFirstRow = false; if (Report.Aborted) { break; } } return(rootItem); }
public static void LoadDataSource(Type dataSourceType, bool autoStart) { try { DataSourceBase ds = Activator.CreateInstance(dataSourceType) as DataSourceBase; if (ds != null) { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { DataSources.Add(ds); })); ds.DataReceived = new Action <string, object>(SendData); ds.DataPointReceived = new Action <DataPoint>(SendData); ds.ExceptionOccurred += DataSource_ExceptionOccurred; ds.Initialize(); if (autoStart) { ds.Start(); } } } catch (Exception ex) { _logService.Error(string.Format("ExistCatch:error:<-{0}->:{1} \r\n Error detail:{2}", "LoadDataSource", ex.Message, ex.ToString())); } }
private void RenderBandAcrossThenDown(DataBand dataBand, int rowCount) { DataSourceBase dataSource = dataBand.DataSource; int saveRow = dataSource.CurrentRowNo; bool keepLastRow = NeedKeepLastRow(dataBand); // create output band using (DataBand outputBand = new DataBand()) { outputBand.SetReport(Report); int columnNo = 0; for (int i = 0; i < rowCount; i++) { bool isLastRow = i == rowCount - 1; dataSource.CurrentRowNo = i + saveRow; if (columnNo == 0) { outputBand.Clear(); outputBand.Assign(dataBand); outputBand.OutlineExpression = ""; outputBand.Border = new Border(); outputBand.Fill = new SolidFill(); } // write to the output band ShowBand(dataBand, outputBand, dataBand.Columns.Positions[columnNo], 0); // add outline AddBandOutline(dataBand); // outline up OutlineUp(dataBand); dataBand.RowNo++; dataBand.AbsRowNo++; columnNo++; if (columnNo == dataBand.Columns.Count || isLastRow) { columnNo = 0; // keep footer if (isLastRow && keepLastRow && dataBand.IsDeepmostDataBand) { StartKeep(outputBand); } // show output band itself ShowBand(outputBand, false); // end keep footer if (isLastRow && keepLastRow && dataBand.IsDeepmostDataBand) { CheckKeepFooter(dataBand); } } } } dataSource.CurrentRowNo = saveRow + rowCount; }
public static string CheckDataSource(string DataSourceVE, ObservableList <DataSourceBase> DSList) { string DSVE = DataSourceVE; DataSourceBase DataSource = null; DataSourceTable DSTable = null; if (string.IsNullOrEmpty(DataSourceVE) || DSVE.IndexOf("{DS Name=") != 0) { return("Invalid Data Source Value : '" + DataSourceVE + "'"); } DSVE = DSVE.Replace("{DS Name=", ""); DSVE = DSVE.Replace("}", ""); if (DSVE.IndexOf(" DST=") == -1) { return("Invalid Data Source Value : '" + DataSourceVE + "'"); } string DSName = DSVE.Substring(0, DSVE.IndexOf(" DST=")); foreach (DataSourceBase ds in DSList) { if (ds.Name == DSName) { DataSource = ds; break; } } if (DataSource == null) { return("Data Source: '" + DSName + "' used in '" + DataSourceVE + "' not found in solution."); } DSVE = DSVE.Substring(DSVE.IndexOf(" DST=")).Trim(); if (DSVE.IndexOf(" ") == -1) { return("Invalid Data Source Value : '" + DataSourceVE + "'"); } string DSTableName = DSVE.Substring(DSVE.IndexOf("DST=") + 4, DSVE.IndexOf(" ") - 4); if (DataSource.DSType == DataSourceBase.eDSType.MSAccess) { DataSource.FileFullPath = WorkSpace.Instance.Solution.SolutionOperations.ConvertSolutionRelativePath(DataSource.FileFullPath); ObservableList <DataSourceTable> dsTables = DataSource.GetTablesList(); foreach (DataSourceTable dst in dsTables) { if (dst.Name == DSTableName) { DSTable = dst; break; } } if (DSTable == null) { return("Data Source Table : '" + DSTableName + "' used in '" + DataSourceVE + "' not found in solution."); } } return(""); }
public DataFormFactory <T> AddComboBox <TD>(Expression <Func <T, TD> > nazwaPola, string tooltip = null, DataSourceBase dataSource = null, bool loadOnDemand = false) { ActiveDataForm.AddComboBox(nazwaPola, tooltip, dataSource, loadOnDemand); return(this); }
public DataSourceFactory <T> DataSource(DataSourceBase dataSource) { var sourceFactory = new DataSourceFactory <T>(); sourceFactory.DataSource = dataSource; ItemsWidget.DataSource = dataSource; return(sourceFactory); }
/// <summary> /// This is used to initialize the wizard /// </summary> public ImportDataSourceFromExcelWizard(DataSourceBase DSDetails) { mDSDetails = DSDetails; AddPage(Name: "Introduction", Title: "Introduction", SubTitle: "Import DataSource From Excel File", Page: new WizardIntroPage("/DataSource/ImportExcelWizardLib/ImportDataSourceIntro.md")); AddPage(Name: "Browse File", Title: "Browse File", SubTitle: "Import DataSource From Excel File", Page: new ImportDataSourceBrowseFile()); AddPage(Name: "Sheet Selection", Title: "Sheet Selection", SubTitle: "Import DataSource From Excel File", Page: new ImportDataSourceSheetSelection()); AddPage(Name: "Display Data", Title: "Display Data", SubTitle: "Import DataSource From Excel File", Page: new ImportDataSourceDisplayData()); }
public object Load(DataSourceBase ds, List <FormatParameter> parameters) { //Remember to set source stream to begining ds.Stream.Seek(0, SeekOrigin.Begin); using (var br = new BinaryReader(ds.Stream, Encoding.Default, true)) return(new BinaryModel(br.ReadBytes((int)ds.Stream.Length))); }
/// <inheritdoc/> protected override void FillData(DataSourceBase dataSource, Column column) { lvAvailableItems.Items.Clear(); lvAvailableItems.Items.AddRange(GetListOfData(dataSource, column)); if (lvAvailableItems.Items.Count > 0) lvAvailableItems.SelectedIndex = 0; UpdateButtons(); }
private void tvDataSource_AfterSelect(object sender, TreeViewEventArgs e) { if (!FFirstRun) { DataSourceBase data = tvDataSource.SelectedNode.Tag as DataSourceBase; FillSort(data, true); } FFirstRun = false; }
public object Load(DataSourceBase ds, List <FormatParameter> parameters) { //Remember to set source stream to begining ds.Stream.Seek(0, SeekOrigin.Begin); var tileSetBuilder = TileSetBuilder.NewTileSet(); var blkReader = new BLKReader(tileSetBuilder); return(blkReader.Read(ds.Stream)); }
public object Load(DataSourceBase ds, List <FormatParameter> parameters) { //Remember to set source stream to begining ds.Stream.Seek(0, SeekOrigin.Begin); var mapBuilder = MapBuilder.NewMapModel(); var mapReader = new MAPReader(mapBuilder, MAPFormat.ABTA); return(mapReader.Read(ds.Stream)); }
private string[] GetColumns(DataSourceBase data) { string[] result = new string[data.Columns.Count + 1]; result[0] = ""; for (int i = 0; i < data.Columns.Count; i++) { result[i + 1] = data.Columns[i].Alias; } return(result); }
public object Load(DataSourceBase ds, List <FormatParameter> parameters) { //Remember to set source stream to begining ds.Stream.Seek(0, SeekOrigin.Begin); var imageBuilder = ImageBuilder.NewImage(); var reader = new LBMImageReader(imageBuilder); return(reader.Read(ds.Stream)); }
/// <inheritdoc/> protected override void FillData(DataSourceBase dataSource, Column column) { Items.Clear(); Items.AddRange(GetListOfData(dataSource, column)); if (Items.Count > 0) { SelectedIndex = 0; } }
private void btnReport_Click(object sender, EventArgs e) { btnStore.Enabled = true; if (cbCourse.Text == "") { MessageBox.Show("blank fields !!!"); } else { DataBand d1 = null; DataBand d2 = null; DataSourceBase parentDs = null; DataSourceBase childDs = null; DataSourceBase customersTable = null; DataSourceBase ordersTable = null; Relation rel = null; report.Dictionary.Clear(); DataTable dt = dataGridView1.DataSource as DataTable; DataView view = new DataView(dt); view.RowFilter = "Ch = 1"; dt = view.ToTable(); report.RegisterData(dt, "ShowQuestions"); report.RegisterData(DbProcess.ShowAnswer(), "ShowAnswer"); report.SetParameterValue("mypara", textBox1.Text); //report.SetParameterValue("depar", cbDepartmanlar.Text); report.SetParameterValue("course", cbCourse.Text); report.SetParameterValue("smester", cbAcedemicYear.Text); report.SetParameterValue("exam", comboBox4.Text); parentDs = report.GetDataSource("ShowQuestions"); childDs = report.GetDataSource("ShowAnswer"); parentDs.Enabled = true; childDs.Enabled = true; customersTable = report.Dictionary.DataSources.FindByAlias("ShowQuestions"); ordersTable = report.Dictionary.DataSources.FindByAlias("ShowAnswer"); rel = new Relation(); rel.Name = "customersOrders"; rel.ParentDataSource = customersTable; rel.ChildDataSource = ordersTable; rel.ParentColumns = new string[] { "Id" }; rel.ChildColumns = new string[] { "QuestionId" }; report.Dictionary.Relations.Add(rel); report.Dictionary.UpdateRelations(); d1 = report.FindObject("Data1") as DataBand; d1.DataSource = parentDs; d2 = report.FindObject("Data2") as DataBand; d2.DataSource = childDs; report.Show(); } }
private bool isDataSourceReserved(DataSourceBase ds) { foreach (RacerDetails i in configuredRacers) { if (i != null && i.dataSource.Equals(ds)) { return(true); } } return(false); }
private void DSTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (DSTypeComboBox.SelectedValue.ToString() == DataSourceBase.eDSType.MSAccess.ToString() && mDSDetails.GetType() != typeof(AccessDataSource)) { mDSDetails = new AccessDataSource(); } if (DSTypeComboBox.SelectedValue.ToString() == DataSourceBase.eDSType.MSAccess.ToString()) { mFileType = "mdb"; } }
public object Load(DataSourceBase ds, List <FormatParameter> parameters) { //Remember to set source stream to begining ds.Stream.Seek(0, SeekOrigin.Begin); var spriteSetBuilder = SpriteSetBuilder.NewSpriteSet(); //spriteSetBuilder.SetSource(source); var sprReader = new SPRReader(spriteSetBuilder); return(sprReader.Read(ds.Stream)); }