public override void Execute(object parameter)
        {
            if (parameter == null)
                throw new ArgumentNullException("parameter");
            FileTemplateResult result = (FileTemplateResult)parameter;
            var openedFile = result.NewOpenedFiles.Single();
            var wizardViewModel = new ReportWizardContext();
            var reportWizard = new ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard(wizardViewModel);

            reportWizard.ShowDialog();
            if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value){
                   	LoggingService.Info("ReportWizard - CreateReport");
                var rg = new ReportGenerator();

                rg.Generate(wizardViewModel);
                string xml = CreateFormSheetFromModel.ToXml(rg.ReportModel).ToString();
                openedFile.SetData(Encoding.UTF8.GetBytes(xml));
                if (!openedFile.IsUntitled)
                    openedFile.SaveToDisk();
            } else {
                LoggingService.Info("ReportWizard canceled");
                // HACK: cancel opening the file by clearing the file list
                openedFile.CloseIfAllViewsClosed();
                result.NewOpenedFiles.Clear();
                result.NewFiles.Clear();
            }
        }
示例#2
0
		public ReportGenerator(ReportWizardContext context)
		{
			if (context == null)
				throw new ArgumentNullException("context");
			this.context = context;
			ReportModel = ReportModelFactory.Create();
		}
示例#3
0
		public ReportWizard(ReportWizardContext context)
		{
			InitializeComponent();
			this.context = context;
			baseSettingsPage = new BaseSettingsPage();
			_wizard.Items.Insert(1,baseSettingsPage);
		}
示例#4
0
		void CreateDataReport(ReportWizardContext context)
		{
			GenerateBaseSettings(context);
			CreateReportHeader(context);
			CreatePageHeader(context);
			CreateDetailsSection(context);
			CreatePageFooter (context);
		}
示例#5
0
		void GenerateBaseSettings (ReportWizardContext context)	{
			var pageOneContext = (PageOneContext)context.PageOneContext;
			var reportSettings = ReportModel.ReportSettings;
			reportSettings.DataModel = pageOneContext.DataModel;
			reportSettings.FileName = pageOneContext.FileName;
			reportSettings.Landscape = !pageOneContext.Legal;
			reportSettings.ReportName = pageOneContext.ReportName;
			reportSettings.ReportType = pageOneContext.ReportType;
		}
示例#6
0
		public void  Generate(ReportWizardContext context) {
			if (context == null)
				throw new ArgumentNullException("context");
			
			
			if (IsDataReport(context)) {
				CreateDataReport (context);
			} else {
				CreateFormSheetReport(context);
			}
		}
示例#7
0
		void CreateDetailsSection(ReportWizardContext context){
			var pushModelContext = (PushModelContext)context.PushModelContext;
			foreach (var element in pushModelContext.Items) {
				var dataItem = new BaseDataItem(){
					Name = element.ColumnName,
					Text = element.ColumnName,
					ColumnName = element.ColumnName,
					DataType = element.DataTypeName
				};
				ReportModel.DetailSection.Items.Add(dataItem);
			}
			AdjustItems(ReportModel.DetailSection.Items,startLocation);
		}
		public override void Run()
		{
			var wizardViewModel = new ReportWizardContext();
			var reportWizard = new ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard(wizardViewModel);
			
			reportWizard.ShowDialog();
			if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value){
				   	LoggingService.Info("ReportWizard - CreateReport");   
				var rg = new ReportGenerator();
				
				rg.Generate(wizardViewModel);
				ReportModel = rg.ReportModel;
				} else {
				Canceled = true;
			}
		}
示例#9
0
		void CreateReportHeader(ReportWizardContext context){
			var pageOneContext = (PageOneContext)context.PageOneContext;
			
			var headerText = new BaseTextItem();
			
			headerText.Text = String.IsNullOrEmpty(pageOneContext.ReportName) ? GlobalValues.DefaultReportName : pageOneContext.ReportName;
			
			var xLoc = (ReportModel.ReportSettings.PrintableWidth() - headerText.Size.Width) / 2;
			headerText.Location = new Point(xLoc,4);
			ReportModel.ReportHeader.Items.Add(headerText);
			
			xLoc = ReportModel.ReportSettings.PrintableWidth() - GlobalValues.PreferedSize.Width - 20;
		
			var dateText = new BaseTextItem(){
				Text ="= Today.Today",
				Location = new Point(xLoc ,10)
			};
			
			ReportModel.ReportHeader.Items.Add(dateText);
		}
