private void lbDataSources_SelectedIndexChanged(object sender, System.EventArgs e) { int cur = lbDataSources.SelectedIndex; if (cur < 0) { return; } DataSourceValues dsv = lbDataSources.Items[cur] as DataSourceValues; if (dsv == null) { return; } tbDSName.Text = dsv.Name; cbDataProvider.Text = dsv.DataProvider; tbConnection.Text = dsv.ConnectionString; ckbIntSecurity.Checked = dsv.IntegratedSecurity; this.tbFilename.Text = dsv.DataSourceReference; tbPrompt.Text = dsv.Prompt; this.chkSharedDataSource.Checked = dsv.bDataSourceReference; chkSharedDataSource_CheckedChanged(this.chkSharedDataSource, e); // force message }
private void chkSharedDataSource_CheckedChanged(object sender, System.EventArgs e) { int cur = lbDataSources.SelectedIndex; if (cur < 0) { return; } DataSourceValues dsv = lbDataSources.Items[cur] as DataSourceValues; if (dsv == null) { return; } dsv.bDataSourceReference = chkSharedDataSource.Checked; bool bEnableDataSourceRef = chkSharedDataSource.Checked; // shared data source fields tbFilename.Enabled = bEnableDataSourceRef; bGetFilename.Enabled = bEnableDataSourceRef; // in report data source cbDataProvider.Enabled = !bEnableDataSourceRef; tbConnection.Enabled = !bEnableDataSourceRef; ckbIntSecurity.Enabled = !bEnableDataSourceRef; tbPrompt.Enabled = !bEnableDataSourceRef; bTestConnection.Enabled = !bEnableDataSourceRef; lDataProvider.Enabled = !bEnableDataSourceRef; lConnectionString.Enabled = !bEnableDataSourceRef; lPrompt.Enabled = !bEnableDataSourceRef; }
private void tbDSName_TextChanged(object sender, System.EventArgs e) { int cur = lbDataSources.SelectedIndex; if (cur < 0) { return; } DataSourceValues dsv = lbDataSources.Items[cur] as DataSourceValues; if (dsv == null) { return; } if (dsv.Name == tbDSName.Text) { return; } dsv.Name = tbDSName.Text; // text doesn't change in listbox; force change by removing and re-adding item lbDataSources.BeginUpdate(); lbDataSources.Items.RemoveAt(cur); lbDataSources.Items.Insert(cur, dsv); lbDataSources.SelectedIndex = cur; lbDataSources.EndUpdate(); }
private void bAdd_Click(object sender, System.EventArgs e) { DataSourceValues dsv = new DataSourceValues("datasource"); int cur = this.lbDataSources.Items.Add(dsv); lbDataSources.SelectedIndex = cur; this.tbDSName.Focus(); }
private void ckbIntSecurity_CheckedChanged(object sender, System.EventArgs e) { int cur = lbDataSources.SelectedIndex; if (cur < 0) { return; } DataSourceValues dsv = lbDataSources.Items[cur] as DataSourceValues; if (dsv == null) { return; } dsv.IntegratedSecurity = ckbIntSecurity.Checked; }
private void cbDataProvider_SelectedIndexChanged(object sender, System.EventArgs e) { int cur = lbDataSources.SelectedIndex; if (cur < 0) { return; } DataSourceValues dsv = lbDataSources.Items[cur] as DataSourceValues; if (dsv == null) { return; } dsv.DataProvider = cbDataProvider.Text; }
private void tbPrompt_TextChanged(object sender, System.EventArgs e) { int cur = lbDataSources.SelectedIndex; if (cur < 0) { return; } DataSourceValues dsv = lbDataSources.Items[cur] as DataSourceValues; if (dsv == null) { return; } dsv.Prompt = tbPrompt.Text; }
private void tbConnection_TextChanged(object sender, System.EventArgs e) { int cur = lbDataSources.SelectedIndex; if (cur < 0) { return; } DataSourceValues dsv = lbDataSources.Items[cur] as DataSourceValues; if (dsv == null) { return; } dsv.ConnectionString = tbConnection.Text; }
private void tbFilename_TextChanged(object sender, System.EventArgs e) { int cur = lbDataSources.SelectedIndex; if (cur < 0) { return; } DataSourceValues dsv = lbDataSources.Items[cur] as DataSourceValues; if (dsv == null) { return; } dsv.DataSourceReference = tbFilename.Text; return; }
private void InitValues() { // Populate the DataProviders cbDataProvider.Items.Clear(); string[] items = RdlEngineConfig.GetProviders(); cbDataProvider.Items.AddRange(items); // // Obtain the existing DataSets info // XmlNode rNode = _Draw.GetReportNode(); XmlNode dsNode = _Draw.GetNamedChildNode(rNode, "DataSources"); if (dsNode == null) { return; } foreach (XmlNode dNode in dsNode) { if (dNode.Name != "DataSource") { continue; } XmlAttribute nAttr = dNode.Attributes["Name"]; if (nAttr == null) // shouldn't really happen { continue; } DataSourceValues dsv = new DataSourceValues(nAttr.Value); dsv.Node = dNode; dsv.DataSourceReference = _Draw.GetElementValue(dNode, "DataSourceReference", null); if (dsv.DataSourceReference == null) { // this is not a data source reference dsv.bDataSourceReference = false; dsv.DataSourceReference = ""; XmlNode cpNode = DesignXmlDraw.FindNextInHierarchy(dNode, "ConnectionProperties", "ConnectString"); dsv.ConnectionString = cpNode == null? "": cpNode.InnerText; XmlNode datap = DesignXmlDraw.FindNextInHierarchy(dNode, "ConnectionProperties", "DataProvider"); dsv.DataProvider = datap == null? "": datap.InnerText; XmlNode p = DesignXmlDraw.FindNextInHierarchy(dNode, "ConnectionProperties", "Prompt"); dsv.Prompt = p == null? "": p.InnerText; } else { // we have a data source reference dsv.bDataSourceReference = true; dsv.ConnectionString = ""; dsv.DataProvider = ""; dsv.Prompt = ""; } this.lbDataSources.Items.Add(dsv); } if (lbDataSources.Items.Count > 0) { lbDataSources.SelectedIndex = 0; } else { this.bOK.Enabled = false; } }