public static void RemoveItem(IReportItem pItem) { if (Items.Contains(pItem)) { Items.Remove(pItem); } }
public CalendarContentRange(IReportItem owner, MonthInfo MonthFrom, MonthInfo MonthTo) : this(new StaticRange(0, -1, 0, -1)) { _owner = owner; _monthFrom = MonthFrom; _monthTo = MonthTo; }
public static Size MeasureReportItem(Graphics graphics, IReportItem item) { BaseTextItem textItem = item as BaseTextItem; if (textItem != null) { string str = String.Empty; BaseDataItem dataItem = item as BaseDataItem; if (dataItem != null) { str = dataItem.DBValue; } else { BaseTextItem it = item as BaseTextItem; if (it != null) { str = it.Text; } } SizeF sf = graphics.MeasureString(str.TrimEnd(), textItem.Font, textItem.Size.Width); return(sf.ToSize()); } return(item.Size); }
public CalendarContentRange(StaticRange staticRange, IReportItem owner, MonthInfo MonthFrom, MonthInfo MonthTo) : this(staticRange) { _owner = owner; _monthFrom = MonthFrom; _monthTo = MonthTo; }
protected void RunTask(IReportItem reportItem) { if (this.TaskRunning != null) { this.TaskRunning(this, new EventArgs()); } IError error = null; ReportTask task = null; try { task = reportItem as ReportTask; ExportEngine engine = new ExportEngine(QlikViewConnectorProxy.Instance); engine.Logger = new QVConfigLog(); error = engine.RunTask(task, ReportConfig.SmtpServerManager.SmtpServer); } catch (Exception ex) { if (error == null) { error = new QvError(); } error.ErrorMessage.Append(ex.StackTrace); error.HasError = true; } this.DeleteAllExportedFiles(task); if (this.TaskRunCompleted != null) { this.TaskRunCompleted(error); } }
internal void Add(IReportItem item) { if (item == null) { throw new ArgumentNullException("item"); } if (item is CreditCardTransaction) { this.CreditCardTransactionCollection.Add(item as CreditCardTransaction); } else if (item is BoletoTransaction) { this.BoletoTransactionCollection.Add(item as BoletoTransaction); } else if (item is OnlineDebitTransaction) { this.OnlineDebitTransactionCollection.Add(item as OnlineDebitTransaction); } else if (item is Header) { this.Header = item as Header; } else if (item is Trailer) { this.Trailer = item as Trailer; } else { throw new InvalidDataException("Unrecognized data type: " + item.GetType().Name); } }
public static void AddItem(IReportItem pItem) { if (!Items.Contains(pItem)) { Items.Add(pItem); } }
public override void Fill(IReportItem item) { base.Fill(item); if (current != null) { BaseDataItem baseDataItem = item as BaseDataItem; if (baseDataItem != null) { PropertyDescriptor p = this.listProperties.Find(baseDataItem.ColumnName, true); if (p != null) { baseDataItem.DBValue = p.GetValue(this.Current).ToString(); } else { baseDataItem.DBValue = string.Format("<{0}> missing!", baseDataItem.ColumnName); } return; } //image processing from IList BaseImageItem baseImageItem = item as BaseImageItem; if (baseImageItem != null) { PropertyDescriptor p = this.listProperties.Find(baseImageItem.ColumnName, true); if (p != null) { baseImageItem.Image = p.GetValue(this.Current) as System.Drawing.Image; } return; } } }
public static Size MeasureReportItem(Graphics graphics,IReportItem item) { BaseTextItem textItem = item as BaseTextItem; if (textItem != null) { string str = String.Empty; BaseDataItem dataItem = item as BaseDataItem; if (dataItem != null) { str = dataItem.DBValue; } else { BaseTextItem it = item as BaseTextItem; if (it != null) { str = it.Text; } } SizeF sf = graphics.MeasureString(str.TrimEnd(), textItem.Font, textItem.Size.Width); return sf.ToSize(); } return item.Size; }
public override void AddItem(IReportItem item) { if (this.ItemCollection.ContainsKey(item.Name)) { throw new Exception("Contains the same name Item."); } ReportTask temp = (ReportTask)item; temp.Include = "Tasks/" + temp.Name + ".xml"; this.ItemCollection.Add(temp.Name, temp); string folder = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Remove(System.Reflection.Assembly.GetExecutingAssembly().CodeBase.LastIndexOf("/")); var file = folder.Replace("file:///", "") + "/" + temp.Include; if (!File.Exists(file)) { //var stream = File.Create(file); //stream.Close(); string xml = @"<ReportConfig><Tasks></Tasks><Reports></Reports><Filters></Filters></ReportConfig>"; var doc = new XmlDocument(); doc.LoadXml(xml); doc.Save(file); } ReportConfig.ConfigLocations.Add(temp.Name, file); this.Save(); }
protected static SizeF MeasureReportItem(IReportItem item) { if (item == null) { throw new ArgumentNullException("item"); } return(new SizeF(item.Size.Width, item.Size.Height)); }
void ILayoutManager.Initialize(IReportItem forReportItem, ITargetDevice targetDevice) { _calendar = forReportItem as CalendarDataRegion; if (_calendar == null) { throw new ArgumentException("The argument has wrong type.", "forReportItem"); } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context == null) || (provider == null)) { return(base.EditValue(context, provider, value)); } // Access the Property Browser's UI display service IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService == null) { return(base.EditValue(context, provider, value)); } // Create an instance of the UI editor form IReportItem iri = context.Instance as IReportItem; if (iri == null) { return(base.EditValue(context, provider, value)); } PropertyReportItem pre = iri.GetPRI(); string[] names; PropertyBackground pb = value as PropertyBackground; if (pb != null) { names = pb.Names; } else { PropertyBackgroundImage pbi = value as PropertyBackgroundImage; if (pbi == null) { return(base.EditValue(context, provider, value)); } names = pbi.Names; } using (SingleCtlDialog scd = new SingleCtlDialog(pre.DesignCtl, pre.Draw, pre.Nodes, SingleCtlTypeEnum.BackgroundCtl, names)) { // Display the UI editor dialog if (editorService.ShowDialog(scd) == DialogResult.OK) { // Return the new property value from the UI editor form return(new PropertyBackground(pre)); } return(base.EditValue(context, provider, value)); } }
public void Initialize(IReportItem forReportItem, ITargetDevice targetDevice) { _item = forReportItem; _control = _item as RtfControl; _computedSize = new SizeF(_item.Width.ToTwips(), _item.Height.ToTwips()); ProcessGrow(); ProcessShrink(); }
private void QvItemAdd(IReportItem qvItem) { bool ok = this.OnQvItemAdd(qvItem); if (ok && this.QvItemAdded != null) { this.QvItemAdded(qvItem); } }
private void AppendTestSuiteHeader(IReportItem reportItem, int level) { var par = _document .InsertParagraph("Test suite ") .AppendHyperlink(CreateHyperLink(reportItem.ID.ToString(), reportItem.URI)) .Append($": {reportItem.Caption}") .KeepWithNextParagraph(); par.StyleName = GetTestSuiteHeaderStyle(level); }
private void AppendTestCaseHeader(IReportItem reportItem) { var par = _document .InsertParagraph("Test case ") .AppendHyperlink(CreateHyperLink(reportItem.ID.ToString(), reportItem.URI)) .Append($": {reportItem.Caption}") .KeepWithNextParagraph(); par.StyleName = StyleNames.TEST_CASE_HEADER; }
public virtual void AddItem(IReportItem item) { if (this.ItemCollection.ContainsKey(item.Name)) { throw new Exception("Contains the same name Item."); } T temp = (T)item; this.ItemCollection.Add(temp.Name, temp); this.Save(); }
void _viewModel_QvItemAdded(IReportItem obj) { IView view = this.ViewContainer.Content as IView; view.ViewModel.QvItemAdded -= new Action <IReportItem>(_viewModel_QvItemAdded); this.ViewContainer.Content = null; System.Windows.Controls.ListBox listBox = this.bar.SelectedSection.Content as System.Windows.Controls.ListBox; string prefix = listBox.Tag.ToString(); switch (prefix) { case "Task": { this._viewModel.Tasks.Add(obj); break; } case "Report": { this._viewModel.Reports.Add(obj); break; } case "Filter": { this._viewModel.Filters.Add(obj); break; } case "Group": { this._viewModel.Groups.Add(obj); break; } case "Recipient": { this._viewModel.Recipients.Add(obj); break; } case "Connection": { this._viewModel.Connections.Add(obj); break; } default: break; } listBox.SelectedItem = obj; }
public void MeasurePageFooter(IReportItem section) { if (section == null) { throw new ArgumentNullException("section"); } this.pageFooterRectangle = new Rectangle(this.printableArea.Location.X, this.marginBounds.Bottom - section.Size.Height, this.marginBounds.Width, section.Size.Height); }
public override void Build(IReportItem reportItem, int level, CancellationToken cancellationToken, IProgress <string> progress) { //TODO remove and create separate builder if necessary if (reportItem is TestPlan) { return; } AppendTestSuiteHeader(reportItem, level); AppendTestCasesCountSection(reportItem); }
//Test public void MeasureReportFooter(IReportItem section) { if (section == null) { throw new ArgumentNullException("section"); } this.reportFooterRectangle = new Rectangle(this.printableArea.Left, this.PageFooterRectangle.Top - section.Size.Height - GlobalValues.GapBetweenContainer, this.marginBounds.Width, section.Size.Height); section.SectionOffset = this.reportFooterRectangle.Top; }
public void MeasurePageHeader(IReportItem section) { if (section == null) { throw new ArgumentNullException("section"); } section.SectionOffset = this.reportHeaderRectangle.Bottom + +3 * GlobalValues.GapBetweenContainer; this.pageHeaderRectangle = new Rectangle(this.reportHeaderRectangle.Left, section.SectionOffset, this.marginBounds.Width, section.Size.Height + 3 * GlobalValues.GapBetweenContainer); }
public void MeasurePageHeader(IReportItem section) { if (section == null) { throw new ArgumentNullException("section"); } section.SectionOffset = this.reportHeaderRectangle.Bottom + this.gap; this.pageHeaderRectangle = new Rectangle(this.reportHeaderRectangle.Left, section.SectionOffset, this.marginBounds.Width, section.Size.Height + this.gap); }
private void AppendTestCasesCountSection(IReportItem reportItem) { var testCases = reportItem.Children.OfType <TestCase>().ToList(); if (testCases.Count == 0) { return; } AppendHorizontalLine(); AppendTestCasesCount(testCases.Count); AppendHorizontalLine(); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context == null) || (provider == null)) { return(base.EditValue(context, provider, value)); } // Access the Property Browser's UI display service IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService == null) { return(base.EditValue(context, provider, value)); } // Create an instance of the UI editor form IReportItem iri = context.Instance as IReportItem; if (iri == null) { return(base.EditValue(context, provider, value)); } PropertyReportItem pre = iri.GetPRI(); PropertyAction pa = value as PropertyAction; if (pa == null) { return(base.EditValue(context, provider, value)); } SingleCtlDialog scd = new SingleCtlDialog(pre.DesignCtl, pre.Draw, pre.Nodes, SingleCtlTypeEnum.InteractivityCtl, null); try { // Display the UI editor dialog if (editorService.ShowDialog(scd) == DialogResult.OK) { // Return the new property value from the UI editor form return(new PropertyAction(pre)); } } finally { scd.Dispose(); } return(base.EditValue(context, provider, value)); }
public override void Build(IReportItem reportItem, int level, CancellationToken cancellationToken, IProgress <string> progress) { if (!(reportItem is TestCase testCase)) { //ex return; } AppendTestCaseHeader(testCase); AppendSummaryHeader(); AppendExpectedResult(testCase); AppendLatestTestOutcomeHeader(); AppendLatestTestOutcomeOverview(testCase); }
public BlockBuilder GetBlockBuilder(Document document, IReportItem reportItem) { if (reportItem is TestCase) { return(GetTestCaseBlockBuilder(document)); } if (reportItem is TestSuite || reportItem is TestPlan) { return(GetTestSuiteBlockBuilder(document)); } throw new Exception("Unknown type of IReportItem"); }
//Test public void MeasureReportFooter(IReportItem section) { if (section == null) { throw new ArgumentNullException("section"); } // The reportFooter is set On Top of PageFooter this.reportFooterRectangle = new Rectangle(this.printableArea.Left, this.PageFooterRectangle.Top - section.Size.Height - this.gap, this.marginBounds.Width, section.Size.Height); section.SectionOffset = this.reportFooterRectangle.Top; }
public static IEnumerable <IReportItem> Flatten(this IReportItem reportItem) { var stack = new Stack <IReportItem>(); stack.Push(reportItem); while (stack.Count > 0) { var current = stack.Pop(); yield return(current); foreach (var child in current.Children) { stack.Push(child); } } }
/// <summary> /// Parses the stream into a TransactionReport object. /// </summary> /// <param name="stream"></param> /// <returns></returns> public TransactionReport ParseStream(Stream stream) { TransactionReport report = new TransactionReport(); int lineCount = 0; using (StreamReader reader = new StreamReader(stream)) { while (reader.EndOfStream == false) { lineCount++; // Reads the line. string line = reader.ReadLine(); if (string.IsNullOrWhiteSpace(line)) { continue; } // Splits the line contents. string[] lineItems = line.Split(new char[] { ',' }, StringSplitOptions.None); // Obtains a parser for the line. IReportItemParser objectParser = ParserFactory.GetParser(lineItems[0]); if (objectParser == null) { throw new InvalidDataException("The selected file has an invalid format or is currupted. Line " + lineCount.ToString()); } IReportItem reportItem = null; try { // Parses the report item. reportItem = objectParser.Parse(lineItems); } catch (Exception ex) { throw new InvalidDataException("The selected file has an invalid format or is currupted. Line " + lineCount.ToString(), ex); } // Adds the parsed item to the report. report.Add(reportItem); } } return(report); }
protected override bool OnQvItemAdd(IReportItem qvItem) { try { QlikViewReport report = qvItem as QlikViewReport; if (string.IsNullOrWhiteSpace(report.Name) || string.IsNullOrWhiteSpace(report.OutputFielName) || report.Connection == null) { MessageBox.Show("Name, OutputFielName and connection are required."); return false; } ReportConfig.QvReportManager.AddItem(qvItem); } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } return true; }
protected override bool OnQvItemAdd(IReportItem qvItem) { try { RecipientGroup group = qvItem as RecipientGroup; if (string.IsNullOrWhiteSpace(group.Name) || group.RecipientList.Count == 0) { MessageBox.Show("Name and recipients are required."); return false; } ReportConfig.RecipientGroupManager.AddItem(qvItem); } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } return true; }
protected override bool OnQvItemAdd(IReportItem qvItem) { //Do nothing return true; }
protected void ReportItemDelete(IReportItem reportItem) { if (MessageBox.Show("Do you want to delete the item " + reportItem.Name, "Delete", MessageBoxButton.YesNo) == MessageBoxResult.No) return; IError error = null; switch (this.CurrentReportItemType) { case "Task": { error = ReportConfig.ReportTaskManager.RemoveItem(reportItem.Name); if (error.HasError == false) this.Tasks.Remove(reportItem); break; } case "Report": { error = ReportConfig.QvReportManager.RemoveItem(reportItem.Name); if (error.HasError == false) this.Reports.Remove(reportItem); break; } case "Filter": { error = ReportConfig.FilterManager.RemoveItem(reportItem.Name); if (error.HasError == false) this.Filters.Remove(reportItem); break; } case "Group": { error = ReportConfig.RecipientGroupManager.RemoveItem(reportItem.Name); if (error.HasError == false) this.Groups.Remove(reportItem); break; } case "Recipient": { error = ReportConfig.RecipientManager.RemoveItem(reportItem.Name); if (error.HasError == false) this.Recipients.Remove(reportItem); break; } case "Connection": { error = ReportConfig.ConnectionManager.RemoveItem(reportItem.Name); if (error.HasError == false) this.Connections.Remove(reportItem); break; } default: break; } if (error != null) { if (error.HasError) MessageBox.Show(error.ErrorMessage.ToString()); else { if (this.ReportItemDeleted != null) this.ReportItemDeleted(this, new EventArgs()); } } }
public void MeasurePageHeader (IReportItem section) { if (section == null) { throw new ArgumentNullException("section"); } section.SectionOffset = this.reportHeaderRectangle.Bottom + + 3 * GlobalValues.GapBetweenContainer; this.pageHeaderRectangle = new Rectangle (this.reportHeaderRectangle.Left, section.SectionOffset, this.marginBounds.Width, section.Size.Height + 3 * GlobalValues.GapBetweenContainer); }
//Test public void MeasureReportFooter (IReportItem section) { if (section == null) { throw new ArgumentNullException("section"); } // The reportFooter is set On Top of PageFooter this.reportFooterRectangle = new Rectangle (this.printableArea.Left, this.PageFooterRectangle.Top - section.Size.Height - 3 * GlobalValues.GapBetweenContainer, this.marginBounds.Width, section.Size.Height); section.SectionOffset = this.reportFooterRectangle.Top; }
protected abstract bool OnQvItemAdd(IReportItem qvItem);
public void MeasurePageHeader (IReportItem section) { if (section == null) { throw new ArgumentNullException("section"); } section.SectionOffset = this.reportHeaderRectangle.Bottom + this.gap; this.pageHeaderRectangle = new Rectangle (this.reportHeaderRectangle.Left, section.SectionOffset, this.marginBounds.Width, section.Size.Height + this.gap); }
protected override bool OnQvItemAdd(IReportItem qvItem) { try { Filter filter = qvItem as Filter; if (string.IsNullOrWhiteSpace(filter.Name) || filter.Connection == null) { MessageBox.Show("Name and connection are required."); return false; } ReportConfig.FilterManager.AddItem(qvItem); } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } return true; }
protected override bool OnQvItemAdd(IReportItem qvItem) { try { ReportTask task = qvItem as ReportTask; if (string.IsNullOrWhiteSpace(task.Name) || string.IsNullOrWhiteSpace(task.OutputFolder)) { MessageBox.Show("The name and output folder are required."); return false; } ReportConfig.ReportTaskManager.AddItem(qvItem); } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } return true; }
public virtual void Fill(IReportItem item) { }
void _viewModel_QvItemAdded(IReportItem obj) { IView view = this.ViewContainer.Content as IView; view.ViewModel.QvItemAdded -= new Action<IReportItem>(_viewModel_QvItemAdded); this.ViewContainer.Content = null; System.Windows.Controls.ListBox listBox = this.bar.SelectedSection.Content as System.Windows.Controls.ListBox; string prefix = listBox.Tag.ToString(); switch (prefix) { case "Task": { this._viewModel.Tasks.Add(obj); break; } case "Report": { this._viewModel.Reports.Add(obj); break; } case "Filter": { this._viewModel.Filters.Add(obj); break; } case "Group": { this._viewModel.Groups.Add(obj); break; } case "Recipient": { this._viewModel.Recipients.Add(obj); break; } case "Connection": { this._viewModel.Connections.Add(obj); break; } default: break; } listBox.SelectedItem = obj; }
protected void ExportReport(IReportItem reportItem) { if (this.ExportReportRunning != null) { this.ExportReportRunning(this, new EventArgs()); } IError error = new QvError(); QlikViewReport report = null; try { report = reportItem as QlikViewReport; ExportEngine engine = new ExportEngine(QlikViewConnectorProxy.Instance); engine.Logger = new QVConfigLog(); bool succeed = engine.RunReport(report, ReportConfig.SmtpServerManager.SmtpServer); if (succeed) { error.HasError = false; } else { error.ErrorMessage.Append(string.Format("Export Report {0} failed.",report.Name)); error.HasError = true; } } catch (Exception ex) { if (error == null) error = new QvError(); error.ErrorMessage.Append(ex.StackTrace); error.HasError = true; } if (this.ExportReportCompleted != null) this.ExportReportCompleted(error); }
protected static SizeF MeasureReportItem (IReportItem item) { if (item == null) { throw new ArgumentNullException("item"); } return new SizeF (item.Size.Width,item.Size.Height); }
protected void RunTask(IReportItem reportItem) { if (this.TaskRunning != null) { this.TaskRunning(this, new EventArgs()); } IError error = null; ReportTask task = null; try { task = reportItem as ReportTask; ExportEngine engine = new ExportEngine(QlikViewConnectorProxy.Instance); engine.Logger = new QVConfigLog(); error = engine.RunTask(task, ReportConfig.SmtpServerManager.SmtpServer); } catch (Exception ex) { if (error == null) error = new QvError(); error.ErrorMessage.Append(ex.StackTrace); error.HasError = true; } this.DeleteAllExportedFiles(task); if (this.TaskRunCompleted != null) this.TaskRunCompleted(error); }
//Test public void MeasurePageFooter (IReportItem section) { if (section == null) { throw new ArgumentNullException("section"); } this.pageFooterRectangle = new Rectangle(this.printableArea.Location.X, this.marginBounds.Bottom - section.Size.Height, this.marginBounds.Width, section.Size.Height); }
private void QvItemAdd(IReportItem qvItem) { bool ok = this.OnQvItemAdd(qvItem); if (ok && this.QvItemAdded != null) this.QvItemAdded(qvItem); }