Пример #1
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			base.EnableFinish = true;
			base.IsLastPanel = true;
			base.EnablePrevious = true;
			
			if (customizer == null) {
				customizer = (Properties)base.CustomizationObject;
			}
			
			if (message == DialogMessage.Activated) {
				
				this.layoutControl.ReportLayout = (GlobalEnums.ReportLayout)customizer.Get("ReportLayout");
				reportStructure = (ReportStructure)customizer.Get("Generator");
				layoutControl.AvailableFieldsCollection = reportStructure.AvailableFieldsCollection;
			}
			
			else if (message == DialogMessage.Finish)
			{
				customizer.Set ("ReportLayout",this.layoutControl.ReportLayout);
				var reportStructure = (ReportStructure)customizer.Get("Generator");
				reportStructure.Grouping = layoutControl.GroupName;
			}
			return true;
		}
		public void GeneratePlainReport_1()
		{
			ReportModel model = ReportModel.Create();

			ReportStructure reportStructure = new ReportStructure()
			{
				ReportLayout = GlobalEnums.ReportLayout.ListLayout
			};
			IReportGenerator generator = new GeneratePlainReport(model,reportStructure);
			generator.GenerateReport();
			
			XDocument doc1 = XDocument.Load(new XmlNodeReader (generator.XmlReport));
			
			XDocument doc2 = new XDocument();
			
			using (XmlWriter w = doc2.CreateWriter()){
				generator.XmlReport.Save (w);
			}
			XDocument doc3 = ReportGenerationHelper.XmlDocumentToXDocument(generator.XmlReport);
			Assert.IsNotNull (doc1);
			Assert.IsNotNull (doc2);
			Assert.IsNotNull (doc2);
			
			var sq = from si in doc1.Descendants() select si;
			Console.WriteLine ("xxxxx");
			foreach (XElement a in sq)
			{
				Console.WriteLine (a.Name);
			}
			
		}
		private static ReportStructure CreateReportStructure (string reportName)
		{
			ReportStructure structure = new ReportStructure();
			structure.ReportName = reportName;
			structure.DataModel = GlobalEnums.PushPullModel.PushData;
			structure.ReportType = GlobalEnums.ReportType.DataReport;
			return structure;
		}
Пример #4
0
		public GeneratePullDataReport(ReportModel reportModel,ReportStructure reportStructure):base(reportModel,reportStructure)		                              		                             	                         
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			base.UpdateGenerator();
			base.UpdateModel();
			base.SqlQueryParameters.AddRange(base.ReportStructure.SqlQueryParameters);
		}
		private ReportModel FormSheetModel()
		{
			ReportStructure rs = new ReportStructure();
			rs.ReportName = "PlainReport";
			rs.GraphicsUnit = System.Drawing.GraphicsUnit.Millimeter;
			rs.ReportType = GlobalEnums.ReportType.FormSheet;
			rs.DataModel = GlobalEnums.PushPullModel.FormSheet;	
			ReportModel m = rs.CreateAndFillReportModel ();
			return m;
		}
		public GenerateFormSheetReport(ReportModel reportModel,ReportStructure reportStructure ):base(reportModel,reportStructure)                                                      
		{
		                             	
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			
			if (base.ReportModel.ReportSettings.DataModel != GlobalEnums.PushPullModel.FormSheet) {
				throw new InvalidReportModelException();
			}
		}
Пример #7
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			
			this.reportStructure = (ReportStructure)base.CustomizationObject;

			if (message == DialogMessage.Next) {
				reportStructure.SqlString = this.txtSqlString.Text.Trim();
				reportStructure.ConnectionString = connectionString;
				base.EnableFinish = true;
			}
			return true;
		}
Пример #8
0
		protected AbstractReportGenerator(ReportModel reportModel,ReportStructure reportStructure)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			if (reportStructure == null) {
				throw new ArgumentNullException("reportStructure");
			}
			this.ReportModel = reportModel;
			ReportStructure = reportStructure;
			this.AvailableFieldsCollection.Clear();
			this.ReportItemCollection.Clear();
			this.GroupColumnCollection.Clear();
			this.ParameterCollection.Clear();
		}
