Browse Source

Modified DatabaseConnections

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1002 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 20 years ago
parent
commit
bfc7af014d
  1. 36
      src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs
  2. 10
      src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs
  3. 2
      src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs
  4. 14
      src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs

36
src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs

@ -53,21 +53,19 @@ namespace SharpReport{ @@ -53,21 +53,19 @@ namespace SharpReport{
#region privates
private ConnectionObject BuildConnectionObject (ReportSettings settings) {
System.Console.WriteLine("Manager:BuildConnectionObject");
try {
if (settings.ConnectionString.Length > 0) {
System.Console.WriteLine("\tBuild from settings");
return new ConnectionObject(settings.ConnectionString);
} else {
System.Console.WriteLine("\tBuild from DataLink");
IConnection ole = OLEDBConnectionWrapper.CreateFromDataConnectionLink();
System.Console.WriteLine("\t Con Str {0}",ole.ConnectionString);
return new ConnectionObject(ole.ConnectionString);
if (settings.ReportType == GlobalEnums.enmReportType.DataReport) {
try {
if (settings.ConnectionString.Length > 0) {
return new ConnectionObject(settings.ConnectionString);
} else {
IConnection ole = OLEDBConnectionWrapper.CreateFromDataConnectionLink();
return new ConnectionObject(ole.ConnectionString);
}
} catch (Exception) {
throw;
}
} catch (Exception) {
throw;
}
return null;
}
/// <summary>
@ -77,7 +75,7 @@ namespace SharpReport{ @@ -77,7 +75,7 @@ namespace SharpReport{
/// <returns><see cref="ColumnCollection"</returns>
private ColumnCollection ReadColumnCollection() {
System.Console.WriteLine("ReadColumnCOllection");
DataManager dataManager = null;
if (baseDesignerControl == null) {
return new ColumnCollection();
@ -90,15 +88,13 @@ namespace SharpReport{ @@ -90,15 +88,13 @@ namespace SharpReport{
if (baseDesignerControl.ReportModel.ReportSettings.DataModel.Equals(GlobalEnums.enmPushPullModel.PushData)) {
return new ColumnCollection();
}
System.Console.WriteLine("\tConnectionObject == null {0}",(base.ConnectionObject == null));
// PullData, query the Datasource and ask for the available Fields
if (base.ConnectionObject == null) {
System.Console.WriteLine("\tlook for Connection");
base.ConnectionObject = this.BuildConnectionObject(baseDesignerControl.ReportModel.ReportSettings);
}
if (this.baseDesignerControl.ReportModel.ReportSettings.DataModel.Equals(GlobalEnums.enmPushPullModel.PullData)){
System.Console.WriteLine("\t tryx to use DataManager");
using (dataManager = new DataManager(base.ConnectionObject,
baseDesignerControl.ReportModel.ReportSettings)) {
dataManager.DataBind();
@ -327,6 +323,12 @@ namespace SharpReport{ @@ -327,6 +323,12 @@ namespace SharpReport{
try {
System.Console.WriteLine("--------------------");
System.Console.WriteLine("Manager:ReportPreview");
//Allways check for a valid ConnectionObject
if (base.ConnectionObject == null) {
base.ConnectionObject = this.BuildConnectionObject(baseDesignerControl.ReportModel.ReportSettings);
}
AbstractRenderer abstr = base.AbstractRenderer(model);
if (abstr != null) {

10
src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/FieldsExplorer.cs

@ -47,7 +47,7 @@ namespace SharpReportAddin { @@ -47,7 +47,7 @@ namespace SharpReportAddin {
private TreeNode nodeParams;
private ReportSettings reportSettings;
private bool isFilled = false;
#region Publics
@ -62,6 +62,7 @@ namespace SharpReportAddin { @@ -62,6 +62,7 @@ namespace SharpReportAddin {
BuildNodes();
this.FillTree();
this.ExpandAll();
isFilled = true;
}
@ -107,6 +108,7 @@ namespace SharpReportAddin { @@ -107,6 +108,7 @@ namespace SharpReportAddin {
this.NotifyReportView();
}
}
#endregion
#region TreeView Events
@ -234,7 +236,6 @@ namespace SharpReportAddin { @@ -234,7 +236,6 @@ namespace SharpReportAddin {
}
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent is SharpReportView) {
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving -= new EventHandler (OnViewSaving);
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving += new EventHandler (OnViewSaving);
}
@ -244,8 +245,11 @@ namespace SharpReportAddin { @@ -244,8 +245,11 @@ namespace SharpReportAddin {
}
private void OnViewSaving (object sender, EventArgs e) {
UpdateSorting();
if (this.isFilled) {
UpdateSorting();
UpdateGrouping();
}
}
#endregion

2
src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs

@ -93,6 +93,7 @@ namespace SharpReportAddin{ @@ -93,6 +93,7 @@ namespace SharpReportAddin{
try {
Type type = typeof(FieldsExplorer);
SharpReportAddin.FieldsExplorer fe = (SharpReportAddin.FieldsExplorer)WorkbenchSingleton.Workbench.GetPad(type).PadContent;
if (fe != null) {
this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection;
fe.Fill(this.designerControl.ReportModel.ReportSettings);
@ -340,6 +341,7 @@ namespace SharpReportAddin{ @@ -340,6 +341,7 @@ namespace SharpReportAddin{
//Something was dropped on the designer
private void OnItemDragDrop (object sender,ItemDragDropEventArgs e) {
base.IsDirty = true;
this.SetFieldsExplorer();
}
public void OnPropertyChanged (object sender,

14
src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs

@ -53,7 +53,7 @@ namespace SharpReportCore { @@ -53,7 +53,7 @@ namespace SharpReportCore {
}
#region ParameterHandling
private bool CheckReportParameters (ReportModel model,ReportParameters reportParameters) {
System.Console.WriteLine("Engine");
if (model.ReportSettings.ReportType != GlobalEnums.enmReportType.FormSheet) {
@ -88,16 +88,14 @@ namespace SharpReportCore { @@ -88,16 +88,14 @@ namespace SharpReportCore {
SharpReportParametersEventArgs e = new SharpReportParametersEventArgs();
e.SqlParametersCollection = settings.SqlParametersCollection;
e.ReportName = settings.ReportName;
System.Console.WriteLine("\tfire ParamsRequets");
ParametersRequest (this,e);
}
} else {
System.Console.WriteLine("\t No Parameters"); }
}
}
void SetSqlParameters (ReportModel model,AbstractParametersCollection sqlParams) {
if ((sqlParams == null)||(sqlParams.Count == 0)) {
return;
@ -140,15 +138,13 @@ namespace SharpReportCore { @@ -140,15 +138,13 @@ namespace SharpReportCore {
if (settings.ReportType == GlobalEnums.enmReportType.DataReport) {
if (settings.CommandText != null) {
try {
System.Console.WriteLine("\tcheck for params");
GrapSqlParameters (settings);
System.Console.WriteLine("\tParamRequest done");
System.Console.WriteLine("\t COnnection != null {0}",this.connectionObject != null);
if (this.connectionObject != null) {
DataManager container = new DataManager(this.connectionObject,
settings);
System.Console.WriteLine("\t No of Records to print {0}",container.Count);
if (container.DataBind() == true) {
return container;
} else {

Loading…
Cancel
Save