示例#10
0
 void CreateDetailsWithRow(ReportWizardContext context)
 {
     var pushModelContext = (PushModelContext)context.PushModelContext;
     var row = new BaseRowItem(){
         Location = new Point(5,5),
         Size = new Size(ReportModel.ReportSettings.PrintableWidth() - 10,GlobalValues.PreferedSize.Height * 2)
     };
     var list = CreateItems(pushModelContext);
     row.Items.AddRange(list);
     ReportModel.DetailSection.Items.Add(row);
 }
示例#11
0
 void CreateDataReport(ReportWizardContext context)
 {
     ReportModel.ReportSettings = GenerateBaseSettings(context);
     CreateReportHeader(context);
     CreatePageHeader(context);
     //CreateDetailsSection(context);
     CreateDetailsWithRow(context);
     CreatePageFooter ();
 }
示例#12
0
		static bool IsDataReport(ReportWizardContext context)
		{
			var poc = (PageOneContext)context.PageOneContext;
			return poc.ReportType.Equals(ReportType.DataReport);
		}
示例#13
0
// 
		void CreatePageFooter(ReportWizardContext context)
		{
			var pageOneContext = (PageOneContext)context.PageOneContext;
			var lineNrField = new BaseTextItem() {
				Text = "='Page : ' + Globals!PageNumber + ' of ' + Globals!Pages + ' Page(s)'",
				Name = "LineNumber",
				Location = new Point(300,10),
				Size = new Size (GlobalValues.PreferedSize.Width * 2,GlobalValues.PreferedSize.Height)
			};
			ReportModel.PageFooter.Items.Add(lineNrField);
		}
示例#14
0
		void CreatePageHeader(ReportWizardContext context)
		{
			var pushModelContext = (PushModelContext)context.PushModelContext;
			foreach (var element in pushModelContext.Items) {
				var dataItem = new BaseTextItem(){
					Name = element.ColumnName,
					Text = element.ColumnName
				};
				ReportModel.PageHeader.Items.Add(dataItem);
			}
			
			AdjustItems(ReportModel.PageHeader.Items,startLocation);
			
			var line = new BaseLineItem(){
				Location = new Point(2,35),
				FromPoint = new Point(1,1),
				ToPoint = new Point(ReportModel.ReportSettings.PrintableWidth() -10,1),
				Size = new Size (ReportModel.ReportSettings.PrintableWidth() -5,5)
			};
			
			ReportModel.PageHeader.Items.Add(line);
			
		}
示例#15
0
 static bool IsDataReport(ReportWizardContext context)
 {
     var poc = (PageOneContext)context.PageOneContext;
     //			return poc.ReportType.Equals(ReportType.DataReport);
     return poc.DataModel != PushPullModel.FormSheet;
 }
示例#16
0
        void CreateReportHeader(ReportWizardContext context)
        {
            var pageOneContext = (PageOneContext)context.PageOneContext;

            var centerLocation = DesignerHelper.AlignCenter(ReportModel.ReportSettings.PrintableWidth(),GlobalValues.PreferedSize.Width);
            var headerText = new BaseTextItem(){
                Text = String.IsNullOrEmpty(pageOneContext.ReportName) ? GlobalValues.DefaultReportName : pageOneContext.ReportName,
                Location = new Point(centerLocation,10)
            };

            ReportModel.ReportHeader.Items.Add(headerText);

            var xLoc = DesignerHelper.AlignRight( ReportModel.ReportSettings.PrintableWidth(),GlobalValues.PreferedSize.Width) - 5;
            var dateText = new BaseTextItem(){
                Text ="= Today.Today",
                Location = new Point(xLoc ,10)
            };

            ReportModel.ReportHeader.Items.Add(dateText);
        }
 public ReportWizard(ReportWizardContext context)
 {
     InitializeComponent();
     this.context = context;
 }
示例#18
0
		void CreateFormSheetReport(ReportWizardContext context)
		{
			GenerateBaseSettings(context);
			CreateReportHeader(context);
		}
示例#19
0
 void CreateDetailsSection(ReportWizardContext context)
 {
     var pushModelContext = (PushModelContext)context.PushModelContext;
     var list = CreateItems(pushModelContext);
     ReportModel.DetailSection.Items.AddRange(list);
 }