Пример #9
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			if (customizer == null) {
				customizer = (Properties)base.CustomizationObject;
				reportStructure = (ReportStructure)customizer.Get("Generator");
			}
			
			if (message == DialogMessage.Next) {
				customizer.Set("SqlString", this.txtSqlString.Text.Trim());
				reportStructure.SqlString = this.txtSqlString.Text.Trim();
				reportStructure.ConnectionString = connectionString;
				base.EnableFinish = true;
			}
			return true;
		}
		public void CanCreateContentFromFile ()
		{
			ReportModel model = ReportModel.Create();
		ReportStructure reportStructure = new ReportStructure()
			{
				ReportLayout = GlobalEnums.ReportLayout.ListLayout
			};
			IReportGenerator generator = new GeneratePlainReport(model,reportStructure);
			generator.GenerateReport();
			MockOpenedFile mof = new MockOpenedFile(GlobalValues.PlainFileName);
			OpenedFile file = new MockOpenedFile(GlobalValues.PlainFileName);
			file.SetData(generator.Generated.ToArray());
			
			//ICSharpCode.SharpDevelop.Gui.IViewContent v = displayBinding.CreateContentForFile(new MockOpenedFile("test.srd"));
			//Assert.IsNotNull(v,"View should not be 'null'");
		}
		/// <summary>
		/// Default constructor - initializes all fields to default values
		/// </summary>
		public GeneratePushDataReport(ReportModel reportModel,		                              
		                              Properties properties):base(reportModel,properties)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}

			if (base.ReportModel.ReportSettings.DataModel != GlobalEnums.PushPullModel.PushData) {
				throw new ArgumentException ("Wrong DataModel in GeneratePushReport");
			}
			
			reportStructure = (ReportStructure)properties.Get("Generator");

			base.AvailableFieldsCollection.AddRange(reportStructure.AvailableFieldsCollection);
			base.ReportItemCollection.AddRange(reportStructure.ReportItemCollection);
		}
		public void FormSheetReport ()
		{
			ReportStructure rs = new ReportStructure();
			rs.ReportName = "PlainReport";
			rs.GraphicsUnit = System.Drawing.GraphicsUnit.Millimeter;
			rs.ReportType = GlobalEnums.ReportType.FormSheet;
			rs.DataModel = GlobalEnums.PushPullModel.FormSheet;
			
			ReportModel m = rs.CreateAndFillReportModel ();
			Assert.AreEqual("PlainReport",m.ReportSettings.ReportName,"invalid ReportName");
			Assert.AreEqual(m.ReportSettings.ReportType,GlobalEnums.ReportType.FormSheet,
			                "ReportModel,ReportSettings.eportType should be 'FormSheet'");
			Assert.AreEqual (GlobalEnums.PushPullModel.FormSheet,m.DataModel,
			                 "Datamodel should be 'FormSheet'");
			
		}
Пример #13
0
		public static IReportGenerator Create (ReportModel model,ReportStructure reportStructure)			                                     
		                                       
		{	
			IReportGenerator reportGenerator = null;
				switch (model.DataModel) {
				case GlobalEnums.PushPullModel.PullData:
					reportGenerator = new GeneratePullDataReport(model,reportStructure);
					break;
				case GlobalEnums.PushPullModel.PushData:
					reportGenerator = new GeneratePushDataReport(model,reportStructure);
					break;
				case GlobalEnums.PushPullModel.FormSheet:
					reportGenerator = new GenerateFormSheetReport (model,reportStructure);
					break;
			}
			return reportGenerator;
		}
Пример #14
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			base.EnableFinish = true;
			base.IsLastPanel = true;
			base.EnablePrevious = true;
			reportStructure = (ReportStructure)base.CustomizationObject;
			if (message == DialogMessage.Activated) {
				layoutControl.AvailableFieldsCollection = reportStructure.AvailableFieldsCollection;
			}
			
			else if (message == DialogMessage.Finish)
			{
				reportStructure.ReportLayout = layoutControl.ReportLayout;
				reportStructure.Grouping = layoutControl.GroupName;
			}
			return true;
		}
