private void EvaluateTagValue() { if (m_tag.HasValue) { return; } ExpressionInfo expression = m_tagDef.Expression; if (expression != null) { if (expression.IsExpression) { Image image = m_tagDef.Image; m_tag = image.ImageDef.EvaluateTagExpression(expression, image.Instance.ReportScopeInstance, image.RenderingContext.OdpContext); } else { VariantResult result = new VariantResult(errorOccurred: false, expression.Value); ReportRuntime.SetVariantType(ref result); m_tag = result; } } else { m_tag = new VariantResult(errorOccurred: false, null); } }
private static void SetupReportParamter(ReportRuntime runtime, string aUId, string productReferenceId, string PdmRequestRegisterID) { DDSetup.SetupDDReportRuntimeParameter(runtime, aUId); if (runtime.Parameters[DDSetup.ReportParameterProductReferenceID] != null) { runtime.Parameters[DDSetup.ReportParameterProductReferenceID].CurrentValue = productReferenceId; } if (runtime.Parameters[DDSetup.ReportParameterApplicationServerUrl] != null) { runtime.Parameters[DDSetup.ReportParameterApplicationServerUrl].CurrentValue = DDSetup.ReorptSetup.PLMApplictionURL; } if (!string.IsNullOrEmpty(PdmRequestRegisterID)) { // need format like this '1,2,3,4,6' string requestContent = DDSetup.GetPdmRequestContent(PdmRequestRegisterID); if (runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs] != null) { runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].CurrentValue = requestContent; // runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].Hidden } else// try to set ReportParameterProductReferenceID { runtime.Parameters[DDSetup.ReportParameterProductReferenceID].CurrentValue = requestContent; } } }
public void Close(bool isOK) { if (_Tag != null) { if (_Tag is ReportRuntime) { ReportRuntime reportRuntime = _Tag as ReportRuntime; reportRuntime.StopAnalyseReportThread(); } else if (_Tag is ReportDrawing) { ReportDrawing reportDrawing = _Tag as ReportDrawing; reportDrawing.StopExportReportThread(); } } try { timer1.Enabled = false; if (isOK) { this.DialogResult = DialogResult.OK; } else { this.DialogResult = DialogResult.Cancel; } } catch (System.Exception ex) { } }
public static Stream GetDataDynamicPdfStream(string rdlxFileName, int?aUId, string productReferenceId, string PdmRequestRegisterID, string dataSourceType, string mainReferenceID, string masterReferenceID) { string fullpath = DDSetup.ReorptSetup.ReportRootPath + @"\" + rdlxFileName; try { PdfRenderingExtension device = new PdfRenderingExtension(); ReportDefinition def = new ReportDefinition(new FileInfo(fullpath)); ChangDataSourceInRentime(def, dataSourceType); using (ReportRuntime runtime = new ReportRuntime(def)) { SetupReportParamter(runtime, aUId, productReferenceId, PdmRequestRegisterID, mainReferenceID, masterReferenceID); // FileStreamProvider aFileStreamProvider= new FileStreamProvider(new DirectoryInfo(@".\"), exportFieName); DataDynamics.Reports.Rendering.IO.MemoryStreamProvider memoryStreamProvider = new MemoryStreamProvider(); runtime.Render(device, memoryStreamProvider); var pInfo = memoryStreamProvider.GetPrimaryStream(); return(pInfo.OpenStream()); } // ReportRuntime runtime = new ReportRuntime(rdl); } catch (Exception ex) { string exStrt = ex.ToString(); return(null); } }
public void InitialReport() { Release(); _ReportRuntime = new ReportRuntime(); _MainReportDrawingIsFocus = true; }
private void EvaluateTagValue() { if (!this.m_tag.HasValue) { ExpressionInfo expression = this.m_tagDef.Expression; if (expression != null) { if (expression.IsExpression) { Image image = this.m_tagDef.Image; this.m_tag = image.ImageDef.EvaluateTagExpression(expression, image.Instance.ReportScopeInstance, image.RenderingContext.OdpContext); } else { VariantResult value = new VariantResult(false, expression.Value); ReportRuntime.SetVariantType(ref value); this.m_tag = value; } } else { this.m_tag = new VariantResult(false, null); } } }
internal void ProcessUserSortForTarget(ObjectModelImpl reportObjectModel, ReportRuntime reportRuntime, ReportProcessing.IHierarchyObj target, ref ReportProcessing.DataRowList dataRows, bool targetForNonDetailSort) { if (targetForNonDetailSort && dataRows != null && 0 < dataRows.Count) { RuntimeSortFilterEventInfo runtimeSortFilterEventInfo = null; IntList sortFilterInfoIndices = target.SortFilterInfoIndices; Global.Tracer.Assert(target.SortTree != null, "(null != target.SortTree)"); if (sortFilterInfoIndices != null) { runtimeSortFilterEventInfo = m_runtimeSortFilterInfo[sortFilterInfoIndices[0]]; } for (int i = 0; i < dataRows.Count; i++) { reportObjectModel.FieldsImpl.SetFields(dataRows[i]); object keyValue = DBNull.Value; if (runtimeSortFilterEventInfo != null) { keyValue = runtimeSortFilterEventInfo.GetSortOrder(reportRuntime); } target.SortTree.NextRow(keyValue); } dataRows = null; } target.MarkSortInfoProcessed(m_runtimeSortFilterInfo); }
private void EvaluateOriginalValue() { if (m_originalValueEvaluated) { return; } m_originalValueEvaluated = true; Microsoft.ReportingServices.ReportIntermediateFormat.TextRun textRunDef = TextRunDef; ExpressionInfo value = textRunDef.Value; if (value != null) { if (value.IsExpression) { m_originalValue = textRunDef.EvaluateValue(ReportScopeInstance, base.ReportElementDef.RenderingContext.OdpContext); m_originalValueNeedsReset = true; } else { m_originalValue = default(VariantResult); m_originalValue.Value = value.Value; ReportRuntime.SetVariantType(ref m_originalValue); } } }
public ReportItemImpl(AspNetCore.ReportingServices.ReportProcessing.ReportItem itemDef, ReportRuntime reportRT, IErrorContext iErrorContext) { Global.Tracer.Assert(null != itemDef, "(null != itemDef)"); Global.Tracer.Assert(null != reportRT, "(null != reportRT)"); Global.Tracer.Assert(null != iErrorContext, "(null != iErrorContext)"); this.m_item = itemDef; this.m_reportRT = reportRT; this.m_iErrorContext = iErrorContext; }
internal ReportItemImpl(Microsoft.ReportingServices.ReportProcessing.ReportItem itemDef, ReportRuntime reportRT, IErrorContext iErrorContext) { Global.Tracer.Assert(itemDef != null, "(null != itemDef)"); Global.Tracer.Assert(reportRT != null, "(null != reportRT)"); Global.Tracer.Assert(iErrorContext != null, "(null != iErrorContext)"); m_item = itemDef; m_reportRT = reportRT; m_iErrorContext = iErrorContext; }
public static void SetupDDReportRuntimeParameter(ReportRuntime ddRuntime, int?aUId) { if (aUId != null) { if (ddRuntime.Parameters[DDSetup.ReportParameterUid] != null) { ddRuntime.Parameters[DDSetup.ReportParameterUid].CurrentValue = aUId; } //string userName; //int? v2kuid; //EmDomainType aDomainType = DDSetup.GetDomainTypeAndV2kUID(aUId, out v2kuid, out userName); string userName = string.Empty; string timeZoneInfoToken = string.Empty; int? v2kuid; EmDomainType aDomainType = DDSetup.GetDomainTypeAndV2kUID(aUId, out v2kuid, out userName, out timeZoneInfoToken); if (ddRuntime.Parameters[DDSetup.ReportParameterCurrentUserName] != null) { ddRuntime.Parameters[DDSetup.ReportParameterCurrentUserName].CurrentValue = userName; } if (ddRuntime.Parameters[DDSetup.ReportParameterClientTimeZonekey] != null) { ddRuntime.Parameters[DDSetup.ReportParameterClientTimeZonekey].CurrentValue = timeZoneInfoToken;; } if (v2kuid.HasValue) { if (ddRuntime.Parameters[DDSetup.ReportParameterCurrentUserName] != null) { ddRuntime.Parameters[DDSetup.ReportParameterCurrentUserName].CurrentValue = userName; } if (aDomainType == EmDomainType.Vendor) { if (ddRuntime.Parameters[DDSetup.ReportParameterVendorID] != null) { ddRuntime.Parameters[DDSetup.ReportParameterVendorID].CurrentValue = v2kuid.Value.ToString(); } } else if (aDomainType == EmDomainType.Customer) { if (ddRuntime.Parameters[DDSetup.ReportParameterCustomerID] != null) { ddRuntime.Parameters[DDSetup.ReportParameterCustomerID].CurrentValue = v2kuid.Value.ToString();; } } } } }
public void Release() { if (null != _ReportRuntime) { _ReportRuntime.Release(); _ReportRuntime = null; } subReportDrawing.Pages = null; mainReportDrawing.Pages = null; subMainReportDrawing.Pages = null; }
private static void SetupReportParamter(ReportRuntime runtime, int?aUId, string productReferenceId, string PdmRequestRegisterID, string mainReferenceID, string masterReferenceID) { DDSetup.SetupDDReportRuntimeParameter(runtime, aUId); if (runtime.Parameters[DDSetup.ReportParameterProductReferenceID] != null) { runtime.Parameters[DDSetup.ReportParameterProductReferenceID].CurrentValue = productReferenceId; } // new add string mainReferenceID, string masterReferenceID 2014-02-17 if (runtime.Parameters[DDSetup.QueryReportParameterMainReferenceID] != null) { runtime.Parameters[DDSetup.QueryReportParameterMainReferenceID].CurrentValue = mainReferenceID; } if (runtime.Parameters[DDSetup.QueryReportParameterMasterReferenceID] != null) { runtime.Parameters[DDSetup.QueryReportParameterMasterReferenceID].CurrentValue = masterReferenceID; } if (runtime.Parameters[DDSetup.ReportParameterImageUrl] != null) { runtime.Parameters[DDSetup.ReportParameterImageUrl].CurrentValue = DDSetup.ReorptSetup.ReportingServerImageUrl; } if (!string.IsNullOrEmpty(PdmRequestRegisterID)) { // need format like this '1,2,3,4,6' //string requestContent = DDSetup.GetPdmRequestContent(PdmRequestRegisterID); //if (runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs] != null) //{ // runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].CurrentValue = requestContent; // // runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].Hidden //} //else// try to set ReportParameterProductReferenceID //{ // runtime.Parameters[DDSetup.ReportParameterProductReferenceID].CurrentValue = requestContent; //} DDSetup.SetupDynamicReportRequesttRegisterId(runtime, PdmRequestRegisterID); } }
public void Draw2(Graphics g, PointF location, ReportRuntime rptRuntime) { if (null == _Tag || null == rptRuntime) { return; } RectangleF[] rfC = new RectangleF[1]; rfC [0] = new RectangleF(location.X, location.Y, (int)SizeConversion.ConvertInchesToPixel(_Width, g.DpiX), (int)SizeConversion.ConvertInchesToPixel(_Height, g.DpiY)); using (Pen pn = new Pen(Brushes.Black, 1)) { g.DrawLine(pn, new PointF(location.X, location.Y + rfC [0].Height), new PointF(location.X + rfC [0].Width, location.Y + rfC [0].Height)); // g.DrawRectangles(pn, rfC); } }
private static void ExportToExcelFile(string rdlxFileName, string exportFieName, string uid) { ExcelTransformationDevice device = new ExcelTransformationDevice(); ExcelTemplateGenerator template = new ExcelTemplateGenerator(); MemoryStream templateStream = new MemoryStream(); // rdlxFileName = DDSetup.ReorptSetup.ReportRootPath + @"\" + rdlxFileName; ReportDefinition def = new ReportDefinition(new FileInfo(rdlxFileName)); template.GenerateTemplate(def, templateStream); templateStream.Position = 0; device.TemplateStream = templateStream; ReportRuntime runtime = new ReportRuntime(def); DDSetup.SetupDDReportRuntimeParameter(runtime, uid); runtime.Render(device, new FileStreamProvider(new DirectoryInfo(@".\OutPutExcel"), exportFieName)); }
private void ProcessForm_Load(object sender, EventArgs e) { if (_Tag == null) { return; } if (_Tag is ReportRuntime) { ReportRuntime reportRuntime = _Tag as ReportRuntime; reportRuntime.StartAnalyseReportThread(); } else if (_Tag is ReportDrawing) { this.Visible = false; ReportDrawing reportDrawing = _Tag as ReportDrawing; reportDrawing.StartExportReportThread(); } this.Height = 75; }
private void EvaluateOriginalValue() { if (!this.m_originalValueEvaluated) { this.m_originalValueEvaluated = true; AspNetCore.ReportingServices.ReportIntermediateFormat.TextRun textRunDef = this.TextRunDef; ExpressionInfo value = textRunDef.Value; if (value != null) { if (value.IsExpression) { this.m_originalValue = textRunDef.EvaluateValue(this.ReportScopeInstance, base.ReportElementDef.RenderingContext.OdpContext); this.m_originalValueNeedsReset = true; } else { this.m_originalValue = default(VariantResult); this.m_originalValue.Value = value.Value; ReportRuntime.SetVariantType(ref this.m_originalValue); } } } }
public static void SetupDynamicReportRequesttRegisterId(ReportRuntime runtime, string PdmRequestRegisterID) { string requestContent = DDSetup.GetPdmRequestContent(PdmRequestRegisterID); // Dunamic paramter List //paraNameValue: classId: 1,2,3 |colorId: 2,3 |productReferenceId: 1,2,3 | if (requestContent.StartsWith(DDSetup.PrintMergeGridReferencePrefixConst)) { SetupDataDynamicMergeReport(runtime, PdmRequestRegisterID, requestContent); } else // it is old request dont change !!! { if (runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs] != null) { runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].CurrentValue = requestContent; // runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].Hidden } else // try to set ReportParameterProductReferenceID { runtime.Parameters[DDSetup.ReportParameterProductReferenceID].CurrentValue = requestContent; } } }
public DataAggregateObj(DataAggregateInfo aggInfo, ReportProcessing.ProcessingContext processingContext) { this.m_nonAggregateMode = false; this.m_name = aggInfo.Name; this.m_duplicateNames = aggInfo.DuplicateNames; switch (aggInfo.AggregateType) { case DataAggregateInfo.AggregateTypes.First: this.m_aggregator = new First(); break; case DataAggregateInfo.AggregateTypes.Last: this.m_aggregator = new Last(); break; case DataAggregateInfo.AggregateTypes.Sum: this.m_aggregator = new Sum(); break; case DataAggregateInfo.AggregateTypes.Avg: this.m_aggregator = new Avg(); break; case DataAggregateInfo.AggregateTypes.Max: this.m_aggregator = new Max(processingContext.CompareInfo, processingContext.ClrCompareOptions); break; case DataAggregateInfo.AggregateTypes.Min: this.m_aggregator = new Min(processingContext.CompareInfo, processingContext.ClrCompareOptions); break; case DataAggregateInfo.AggregateTypes.CountDistinct: this.m_aggregator = new CountDistinct(); break; case DataAggregateInfo.AggregateTypes.CountRows: this.m_aggregator = new CountRows(); break; case DataAggregateInfo.AggregateTypes.Count: this.m_aggregator = new Count(); break; case DataAggregateInfo.AggregateTypes.StDev: this.m_aggregator = new StDev(); break; case DataAggregateInfo.AggregateTypes.Var: this.m_aggregator = new Var(); break; case DataAggregateInfo.AggregateTypes.StDevP: this.m_aggregator = new StDevP(); break; case DataAggregateInfo.AggregateTypes.VarP: this.m_aggregator = new VarP(); break; case DataAggregateInfo.AggregateTypes.Aggregate: this.m_aggregator = new Aggregate(); break; case DataAggregateInfo.AggregateTypes.Previous: this.m_aggregator = new Previous(); break; default: Global.Tracer.Assert(false, "Unsupport aggregate type."); break; } this.m_aggregateDef = aggInfo; this.m_reportRT = processingContext.ReportRuntime; if (this.m_reportRT.ReportExprHost != null) { this.m_aggregateDef.SetExprHosts(this.m_reportRT.ReportExprHost, processingContext.ReportObjectModel); } this.m_aggregateResult = default(DataAggregateObjResult); this.Init(); }
internal CalculatedFieldWrapperImpl(Microsoft.ReportingServices.ReportProcessing.Field fieldDef, ReportRuntime reportRT) { m_fieldDef = fieldDef; m_reportRT = reportRT; m_iErrorContext = reportRT; }
public override void ThrowExceptionForQueryBackedParameter(ReportProcessingException_FieldError aError, string aParamName, int aDataSourceIndex, int aDataSetIndex, int aFieldIndex, string propertyName) { AspNetCore.ReportingServices.ReportProcessing.DataSet dataSet = this.m_report.DataSources[aDataSourceIndex].DataSets[aDataSetIndex]; throw new ReportProcessingException(ErrorCode.rsReportParameterQueryProcessingError, aParamName.MarkAsPrivate(), propertyName, dataSet.Fields[aFieldIndex].Name.MarkAsModelInfo(), dataSet.Name.MarkAsPrivate(), ReportRuntime.GetErrorName(aError.Status, aError.Message)); }
protected override void OnInit(EventArgs e) { string reportName = Request.QueryString[DDSetup.QueryReportName]; string aUId = Request.QueryString[DDSetup.ReportParameterUid]; _DatasourceType = Request.QueryString[DDSetup.QueryReportDataSourceType]; if (string.IsNullOrEmpty(reportName) || string.IsNullOrEmpty(aUId)) { Response.Write(" Can not find the report"); return; } if (reportName.EndsWith(".rdlx") || reportName.EndsWith(".RDLX")) { // RequestID //PdmRequestRegisterID string reportFileNmae = DDSetup.ReorptSetup.ReportRootPath + @"\" + Request.QueryString[DDSetup.QueryReportName]; // FileInfo reportFile = new FileInfo(reportFileNmae); ReportDefinition rdl = new ReportDefinition(reportFile); DataDynamicsExport.ChangDataSourceInRentime(rdl, _DatasourceType); ReportRuntime runtime = new ReportRuntime(rdl); DDSetup.SetupDDReportRuntimeParameter(runtime, aUId); if (runtime.Parameters[DDSetup.ReportParameterProductReferenceID] != null) { string productReferenceId = Request.QueryString[DDSetup.ReportParameterProductReferenceID]; if (!string.IsNullOrEmpty(productReferenceId)) { if (runtime.Parameters[DDSetup.ReportParameterProductReferenceID] != null) { runtime.Parameters[DDSetup.ReportParameterProductReferenceID].CurrentValue = int.Parse(productReferenceId); } else // try to setup ReportParameterMutipleProductReferenceIDs { runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].CurrentValue = productReferenceId; } } } // new added MainReferenceID 2014-01-17 if (runtime.Parameters[DDSetup.ReportParameterMainReferenceID] != null) { string mainReferenceID = Request.QueryString[DDSetup.ReportParameterMainReferenceID]; if (!string.IsNullOrEmpty(mainReferenceID)) { runtime.Parameters[DDSetup.ReportParameterMainReferenceID].CurrentValue = int.Parse(mainReferenceID); } } // new added ReportParameter MasterReferenceID 2014-01-17 if (runtime.Parameters[DDSetup.ReportParameterMasterReferenceID] != null) { string masterReferenceID = Request.QueryString[DDSetup.ReportParameterMasterReferenceID]; if (!string.IsNullOrEmpty(masterReferenceID)) { runtime.Parameters[DDSetup.ReportParameterMasterReferenceID].CurrentValue = int.Parse(masterReferenceID); } } // new added reportparamter if (runtime.Parameters[DDSetup.ReportParameterImageUrl] != null) { runtime.Parameters[DDSetup.ReportParameterImageUrl].CurrentValue = DDSetup.ReorptSetup.ReportingServerImageUrl; } string PdmRequestRegisterID = Request.QueryString[DDSetup.PdmRequestRegisterID]; if (!string.IsNullOrEmpty(PdmRequestRegisterID)) { // need format like this '1,2,3,4,6' string requestContent = DDSetup.GetPdmRequestContent(PdmRequestRegisterID); if (runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs] != null) { runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].CurrentValue = requestContent; // runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].Hidden } else// try to set ReportParameterProductReferenceID { runtime.Parameters[DDSetup.ReportParameterProductReferenceID].CurrentValue = requestContent; } } this.WebReportViewer2.SetReport(runtime); } else if (reportName.EndsWith(".rpt") || reportName.EndsWith(".RPT")) { string cystalURL = string.Empty; string lastCharOncrystalurl = DDSetup.ReorptSetup.CrystalReportPublishUrl.Substring(DDSetup.ReorptSetup.CrystalReportPublishUrl.Length - 1, 1); if (lastCharOncrystalurl == @"/") { cystalURL = DDSetup.ReorptSetup.CrystalReportPublishUrl + "CrystalReportView.aspx?" + DDSetup.QueryReportName + "=" + reportName + "&" + DDSetup.ReportParameterUid + "=" + aUId; } else { cystalURL = DDSetup.ReorptSetup.CrystalReportPublishUrl + "/CrystalReportView.aspx?" + DDSetup.QueryReportName + "=" + reportName + "&" + DDSetup.ReportParameterUid + "=" + aUId; } this.Response.Redirect(cystalURL, true); } else { Response.Write(" Can not find the report"); } }
public CalculatedFieldWrapperImpl(AspNetCore.ReportingServices.ReportProcessing.Field fieldDef, ReportRuntime reportRT) { this.m_fieldDef = fieldDef; this.m_reportRT = reportRT; this.m_iErrorContext = reportRT; }
internal object GetSortOrder(ReportRuntime runtime) { object obj = null; if (m_eventSource.UserSort.SortExpressionScope == null) { obj = runtime.EvaluateUserSortExpression(m_eventSource); } else if (m_sortOrders == null) { obj = null; } else { GroupingList groupsInSortTarget = m_eventSource.UserSort.GroupsInSortTarget; if (groupsInSortTarget == null || groupsInSortTarget.Count == 0) { obj = m_sortOrders.LookupTable; } else { bool flag = true; bool flag2 = false; int num = 0; Hashtable hashtable = (Hashtable)m_sortOrders.LookupTable; int num2 = 0; int num3 = 0; while (num3 < groupsInSortTarget.Count) { IEnumerator enumerator = hashtable.Keys.GetEnumerator(); enumerator.MoveNext(); num2 = (int)enumerator.Current; for (int i = 0; i < num2; i++) { num += groupsInSortTarget[num3++].GroupExpressions.Count; } hashtable = (Hashtable)hashtable[num2]; if (num3 < groupsInSortTarget.Count) { Grouping grouping = groupsInSortTarget[num3]; for (int j = 0; j < grouping.GroupExpressions.Count; j++) { object key = runtime.EvaluateRuntimeExpression(m_groupExpressionsInSortTarget[num], ObjectType.Grouping, grouping.Name, "GroupExpression"); num++; obj = hashtable[key]; if (obj == null) { flag = false; break; } if (num < m_groupExpressionsInSortTarget.Count) { hashtable = (Hashtable)obj; } } num3++; if (!flag) { break; } continue; } flag2 = true; break; } if (flag && flag2) { obj = hashtable[1]; if (obj == null) { flag = false; } } if (flag) { m_currentInstanceIndex = m_currentSortIndex + 1; } else { obj = m_currentInstanceIndex; } } } if (obj == null) { obj = DBNull.Value; } return(obj); }
public void Draw(PointF location, ReportRuntime rptRuntime, MyRectF backRect, bool isExport = false, Extension ext = null) { if (null == _Tag || null == rptRuntime) { return; } try { if (location.X < 0) { location.X = backRect.X; } if (location.Y < 0) { location.Y = backRect.Y; } string realText = Text; if (_Tag is PmsLabel) { //需要二次计算的带页参数的报表元素(页码等) string str = (_Tag as IExpression).Expression; if ((str.IndexOf("PageIndex") >= 0 || str.IndexOf("PageCount") >= 0)) { object o = rptRuntime.ExpressionEngine.Execute(str, rptRuntime.DataTables, ""); if (o != null) { realText = Convert.ToString(o); } } else { str = Text.ToLower(); if (!string.IsNullOrEmpty(str) && (str.IndexOf("[#pageindex#]") >= 0 || str.IndexOf("[#pageCount#]") >= 0)) { object objVisible = rptRuntime.ExpressionEngine.ExcuteBindText(Text, rptRuntime.DataTables, ""); if (objVisible != null) { realText = Convert.ToString(objVisible); } } } } else if (_Tag is IVisibleExpression) { string str = (_Tag as IVisibleExpression).VisibleExpression; if (!string.IsNullOrEmpty(str) && ((str.IndexOf("PageIndex") >= 0 || str.IndexOf("PageCount") >= 0))) { object o = rptRuntime.ExpressionEngine.Execute(str, rptRuntime.DataTables, ""); if (o != null) { bool bVisible = Convert.ToBoolean(o); if (!bVisible) { return; } } } } float dpiZoom = 1.0f; if (null != _Page && null != _Page.PageManager) { dpiZoom = 96 / _Page.PageManager.ReportConfigDpiX; } if (_Tag is ICell) { ICell cell = _Tag as ICell; cell.RealText = realText; if (_Parameter != null) { cell.Style = _Parameter as PMS.Libraries.ToolControls.MESTable.CellStyles.Style; } cell.Width = SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, 96); cell.Height = SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, 96); } else if (_Tag is IChartElement) { IChartElement curve = _Tag as IChartElement; curve.Width = (int)SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, 96); curve.Height = (int)SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, 96); /*if (curve is Control) { * var ctl = (curve as Control); * ctl.Invoke(new Action(() => { * ctl.Width = curve.Width; * ctl.Height = curve.Height; * })); * // (curve as Control).Width = curve.Width; * //(curve as Control).Height = curve.Height; * }*/ } else if (_Tag is SectionChart) { SectionChart curve = _Tag as SectionChart; (curve as IElementExtended).Width = (int)SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, 96); (curve as IElementExtended).Height = (int)SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, 96); /*if (curve is Control) { * //(curve as Control).Width = (curve as IElementExtended).Width; * //(curve as Control).Height = (curve as IElementExtended).Height; * * var ctl = (curve as Control); * ctl.Invoke(new Action(() => { * ctl.Width = (curve as IElementExtended).Width; * ctl.Height = (curve as IElementExtended).Height; * })); * }*/ //curve.DirectDraw (DraqCanvas, location.X, location.Y, dpiZoom); } else if (_Tag is IDirectDrawable) { if (_Tag is IElementContent) { (_Tag as IElementContent).RealText = realText; } if (_Tag is IElement) { (_Tag as IElement).Width = (int)SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, 96); (_Tag as IElement).Height = (int)SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, 96); } //(_Tag as IDirectDrawable).DirectDraw (DraqCanvas, location.X, location.Y, dpiZoom); } //todo:qiuleilei if (isExport && CurrentPrjInfo.CurrentEnvironment == MESEnvironment.MESReportServer && ext != null) { ext.ToHtml(Page, rptRuntime, _Tag, location, SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, 96), SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, 96)); // if (_Tag != null && (_Tag is Control)) { // (_Tag as Control).Dispose (); // _Tag = null; // } } } catch (System.Exception ex) { if (_Tag is IElement) { rptRuntime.AddReportLog(ex, (_Tag as IElement).Name); } else { rptRuntime.AddReportLog(ex); } } }
public void Draw(Graphics g, PointF location, ReportRuntime rptRuntime, RectangleF backRect, bool isExport = false, Extension ext = null) { if (null == _Tag || null == rptRuntime) { return; } try { if (location.X < 0) { location.X = backRect.Location.X; } if (location.Y < 0) { location.Y = backRect.Location.Y; } Canvas DraqCanvas = new Canvas(g); string realText = Text; if (_Tag is PmsLabel) { //需要二次计算的带页参数的报表元素(页码等) string str = (_Tag as IExpression).Expression; if ((str.IndexOf("PageIndex") >= 0 || str.IndexOf("PageCount") >= 0)) { object o = rptRuntime.ExpressionEngine.Execute(str, rptRuntime.DataTables, ""); if (o != null) { realText = Convert.ToString(o); } } else { str = Text.ToLower(); if (!string.IsNullOrEmpty(str) && (str.IndexOf("[#pageindex#]") >= 0 || str.IndexOf("[#pageCount#]") >= 0)) { object objVisible = rptRuntime.ExpressionEngine.ExcuteBindText(Text, rptRuntime.DataTables, ""); if (objVisible != null) { realText = Convert.ToString(objVisible); } } } } else if (_Tag is IVisibleExpression) { string str = (_Tag as IVisibleExpression).VisibleExpression; if (!string.IsNullOrEmpty(str) && ((str.IndexOf("PageIndex") >= 0 || str.IndexOf("PageCount") >= 0))) { object o = rptRuntime.ExpressionEngine.Execute(str, rptRuntime.DataTables, ""); if (o != null) { bool bVisible = Convert.ToBoolean(o); if (!bVisible) { return; } } } } float dpiZoom = 1.0f; if (null != _Page && null != _Page.PageManager) { dpiZoom = g.DpiX / _Page.PageManager.ReportConfigDpiX; } if (_Tag is ICell) { ICell cell = _Tag as ICell; cell.RealText = realText; if (_Parameter != null) { cell.Style = _Parameter as PMS.Libraries.ToolControls.MESTable.CellStyles.Style; } //todo: qiuleilei if (CurrentPrjInfo.CurrentEnvironment == MESEnvironment.MESReportServer && cell.Style != null) { var ff = FontFamily.Families.FirstOrDefault((f) => f.Name == "宋体"); if (ff == null) { cell.Style.Font = SystemFonts.DefaultFont; //ff = FontFamily.Families.FirstOrDefault((f)=> f.Name.Contains("Sans")); } if (ff != null) { cell.Style.Font = new Font(ff, 9.0f, FontStyle.Regular); } } cell.Width = SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, g.DpiX); cell.Height = SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, g.DpiY); cell.DirectDraw(DraqCanvas, location.X, location.Y, dpiZoom); } else if (_Tag is IChartElement) { IChartElement curve = _Tag as IChartElement; //if (curve is IBindDataTableManager) //{ // (curve as IBindReportExpressionEngine).ExpressionEngine = rptRuntime.ExpressionEngine; // (curve as IBindDataTableManager).BindDataTableManager(rptRuntime.DataTables, realText); //} curve.Width = (int)SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, g.DpiX); curve.Height = (int)SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, g.DpiY); if (curve is Control) { (curve as Control).Width = curve.Width; (curve as Control).Height = curve.Height; } curve.DirectDraw(DraqCanvas, location.X, location.Y, dpiZoom); } else if (_Tag is SectionChart) { SectionChart curve = _Tag as SectionChart; //if (curve is IBindDataTableManager) //{ // (curve as IBindReportExpressionEngine).ExpressionEngine = rptRuntime.ExpressionEngine; // (curve as IBindDataTableManager).BindDataTableManager(rptRuntime.DataTables, realText); //} (curve as IElementExtended).Width = (int)SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, g.DpiX); (curve as IElementExtended).Height = (int)SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, g.DpiY); if (curve is Control) { (curve as Control).Width = (curve as IElementExtended).Width; (curve as Control).Height = (curve as IElementExtended).Height; } curve.DirectDraw(DraqCanvas, location.X, location.Y, dpiZoom); } else if (_Tag is IDirectDrawable) { if (_Tag is IElementContent) { (_Tag as IElementContent).RealText = realText; } if (_Tag is IElement) { (_Tag as IElement).Width = (int)SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, g.DpiX); (_Tag as IElement).Height = (int)SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, g.DpiY); } (_Tag as IDirectDrawable).DirectDraw(DraqCanvas, location.X, location.Y, dpiZoom); } //todo:qiuleilei if (isExport && CurrentPrjInfo.CurrentEnvironment == MESEnvironment.MESReportServer && ext != null) { ext.ToHtml(Page, rptRuntime, _Tag, location, SizeConversion.ConvertInchesToPixel(_Width, backRect.Width - location.X, g.DpiX), SizeConversion.ConvertInchesToPixel(_Height, backRect.Height - location.Y + backRect.Y, g.DpiY)); // if (_Tag != null && _Tag is Control) { // (_Tag as Control).Dispose (); // _Tag = null; // } } } catch (System.Exception ex) { if (_Tag is IElement) { rptRuntime.AddReportLog(ex, (_Tag as IElement).Name); } else { rptRuntime.AddReportLog(ex); } } }
public void UpdateFieldValues(ObjectModelImpl reportOM, bool useDataSetFieldsCache, bool reuseFieldObjects, AspNetCore.ReportingServices.ReportIntermediateFormat.RecordRow row, DataSetInstance dataSetInstance, bool readerExtensionsSupported) { Global.Tracer.Assert(null != row, "Empty data row / no data reader"); if (this.m_dataSetInstance != dataSetInstance) { this.m_dataSetInstance = dataSetInstance; this.m_dataSet = dataSetInstance.DataSetDef.DataSetCore; if (this.m_dataSet.FieldsContext != null && useDataSetFieldsCache) { this.m_fields = this.m_dataSet.FieldsContext.Fields; } else { reuseFieldObjects = false; } this.m_dataReader = null; this.m_lastRowOffset = DataFieldRow.UnInitializedStreamOffset; this.m_pendingFieldValueUpdate = false; } this.m_allFieldsCleared = false; FieldInfo[] fieldInfos = dataSetInstance.FieldInfos; if (this.m_fields.ReaderExtensionsSupported && this.m_dataSet.InterpretSubtotalsAsDetails == AspNetCore.ReportingServices.ReportIntermediateFormat.DataSet.TriState.False) { this.m_fields.IsAggregateRow = row.IsAggregateRow; this.m_fields.AggregationFieldCount = row.AggregationFieldCount; if (!row.IsAggregateRow) { this.m_fields.AggregationFieldCountForDetailRow = row.AggregationFieldCount; } } int num = 0; int count = this.m_dataSet.Fields.Count; int num2 = row.RecordFields.Length; for (num = 0; num < num2; num++) { FieldImpl fieldImpl = reuseFieldObjects ? this.m_fields.GetFieldByIndex(num) : null; AspNetCore.ReportingServices.ReportIntermediateFormat.Field fieldDef = this.m_dataSet.Fields[num]; AspNetCore.ReportingServices.ReportIntermediateFormat.RecordField recordField = row.RecordFields[num]; if (recordField == null) { if (!reuseFieldObjects || fieldImpl == null) { fieldImpl = new FieldImpl(reportOM, DataFieldStatus.IsMissing, null, fieldDef); } else { fieldImpl.UpdateValue(null, false, DataFieldStatus.IsMissing, null); } } else if (recordField.FieldStatus == DataFieldStatus.None) { if (!reuseFieldObjects || fieldImpl == null) { fieldImpl = new FieldImpl(reportOM, recordField.FieldValue, recordField.IsAggregationField, fieldDef); } else { fieldImpl.UpdateValue(recordField.FieldValue, recordField.IsAggregationField, DataFieldStatus.None, null); } } else if (!reuseFieldObjects || fieldImpl == null) { fieldImpl = new FieldImpl(reportOM, recordField.FieldStatus, ReportRuntime.GetErrorName(recordField.FieldStatus, null), fieldDef); } else { fieldImpl.UpdateValue(null, false, recordField.FieldStatus, ReportRuntime.GetErrorName(recordField.FieldStatus, null)); } if (recordField != null && fieldInfos != null) { FieldInfo fieldInfo = fieldInfos[num]; if (fieldInfo != null && fieldInfo.PropertyCount != 0 && recordField.FieldPropertyValues != null) { for (int i = 0; i < fieldInfo.PropertyCount; i++) { fieldImpl.SetProperty(fieldInfo.PropertyNames[i], recordField.FieldPropertyValues[i]); } } } this.m_fields[num] = fieldImpl; } if (num < count) { if (!reuseFieldObjects && reportOM.OdpContext.ReportRuntime.ReportExprHost != null) { this.m_dataSet.SetExprHost(reportOM.OdpContext.ReportRuntime.ReportExprHost, reportOM); } for (; num < count; num++) { AspNetCore.ReportingServices.ReportIntermediateFormat.Field fieldDef2 = this.m_dataSet.Fields[num]; FieldImpl fieldImpl2 = reuseFieldObjects ? this.m_fields.GetFieldByIndex(num) : null; if (reuseFieldObjects && fieldImpl2 != null) { if (!fieldImpl2.ResetCalculatedField()) { this.CreateAndInitializeCalculatedFieldWrapper(reportOM, readerExtensionsSupported, this.m_dataSet, num, fieldDef2); } } else { this.CreateAndInitializeCalculatedFieldWrapper(reportOM, readerExtensionsSupported, this.m_dataSet, num, fieldDef2); } } } }
public object GetFieldValue(int aliasIndex) { RecordField recordField = this.m_recordFields[aliasIndex]; Global.Tracer.Assert(null != recordField); if (recordField.FieldStatus != 0) { throw new ReportProcessingException_FieldError(recordField.FieldStatus, ReportRuntime.GetErrorName(recordField.FieldStatus, null)); } return(recordField.FieldValue); }
private void ThrowIfErrorOccurred(string propertyName, bool errorOccurred, DataFieldStatus fieldStatus) { if (!errorOccurred) { return; } if (fieldStatus != 0) { throw new ReportProcessingException(ErrorCode.rsFilterFieldError, this.m_objectType, this.m_objectName, propertyName, ReportRuntime.GetErrorName(fieldStatus, null)); } throw new ReportProcessingException(ErrorCode.rsFilterEvaluationError, this.m_objectType, this.m_objectName, propertyName); }
private static void SetupDataDynamicMergeReport(ReportRuntime runtime, string PdmRequestRegisterID, string requestContent) { // referenceId , blockId, rowValueId // truncate 18000,5834,6bb03992-e5ff-4b01-a41b-438ca9a7e560 int?mainBlockId = DDSetup.GetPdmRequestMainBlockId(PdmRequestRegisterID); if (mainBlockId.HasValue) { string dataFieldString = requestContent.Substring(requestContent.IndexOf(':') + 1); // column1: ReferenceID, Column2: BlockId, column3: RowValueGuid DataTable result = DDSetup.ReadCSVContentDataTable(dataFieldString, 3, "|", ","); if (result.Rows.Count > 0) { string productReferenceId = result.Rows[0][0].ToString(); if (runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs] != null) { runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].CurrentValue = productReferenceId; // runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].Hidden } else // try to set ReportParameterProductReferenceID { runtime.Parameters[DDSetup.ReportParameterProductReferenceID].CurrentValue = productReferenceId; } Dictionary <string, List <DataRow> > dictBlockIdDataRowList = result.AsEnumerable().GroupBy(o => o["2"]).ToDictionary(o => o.Key.ToString(), o => o.ToList()); // only one block it is mainblock if (dictBlockIdDataRowList.Count == 1) { var firstKeyList = dictBlockIdDataRowList.First(); var rowValueConcString = firstKeyList.Value.Select(o => o["3"].ToString()).Aggregate((current, next) => current + ", " + next); // it is main block (first block //GetMergeBlockPrintGrid 3879, 5834, '6BB03992-E5FF-4B01-A41B-438CA9A7E560', -1, '2B963DC6-3D85-46C9-B100-2F19ADECA94B', 18000 if (firstKeyList.Key.ToString() == mainBlockId.ToString()) { if (runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter] != null) { runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter].CurrentValue = rowValueConcString; } // need to set seond as System.Guid.NewGuid() to leav empty row if (runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter] != null) { runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter].CurrentValue = System.Guid.NewGuid().ToString(); } } else // it is not main block, it is second block { // need to set first as System.Guid.NewGuid() to leav empty row if (runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter] != null) { runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter].CurrentValue = System.Guid.NewGuid().ToString(); } if (runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter] != null) { runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter].CurrentValue = rowValueConcString; } } } else // two blockId { foreach (string blockIdkey in dictBlockIdDataRowList.Keys) { var rowValueConcString = dictBlockIdDataRowList[blockIdkey].Select(o => o["3"].ToString()).Aggregate((current, next) => current + ", " + next); // it is first block if (blockIdkey == mainBlockId.ToString()) { //MainBlockId if (runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter] != null) { runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter].CurrentValue = rowValueConcString; } } else // it is second block { if (runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter] != null) { runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter].CurrentValue = rowValueConcString; } } } } } } }