protected void addItem(ref IList <string> columns, ref ReportDataRow reportDataRow, ref IList <IReportRow> reportRows, IReport item) { foreach (var column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); Tuple <ReportColumnType, object> field = item.getVirtualColumnValue(column.Replace(this.Parent.Name + "$" + this.Name + ".", "")); ReportColumnType type = field.Item1; switch (type) { case ReportColumnType.Integer: reportDataCell.GenericValue = Convert.ToInt32(field.Item2); break; case ReportColumnType.String: reportDataCell.GenericValue = Convert.ToString(field.Item2); break; case ReportColumnType.DateTime: reportDataCell.GenericValue = Convert.ToDateTime(field.Item2); break; case ReportColumnType.Boolean: reportDataCell.GenericValue = Convert.ToBoolean(field.Item2); break; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); }
public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { IList<IReportRow> reportRows = new List<IReportRow>(); if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null) return reportRows; IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; int contactID = 0, rnowContactId = 0; if (_context == null) { /* cannot create filter based on the ebs contact party id because this column is not in the payload response * there is SOLD_TO_CONTACT_ID, it does not match the input of the request payload * so, cannot run the report in Report Explorer */ return reportRows; } else { IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; contactID = getContactPartyIdCustomAttr(contactRecord); rnowContactId = contactRecord.ID; } if (contactID == 0) return reportRows; OutputParameters op = null; op = Order.LookupOrdersByContact(contactID, 0, rnowContactId); foreach (APPSOE_ORDER_CUST_ORX3349377X1X3 order in op.X_ORDERS) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); string type = order.GetType().GetProperty(removePkgTblName).PropertyType.Name; object propVal = order.GetType().GetProperty(removePkgTblName).GetValue(order, null); if (propVal == null) reportDataCell.GenericValue = null; else if (type == "Nullable`1" && order.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal") reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0 else reportDataCell.GenericValue = propVal; reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); } return reportRows; }
// used by SR and Contact Details, and null check before doing Convert. protected void addDetailRow(ref Dictionary <string, string> dictSRDetail, ref IList <string> columns, ref ReportDataRow reportDataRow, ref IList <IReportRow> reportRows) { foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back, that's required by the report framework string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); string[] typeValArray = Regex.Split(dictSRDetail[removePkgTblName], TYPE_VALUE_DELIMITER); string type = typeValArray[0]; string val = typeValArray[1]; switch (type) { case "String": reportDataCell.GenericValue = val; break; case "Integer": if (val != null && val != "") { reportDataCell.GenericValue = Convert.ToInt32(val); } else { reportDataCell.GenericValue = null; } break; case "DateTime": if (val != null && val != "") { reportDataCell.GenericValue = Convert.ToDateTime(val); } else { reportDataCell.GenericValue = null; } break; case "Boolean": if (val != null && val != "") { reportDataCell.GenericValue = Convert.ToBoolean(val); } else { reportDataCell.GenericValue = null; } break; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); }
// Add EBS Service Request row private void addEBSsrRow(ref IList <string> columns, ref ReportDataRow reportDataRow, ref IList <IReportRow> reportRows, ServiceRequest req) { foreach (var column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); switch (column) { case "SRData$SRlistTable.SrNumber": reportDataCell.GenericValue = req.RequestNumber; break; case "SRData$SRlistTable.Status": reportDataCell.GenericValue = req.Status; break; case "SRData$SRlistTable.Summary": reportDataCell.GenericValue = req.Summary; break; case "SRData$SRlistTable.Created": reportDataCell.GenericValue = req.RequestDate; break; case "SRData$SRlistTable.IncidentRef": reportDataCell.GenericValue = ""; break; case "SRData$SRlistTable.HiddenSRconcatIncident_ID": reportDataCell.GenericValue = req.RequestID + "_"; break; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); }
public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { IList<IReportRow> reportRows = new List<IReportRow>(); if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null) return reportRows; IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; int orderID = 0, incidentID = 0; if (_context == null) { // filter is ID if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode IDFilterNode = filterNode.FilterNodes.ToList<IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ID", this.Parent.Name, this.Name)); if (IDFilterNode != null) orderID = Convert.ToInt32(IDFilterNode.ReportFilter.Value); } } else { IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; orderID = getEbsOrderIdCustomAttr(incidentRecord); incidentID = incidentRecord.ID; } if (orderID == 0) return reportRows; OutputParameters2 op = null; op = Order.LookupOrder(orderID, incidentID, 0); _orderCompleteOutput = op; ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); if (removePkgTblName == "ID") { reportDataCell.GenericValue = orderID; } else { string type = op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).PropertyType.Name; object propVal = op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).GetValue(op.X_HEADER_VAL_REC, null); if (propVal == null) reportDataCell.GenericValue = null; else if (type == "Nullable`1" && op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal") reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0 else reportDataCell.GenericValue = propVal; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); return reportRows; }
// add Right Now Incident report row private void addRnowIncidentRow(ref IList <string> columns, ref ReportDataRow reportDataRow, ref IList <IReportRow> reportRows, Dictionary <string, string> colValue) { string heading = null; string dateTimeString = null; try { foreach (var column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); switch (column) { case "SRData$SRlistTable.SrNumber": heading = "EBS_SR_NUM"; reportDataCell.GenericValue = colValue[heading]; break; case "SRData$SRlistTable.IncidentRef": heading = "REFERENCE #"; reportDataCell.GenericValue = colValue[heading]; break; case "SRData$SRlistTable.Created": heading = "DATE CREATED"; dateTimeString = colValue[heading]; // remove the single ' dateTimeString = dateTimeString.TrimStart('\''); dateTimeString = dateTimeString.TrimEnd('\''); reportDataCell.GenericValue = Convert.ToDateTime(dateTimeString); break; case "SRData$SRlistTable.Summary": heading = "SUBJECT"; reportDataCell.GenericValue = colValue[heading]; break; case "SRData$SRlistTable.Status": heading = "STATUS"; reportDataCell.GenericValue = colValue[heading]; break; case "SRData$SRlistTable.HiddenSRconcatIncident_ID": heading = "INCIDENT ID"; // colValue[5] is hiddent IncidentID on the incidentsByContact report reportDataCell.GenericValue = "_" + colValue[heading]; break; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); } catch (Exception ex) { string errMsg = "rnow_incidentsByContact report columns Heading: " + heading + " is missing"; MessageBox.Show(errMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); string logMessage = errMsg; ConfigurationSetting.logWrap.ErrorLog(logMessage: logMessage); throw ex; } }
public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { IList<IReportRow> reportRows = new List<IReportRow>(); OutputParameters2 op = OrderMgmtHeaderVirtualTable._orderCompleteOutput; /* get the table name based on the filter * filter is "{0}${1}.HEADER_ID" * {1} == this.Name (the child table name) */ string headerId = null; if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode headerIdFilterNode = filterNode.FilterNodes.ToList<IReportFilterNode>().Find( fn => fn.ReportFilter.Expression == string.Format("{0}${1}.HEADER_ID", this.Parent.Name, this.Name)); if (headerIdFilterNode != null) { headerId = headerIdFilterNode.ReportFilter.Value; } } if (headerId == "" || headerId == null) return reportRows; int headerIdInt = Convert.ToInt32(headerId); // call the ws if the header is not the same if (op == null || (op != null && op.X_HEADER_REC.HEADER_ID != headerIdInt)) op = Order.LookupOrder(headerIdInt, 0, 0); // get the table array object[] obj = (object[])op.GetType().GetProperty(this.Name).GetValue(op, null); foreach (object orderChild in obj) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back, that's required by the report framework string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); if (removePkgTblName == "HEADER_ID") { reportDataCell.GenericValue = headerIdInt; } else { string type = orderChild.GetType().GetProperty(removePkgTblName).PropertyType.Name; object propVal = orderChild.GetType().GetProperty(removePkgTblName).GetValue(orderChild, null); if (propVal == null) reportDataCell.GenericValue = null; else if (type == "Nullable`1" && orderChild.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal") reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0 else reportDataCell.GenericValue = propVal; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); } return reportRows; }
protected void addItem(ref IList<string> columns, ref ReportDataRow reportDataRow, ref IList<IReportRow> reportRows, IReport item) { foreach (var column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); Tuple<ReportColumnType, object> field = item.getVirtualColumnValue(column.Replace(this.Parent.Name + "$" + this.Name + ".", "")); ReportColumnType type = field.Item1; switch (type) { case ReportColumnType.Integer: reportDataCell.GenericValue = Convert.ToInt32(field.Item2); break; case ReportColumnType.String: reportDataCell.GenericValue = Convert.ToString(field.Item2); break; case ReportColumnType.DateTime: reportDataCell.GenericValue = Convert.ToDateTime(field.Item2); break; case ReportColumnType.Boolean: reportDataCell.GenericValue = Convert.ToBoolean(field.Item2); break; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); }
// used by SR and Contact Details, and null check before doing Convert. protected void addDetailRow(ref Dictionary<string, string> dictSRDetail, ref IList<string> columns, ref ReportDataRow reportDataRow, ref IList<IReportRow> reportRows) { foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back, that's required by the report framework string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); string[] typeValArray = Regex.Split(dictSRDetail[removePkgTblName], TYPE_VALUE_DELIMITER); string type = typeValArray[0]; string val = typeValArray[1]; switch (type) { case "String": reportDataCell.GenericValue = val; break; case "Integer": if (val != null && val != "") reportDataCell.GenericValue = Convert.ToInt32(val); else reportDataCell.GenericValue = null; break; case "DateTime": if (val != null && val != "") reportDataCell.GenericValue = Convert.ToDateTime(val); else reportDataCell.GenericValue = null; break; case "Boolean": if (val != null && val != "") reportDataCell.GenericValue = Convert.ToBoolean(val); else reportDataCell.GenericValue = null; break; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); }
public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); OutputParameters2 op = OrderMgmtHeaderVirtualTable._orderCompleteOutput; /* get the table name based on the filter * filter is "{0}${1}.HEADER_ID" * {1} == this.Name (the child table name) */ string headerId = null; if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode headerIdFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find( fn => fn.ReportFilter.Expression == string.Format("{0}${1}.HEADER_ID", this.Parent.Name, this.Name)); if (headerIdFilterNode != null) { headerId = headerIdFilterNode.ReportFilter.Value; } } if (headerId == "" || headerId == null) { return(reportRows); } int headerIdInt = Convert.ToInt32(headerId); // call the ws if the header is not the same if (op == null || (op != null && op.X_HEADER_REC.HEADER_ID != headerIdInt)) { op = Order.LookupOrder(headerIdInt, 0, 0); } // get the table array object[] obj = (object[])op.GetType().GetProperty(this.Name).GetValue(op, null); foreach (object orderChild in obj) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back, that's required by the report framework string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); if (removePkgTblName == "HEADER_ID") { reportDataCell.GenericValue = headerIdInt; } else { string type = orderChild.GetType().GetProperty(removePkgTblName).PropertyType.Name; object propVal = orderChild.GetType().GetProperty(removePkgTblName).GetValue(orderChild, null); if (propVal == null) { reportDataCell.GenericValue = null; } else if (type == "Nullable`1" && orderChild.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal") { reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0 } else { reportDataCell.GenericValue = propVal; } } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); } return(reportRows); }
public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null) { return(reportRows); } IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; int contactID = 0, rnowContactId = 0; if (_context == null) { /* cannot create filter based on the ebs contact party id because this column is not in the payload response * there is SOLD_TO_CONTACT_ID, it does not match the input of the request payload * so, cannot run the report in Report Explorer */ return(reportRows); } else { IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; contactID = getContactPartyIdCustomAttr(contactRecord); rnowContactId = contactRecord.ID; } if (contactID == 0) { return(reportRows); } OutputParameters op = null; op = Order.LookupOrdersByContact(contactID, 0, rnowContactId); foreach (APPSOE_ORDER_CUST_ORX3349377X1X3 order in op.X_ORDERS) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); string type = order.GetType().GetProperty(removePkgTblName).PropertyType.Name; object propVal = order.GetType().GetProperty(removePkgTblName).GetValue(order, null); if (propVal == null) { reportDataCell.GenericValue = null; } else if (type == "Nullable`1" && order.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal") { reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0 } else { reportDataCell.GenericValue = propVal; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); } return(reportRows); }
// Add EBS Service Request row private void addEBSsrRow(ref IList<string> columns, ref ReportDataRow reportDataRow, ref IList<IReportRow> reportRows, ServiceRequest req) { foreach (var column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); switch (column) { case "SRData$SRlistTable.SrNumber": reportDataCell.GenericValue = req.RequestNumber; break; case "SRData$SRlistTable.Status": reportDataCell.GenericValue = req.Status; break; case "SRData$SRlistTable.Summary": reportDataCell.GenericValue = req.Summary; break; case "SRData$SRlistTable.Created": reportDataCell.GenericValue = req.RequestDate; break; case "SRData$SRlistTable.IncidentRef": reportDataCell.GenericValue = ""; break; case "SRData$SRlistTable.HiddenSRconcatIncident_ID": reportDataCell.GenericValue = req.RequestID + "_"; break; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); }
// add Right Now Incident report row private void addRnowIncidentRow(ref IList<string> columns, ref ReportDataRow reportDataRow, ref IList<IReportRow> reportRows, Dictionary<string, string> colValue) { string heading = null; string dateTimeString = null; try { foreach (var column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); switch (column) { case "SRData$SRlistTable.SrNumber": heading = "EBS_SR_NUM"; reportDataCell.GenericValue = colValue[heading]; break; case "SRData$SRlistTable.IncidentRef": heading = "REFERENCE #"; reportDataCell.GenericValue = colValue[heading]; break; case "SRData$SRlistTable.Created": heading = "DATE CREATED"; dateTimeString = colValue[heading]; // remove the single ' dateTimeString = dateTimeString.TrimStart('\''); dateTimeString = dateTimeString.TrimEnd('\''); reportDataCell.GenericValue = Convert.ToDateTime(dateTimeString); break; case "SRData$SRlistTable.Summary": heading = "SUBJECT"; reportDataCell.GenericValue = colValue[heading]; break; case "SRData$SRlistTable.Status": heading = "STATUS"; reportDataCell.GenericValue = colValue[heading]; break; case "SRData$SRlistTable.HiddenSRconcatIncident_ID": heading = "INCIDENT ID"; // colValue[5] is hiddent IncidentID on the incidentsByContact report reportDataCell.GenericValue = "_" + colValue[heading]; break; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); } catch (Exception ex) { string errMsg = "rnow_incidentsByContact report columns Heading: " + heading + " is missing"; MessageBox.Show(errMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); string logMessage = errMsg; ConfigurationSetting.logWrap.ErrorLog(logMessage: logMessage); throw ex; } }
public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null) { return(reportRows); } IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; int incidentID = 0; if (_context == null) { /* cannot create filter based on the Rnow incidentid because this column is not in the payload response * so, cannot run the report in Report Explorer */ if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode headerIdFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find( fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ATTRIBUTE15", this.Parent.Name, this.Name)); if (headerIdFilterNode != null) { incidentID = Convert.ToInt32(headerIdFilterNode.ReportFilter.Value); } } } else { IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; incidentID = incidentRecord.ID; } OutputParameters1 op = null; // incidentID = 123456; op = Order.LookupOrdersByIncident(incidentID, incidentID, 0); foreach (APPSOE_ORDER_CUST_ORX3349377X2X3 order in op.X_ORDERS) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); string type = order.GetType().GetProperty(removePkgTblName).PropertyType.Name; object propVal = order.GetType().GetProperty(removePkgTblName).GetValue(order, null); if (propVal == null) { reportDataCell.GenericValue = null; } else if (type == "Nullable`1" && order.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal") { reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0 } else { reportDataCell.GenericValue = propVal; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); } return(reportRows); }
public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null) { return(reportRows); } IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; int orderID = 0, incidentID = 0; if (_context == null) { // filter is ID if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode IDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ID", this.Parent.Name, this.Name)); if (IDFilterNode != null) { orderID = Convert.ToInt32(IDFilterNode.ReportFilter.Value); } } } else { IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; orderID = getEbsOrderIdCustomAttr(incidentRecord); incidentID = incidentRecord.ID; } if (orderID == 0) { return(reportRows); } OutputParameters2 op = null; op = Order.LookupOrder(orderID, incidentID, 0); _orderCompleteOutput = op; ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); if (removePkgTblName == "ID") { reportDataCell.GenericValue = orderID; } else { string type = op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).PropertyType.Name; object propVal = op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).GetValue(op.X_HEADER_VAL_REC, null); if (propVal == null) { reportDataCell.GenericValue = null; } else if (type == "Nullable`1" && op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal") { reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0 } else { reportDataCell.GenericValue = propVal; } } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); return(reportRows); }
public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { IList<IReportRow> reportRows = new List<IReportRow>(); if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null) return reportRows; IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; int incidentID = 0; if (_context == null) { /* cannot create filter based on the Rnow incidentid because this column is not in the payload response * so, cannot run the report in Report Explorer */ if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode headerIdFilterNode = filterNode.FilterNodes.ToList<IReportFilterNode>().Find( fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ATTRIBUTE15", this.Parent.Name, this.Name)); if (headerIdFilterNode != null) { incidentID = Convert.ToInt32(headerIdFilterNode.ReportFilter.Value); } } } else { IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; incidentID = incidentRecord.ID; } OutputParameters1 op = null; // incidentID = 123456; op = Order.LookupOrdersByIncident(incidentID, incidentID, 0); foreach (APPSOE_ORDER_CUST_ORX3349377X2X3 order in op.X_ORDERS) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (string column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); // put the "SRData$SRDetailTable." package name back string pkgNtblName = "SRData$" + this.Name + "."; string removePkgTblName = column.Replace(pkgNtblName, ""); string type = order.GetType().GetProperty(removePkgTblName).PropertyType.Name; object propVal = order.GetType().GetProperty(removePkgTblName).GetValue(order, null); if (propVal == null) reportDataCell.GenericValue = null; else if (type == "Nullable`1" && order.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal") reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0 else reportDataCell.GenericValue = propVal; reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); } return reportRows; }