Пример #15
0
		public override void Run()
		{
			reportStructure = new ReportStructure();
			if (GlobalValues.IsValidPrinter() == true) {
				
				using (WizardDialog wizard = new WizardDialog("Report Wizard", reportStructure, WizardPath)) {
					if (wizard.ShowDialog() == DialogResult.OK) {
						reportModel = reportStructure.CreateAndFillReportModel ();
						CreateReportFromModel(reportModel,reportStructure);
					}
					else{
						this.canceled = true;
					}
				}
			} else {
				MessageService.ShowError(ResourceService.GetString("Sharpreport.Error.NoPrinter"));
			}
		}
Пример #16
0
		private ReportModel CreateModel ()
		{
			ReportModel m = ReportModel.Create();

			ReportStructure reportStructure = new ReportStructure()
			{
				ReportLayout = GlobalEnums.ReportLayout.ListLayout
			};
			
			IReportGenerator generator = new GenerateFormSheetReport(m,reportStructure);
			generator.GenerateReport();
			
			ReportLoader loader = new ReportLoader();
			object root = loader.Load(generator.XmlReport.DocumentElement);
			
			ReportModel model = root as ReportModel;
			
			model.ReportSettings.FileName = GlobalValues.PlainFileName;
			FilePathConverter.AdjustReportName(model);
			return model;
		}
Пример #17
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			if (customizer == null) {
				customizer = (Properties)base.CustomizationObject;
				reportStructure = (ReportStructure)customizer.Get("Generator");
			}
			
			if (message == DialogMessage.Next) {
				if (currentNode is SharpQueryNodeProcedure) {
					commandType = CommandType.StoredProcedure;
				} else {
					commandType = CommandType.Text;
				}
				customizer.Set("SqlString", this.txtSqlString.Text.Trim());
				reportStructure.CommandType = commandType;
				reportStructure.SqlString = this.txtSqlString.Text.Trim();
				reportStructure.ConnectionString = connectionString;
				base.EnableFinish = true;
			}
			return true;
		}
		private XmlDocument CreateXmlFromModel ()
		{
			ReportModel model = ReportModel.Create();
			ReportStructure reportStructure = new ReportStructure()
			{
				ReportLayout = GlobalEnums.ReportLayout.ListLayout
			};
			IReportGenerator generator = new GeneratePlainReport(model,reportStructure);
			generator.GenerateReport();
			return generator.XmlReport;
		}
Пример #19
0
		private void CreateReportFromModel (ReportModel model,ReportStructure reportStructure)
		{
			reportGenerator = GeneratorFactory.Create (model,reportStructure);
			file.MakeDirty();
			reportGenerator.GenerateReport();
		}
Пример #20
0
		private void UpdateGenerator ()
		{

			reportStructure = (ReportStructure)base.CustomizationObject;


			reportStructure.ReportName = txtReportName.Text;
			if (!this.txtFileName.Text.EndsWith(GlobalValues.ReportExtension,StringComparison.OrdinalIgnoreCase)){
				reportStructure.FileName = txtFileName.Text + GlobalValues.ReportExtension;
			} else {
				reportStructure.FileName = txtFileName.Text;
			}
			reportStructure.Path = this.txtPath.Text;
			reportStructure.GraphicsUnit = (GraphicsUnit)Enum.Parse(typeof(GraphicsUnit),
			                                                  this.cboGraphicsUnit.Text);

			if (this.radioPullModell.Checked == true) {
				base.NextWizardPanelID = "PullModel";
				reportStructure.DataModel = GlobalEnums.PushPullModel.PullData;
				GoOn();
			} else if (this.radioPushModell.Checked == true){
				base.NextWizardPanelID = "PushModel";
				reportStructure.DataModel = GlobalEnums.PushPullModel.PushData;
				GoOn();
			} else if (this.radioFormSheet.Checked == true){
				reportStructure.DataModel = GlobalEnums.PushPullModel.FormSheet;
				base.EnableNext = false;
				base.IsLastPanel = true;
			}
			
			reportStructure.Landscape = this.radioLandscape.Checked;
		}
