|
|
|
|
@ -27,7 +27,6 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -27,7 +27,6 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
|
|
|
|
|
private ReportStructure reportStructure; |
|
|
|
|
private Properties customizer; |
|
|
|
|
private DataSet resultDataSet; |
|
|
|
|
private AvailableFieldsCollection abstractColumns; |
|
|
|
|
|
|
|
|
|
public PushModelPanel() |
|
|
|
|
{ |
|
|
|
|
@ -36,15 +35,16 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -36,15 +35,16 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
|
|
|
|
|
base.EnableCancel = true; |
|
|
|
|
base.EnableNext = false; |
|
|
|
|
Localize (); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Localize () |
|
|
|
|
|
|
|
|
|
void Localize () |
|
|
|
|
{ |
|
|
|
|
this.label1.Text = ResourceService.GetString("SharpReport.Wizard.PushModel.Path"); |
|
|
|
|
this.label2.Text = ResourceService.GetString("SharpReport.Wizard.PushModel.AvailableFields"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BtnPathClick(object sender, System.EventArgs e) |
|
|
|
|
{ |
|
|
|
|
using (OpenFileDialog fdiag = new OpenFileDialog()) { |
|
|
|
|
@ -60,21 +60,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -60,21 +60,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
|
|
|
|
|
base.EnableNext = true; |
|
|
|
|
base.EnableFinish= true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private AvailableFieldsCollection AvailableFieldsCollectionFromTable (DataTable table) |
|
|
|
|
{ |
|
|
|
|
AvailableFieldsCollection av = new AvailableFieldsCollection(); |
|
|
|
|
AbstractColumn ac = null; |
|
|
|
|
foreach (DataColumn dc in resultDataSet.Tables[0].Columns) { |
|
|
|
|
Console.WriteLine("{0} - {1}",dc.ColumnName,dc.DataType); |
|
|
|
|
ac = new AbstractColumn(dc.ColumnName,dc.DataType); |
|
|
|
|
av.Add(ac); |
|
|
|
|
} |
|
|
|
|
return av; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -84,41 +70,15 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -84,41 +70,15 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
|
|
|
|
|
{ |
|
|
|
|
this.resultDataSet = new DataSet(); |
|
|
|
|
this.resultDataSet.Locale = CultureInfo.CurrentCulture; |
|
|
|
|
|
|
|
|
|
resultDataSet.ReadXml (fileName); |
|
|
|
|
this.grdQuery.DataSource = resultDataSet.Tables[0]; |
|
|
|
|
this.abstractColumns = WizardHelper.AvailableFieldsCollection(this.resultDataSet); |
|
|
|
|
foreach (DataGridViewColumn dd in this.grdQuery.Columns) { |
|
|
|
|
DataGridViewColumnHeaderCheckBoxCell cb = new DataGridViewColumnHeaderCheckBoxCell(); |
|
|
|
|
cb.CheckBoxAlignment = HorizontalAlignment.Left; |
|
|
|
|
cb.Checked = true; |
|
|
|
|
dd.HeaderCell = cb; |
|
|
|
|
} |
|
|
|
|
WizardHelper.SetupGridView(this.grdQuery); |
|
|
|
|
grdQuery.AllowUserToOrderColumns = true; |
|
|
|
|
base.EnableFinish = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// only checked columns are use in the report
|
|
|
|
|
|
|
|
|
|
private ReportItemCollection CreateItemsCollection (DataGridViewColumn[] displayCols) |
|
|
|
|
{ |
|
|
|
|
ReportItemCollection items = new ReportItemCollection(); |
|
|
|
|
foreach (DataGridViewColumn cc in displayCols) { |
|
|
|
|
DataGridViewColumnHeaderCheckBoxCell hc= (DataGridViewColumnHeaderCheckBoxCell)cc.HeaderCell; |
|
|
|
|
if (hc.Checked) { |
|
|
|
|
AbstractColumn ac = this.abstractColumns.Find(cc.HeaderText); |
|
|
|
|
ICSharpCode.Reports.Core.BaseDataItem br = new ICSharpCode.Reports.Core.BaseDataItem(); |
|
|
|
|
br.Name = ac.ColumnName; |
|
|
|
|
br.ColumnName = ac.ColumnName; |
|
|
|
|
br.DataType = ac.DataTypeName; |
|
|
|
|
br.DBValue = ac.ColumnName; |
|
|
|
|
items.Add(br); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return items; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region overrides
|
|
|
|
|
|
|
|
|
|
@ -149,6 +109,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -149,6 +109,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void WriteResult () |
|
|
|
|
{ |
|
|
|
|
if (this.resultDataSet != null) { |
|
|
|
|
@ -165,14 +126,18 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -165,14 +126,18 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
reportStructure.ReportItemCollection.Clear(); |
|
|
|
|
reportStructure.ReportItemCollection.AddRange(CreateItemsCollection (displayCols)); |
|
|
|
|
if (this.abstractColumns != null) { |
|
|
|
|
var items = WizardHelper.CreateItemsCollection(this.resultDataSet,displayCols); |
|
|
|
|
reportStructure.ReportItemCollection.AddRange(items); |
|
|
|
|
|
|
|
|
|
var abstractColumns = WizardHelper.AvailableFieldsCollection(this.resultDataSet); |
|
|
|
|
if (abstractColumns != null) { |
|
|
|
|
reportStructure.AvailableFieldsCollection.Clear(); |
|
|
|
|
reportStructure.AvailableFieldsCollection.AddRange(abstractColumns); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Windows Forms Designer generated code
|
|
|
|
|
@ -193,8 +158,8 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -193,8 +158,8 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
|
|
|
|
|
//
|
|
|
|
|
// txtPath
|
|
|
|
|
//
|
|
|
|
|
this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
|
|
|
|
| System.Windows.Forms.AnchorStyles.Right))); |
|
|
|
|
this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
|
|
|
|
| System.Windows.Forms.AnchorStyles.Right))); |
|
|
|
|
this.txtPath.Location = new System.Drawing.Point(16, 63); |
|
|
|
|
this.txtPath.Name = "txtPath"; |
|
|
|
|
this.txtPath.Size = new System.Drawing.Size(338, 20); |
|
|
|
|
@ -210,8 +175,8 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -210,8 +175,8 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
|
|
|
|
|
//
|
|
|
|
|
// btnPath
|
|
|
|
|
//
|
|
|
|
|
this.btnPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
|
|
|
|
| System.Windows.Forms.AnchorStyles.Right))); |
|
|
|
|
this.btnPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
|
|
|
|
| System.Windows.Forms.AnchorStyles.Right))); |
|
|
|
|
this.btnPath.FlatStyle = System.Windows.Forms.FlatStyle.Flat; |
|
|
|
|
this.btnPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); |
|
|
|
|
this.btnPath.Location = new System.Drawing.Point(383, 58); |
|
|
|
|
@ -240,9 +205,9 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -240,9 +205,9 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
|
|
|
|
|
// dataGridView1
|
|
|
|
|
//
|
|
|
|
|
this.grdQuery.AllowUserToOrderColumns = true; |
|
|
|
|
this.grdQuery.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
|
|
|
|
| System.Windows.Forms.AnchorStyles.Left) |
|
|
|
|
| System.Windows.Forms.AnchorStyles.Right))); |
|
|
|
|
this.grdQuery.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
|
|
|
|
| System.Windows.Forms.AnchorStyles.Left) |
|
|
|
|
| System.Windows.Forms.AnchorStyles.Right))); |
|
|
|
|
this.grdQuery.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
|
|
|
|
this.grdQuery.Location = new System.Drawing.Point(16, 120); |
|
|
|
|
this.grdQuery.Name = "dataGridView1"; |
|
|
|
|
|