Пример #21
0
		public GeneratePlainReport(ReportModel reportModel,ReportStructure reportStructure):base(reportModel,reportStructure)
		{}
Пример #22
0
		/// <summary>
		/// Default constructor - initializes all fields to default values
		/// </summary>
		public GeneratePushDataReport(ReportModel reportModel,ReportStructure reportStructure):base(reportModel,reportStructure){		                              		                      
			base.UpdateGenerator();
			base.UpdateModel();
		}
Пример #23
0
		public WizardDialog(string title, ReportStructure reportStructure, string treePath)
		{
			this.reportStructure = reportStructure;
			AddInTreeNode node = AddInTree.GetTreeNode(treePath);
			this.Text = title;
			
			if (node != null) {
				AddNodes(this.reportStructure, node.BuildChildItems<IDialogPanelDescriptor>(this));
			}
			InitializeComponents();
			
			enableNextChangedHandler        = new EventHandler(EnableNextChanged);
			nextWizardPanelIDChangedHandler = new EventHandler(NextWizardPanelIDChanged);
			enableCancelChangedHandler      = new EventHandler(EnableCancelChanged);
			finishPanelHandler              = new EventHandler(FinishPanelEvent);
			ActivatePanel(0);
		}
Пример #24
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			reportStructure = (ReportStructure)base.CustomizationObject;
			if (message == DialogMessage.Activated) 
			{
				ShowData();
				base.EnableNext = true;
				base.EnableFinish = true;
				
			} 
			else if (message == DialogMessage.Next)
			{
				base.EnableNext = true;
				base.EnableFinish = true;
				WriteResult();
			}
			else if (message == DialogMessage.Finish)
			{
				WriteResult();
				
				base.EnableNext = true;
				base.EnableFinish = true;
			}
			return true;
		}
Пример #25
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			if (customizer == null) {
				customizer = (Properties)base.CustomizationObject;
				reportStructure = (ReportStructure)customizer.Get("Generator");
			}
			if (message == DialogMessage.Activated) 
			{
				this.model = reportStructure.CreateAndFillReportModel();
				this.resultDataSet =  FillGrid();
				SetupGrid ();
				base.EnableNext = true;
				base.EnableFinish = true;
				
			} 
			else if (message == DialogMessage.Next)
			{
				base.EnableNext = true;
				base.EnableFinish = true;
				WriteResult();
			}
			else if (message == DialogMessage.Finish)
			{
				WriteResult();
				
				base.EnableNext = true;
				base.EnableFinish = true;
			}
			return true;
		}
Пример #26
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			if (customizer == null) {
				customizer = (Properties)base.CustomizationObject;
				reportStructure = (ReportStructure)customizer.Get("Generator");
			}
			
			if (message == DialogMessage.Activated) {
				base.EnableNext = true;
//				base.IsLastPanel = true;
				base.NextWizardPanelID = "Layout";
			}
			
			else if (message == DialogMessage.Finish) {
				if (this.resultDataSet != null) {
					// check reordering of columns
					DataGridViewColumn[] displayCols;
					DataGridViewColumnCollection dc = this.grdQuery.Columns;
					
					displayCols = new DataGridViewColumn[dc.Count];
					
					for (int i = 0; i < dc.Count; i++){
						if (dc[i].Visible) {
							displayCols[dc[i].DisplayIndex] = dc[i];
						}
					}

					reportStructure.ReportItemCollection.AddRange(CreateItemsCollection (displayCols));
					if (this.abstractColumns != null) {
						reportStructure.AvailableFieldsCollection.AddRange(abstractColumns);
					}
				}
				base.EnableNext = true;
				base.EnableFinish = true;
				base.IsLastPanel = true;
			}
			return true;
		}
Пример #27
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			if (customizer == null) {
				customizer = (Properties)base.CustomizationObject;
				reportStructure = (ReportStructure)customizer.Get("Generator");
			}
			if (message == DialogMessage.Activated) {
				this.model = reportStructure.CreateAndFillReportModel();
				this.resultDataSet =  FillGrid();
				
				if (this.resultDataSet != null) {
					this.grdQuery.DataSource = this.resultDataSet.Tables[0];
					foreach (DataGridViewColumn dd in this.grdQuery.Columns) {
						DataGridViewColumnHeaderCheckBoxCell cb = new DataGridViewColumnHeaderCheckBoxCell();
						cb.CheckBoxAlignment = HorizontalAlignment.Right;
						cb.Checked = true;
						dd.HeaderCell = cb;
						dd.SortMode = DataGridViewColumnSortMode.NotSortable;
					}
					this.grdQuery.AllowUserToOrderColumns = true;
				}
				base.EnableNext = true;
				base.EnableFinish = true;
			} else if (message == DialogMessage.Finish) {
				if (this.resultDataSet != null) {
					// check reordering of columns
					DataGridViewColumn[] displayCols;
					DataGridViewColumnCollection dc = this.grdQuery.Columns;
					displayCols = new DataGridViewColumn[dc.Count];
					for (int i = 0; i < dc.Count; i++){
						if (dc[i].Visible) {
							displayCols[dc[i].DisplayIndex] = dc[i];
						}
					}
					
					// only checked columns are used in the report
					ReportItemCollection sourceItems = WizardHelper.DataItemsFromDataSet(this.resultDataSet);
					AvailableFieldsCollection abstractColumns = WizardHelper.AbstractColumnsFromDataSet(this.resultDataSet);
					ReportItemCollection destItems = new ReportItemCollection();
					
					foreach (DataGridViewColumn cc in displayCols) {
						DataGridViewColumnHeaderCheckBoxCell hc= (DataGridViewColumnHeaderCheckBoxCell)cc.HeaderCell;
						if (hc.Checked) {
							BaseReportItem br = (BaseReportItem)sourceItems.Find(cc.HeaderText);
							destItems.Add(br);
						}
					}
					reportStructure.ReportItemCollection.AddRange(destItems);
					if ((this.sqlParamsCollection != null) && (this.sqlParamsCollection.Count > 0)) {
						reportStructure.SqlQueryParameters.AddRange(sqlParamsCollection);
					}
					
					if (abstractColumns != null) {
						reportStructure.AvailableFieldsCollection.AddRange(abstractColumns);
					}
				}
				base.EnableNext = true;
				base.EnableFinish = true;
			}
			return true;
		}
Пример #28
0
		public override bool ReceiveDialogMessage(DialogMessage message)
		{
			if (customizer == null) {
				customizer = (Properties)base.CustomizationObject;
				reportStructure = (ReportStructure)customizer.Get("Generator");
				base.NextWizardPanelID = "Layout";
			}
			
			else if (message == DialogMessage.Activated) {
				WriteResult();
				base.EnableNext = true;
			}
			
			else if (message == DialogMessage.Next)
			{
				WriteResult();
				base.EnableNext = true;
			}
			else if (message == DialogMessage.Finish) {
				WriteResult();
				base.EnableNext = true;
				base.EnableFinish = true;
			}
			return true;
		}
		public void Constructore()
		{
			ReportStructure rs = new ReportStructure();
			Assert.IsNotNull(rs,"ReportStructure should not be 'null'");
		}
Пример #30
0
		string CreateTableName(ReportStructure reportStructure)
		{
			ITable t = reportStructure.IDatabaseObjectBase as ITable;
			string str = String.Empty;
			
			if (t != null) {
				str = t.Name;
			}
			else
			{
				str = "Table1";
			}
			return str;
		}
Пример #31
0
 /// <summary>
 /// Default constructor - initializes all fields to default values
 /// </summary>
 public GeneratePushDataReport(ReportModel reportModel, ReportStructure reportStructure) : base(reportModel, reportStructure)
 {
     base.UpdateGenerator();
     base.UpdateModel();
 }