public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { decimal hiddenRepairOrderID = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenRepairOrderID", true); if (null != filter_value) { hiddenRepairOrderID = Convert.ToDecimal(filter_value); } IList<IReportRow> reportRows = new List<IReportRow>(); if (hiddenRepairOrderID <= 0) { string logMessage = "Provide a valid EBS Repair Order ID to search for Repair Logistics. Ignoring repair_order_id " + hiddenRepairOrderID; string logNote = null; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); return reportRows; } RepairLogistics[] items = RepairLogistics.LookupRepairLogisticsList(hiddenRepairOrderID); foreach (RepairLogistics item in items) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (item != null) addItem(ref columns, ref reportDataRow, ref reportRows, item); } 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); }
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; }
public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { decimal hiddenRepairOrderID = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenRepairOrderID", true); if (null != filter_value) { hiddenRepairOrderID = Convert.ToDecimal(filter_value); } IList <IReportRow> reportRows = new List <IReportRow>(); if (hiddenRepairOrderID <= 0) { string logMessage = "Provide a valid EBS Repair Order ID to search for Repair Logistics. Ignoring repair_order_id " + hiddenRepairOrderID; string logNote = null; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); return(reportRows); } RepairLogistics[] items = RepairLogistics.LookupRepairLogisticsList(hiddenRepairOrderID); foreach (RepairLogistics item in items) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (item != null) { addItem(ref columns, ref reportDataRow, ref reportRows, item); } } return(reportRows); }
/// <summary> /// Gets rows for the report /// </summary> /// <param name="columns"></param> /// <param name="filterNode"></param> public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); int rntContactId = 0, rntIncidentId = 0; decimal contact_id = getContactID(filterNode, out rntContactId); //check if ebs contact id is present switch (String.Format("{0:0}", contact_id)) { case "-1": return(reportRows); } //get ebs incident id decimal incident_id = getIncidentID(filterNode, rntContactId, out rntIncidentId); RepairOrder[] items = RepairOrder.LookupRepairOrderList(contact_id, incident_id, rntIncidentId, rntContactId); foreach (RepairOrder item in items) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (item != null) { addItem(ref columns, ref reportDataRow, ref reportRows, item); } } return(reportRows); }
/// <summary> /// Get rows for the report /// </summary> /// <param name="columns"></param> /// <param name="filterNode"></param> public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { IList<IReportRow> reportRows = new List<IReportRow>(); int rntContactId = 0, rntIncidentId = 0; decimal contactOrgID = getContactOrgID(filterNode, out rntContactId); string serial_number = getSerialNumber(filterNode, rntContactId, out rntIncidentId); string active_instance_only = getActiveInstanceFlag(filterNode); Item[] items = Item.LookupItemList(serial_number, contactOrgID, active_instance_only, rntIncidentId, rntContactId); foreach (Item item in items) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (item != null) addItem(ref columns, ref reportDataRow, ref reportRows, item); } return reportRows; }
/// <summary> /// Get rows for the report /// </summary> /// <param name="columns"></param> /// <param name="filterNode"></param> public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); int rntContactId = 0, rntIncidentId = 0; decimal contactOrgID = getContactOrgID(filterNode, out rntContactId); string serial_number = getSerialNumber(filterNode, rntContactId, out rntIncidentId); string active_instance_only = getActiveInstanceFlag(filterNode); Item[] items = Item.LookupItemList(serial_number, contactOrgID, active_instance_only, rntIncidentId, rntContactId); foreach (Item item in items) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (item != null) { addItem(ref columns, ref reportDataRow, ref reportRows, item); } } return(reportRows); }
public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { decimal hiddenInstanceId = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenInstanceId", true); if (null != filter_value) { hiddenInstanceId = Convert.ToDecimal(filter_value); } IList<IReportRow> reportRows = new List<IReportRow>(); Entitlement[] entitlements = Entitlement.LookupEntitlementList(hiddenInstanceId, getValidateFlag(filterNode)); foreach (Entitlement e in entitlements) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (e != null) { addItem(ref columns, ref reportDataRow, ref reportRows, e); } } return reportRows; }
public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { decimal hiddenInstanceId = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenInstanceId", true); if (null != filter_value) { hiddenInstanceId = Convert.ToDecimal(filter_value); } IList <IReportRow> reportRows = new List <IReportRow>(); Entitlement[] entitlements = Entitlement.LookupEntitlementList(hiddenInstanceId, getValidateFlag(filterNode)); foreach (Entitlement e in entitlements) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (e != null) { addItem(ref columns, ref reportDataRow, ref reportRows, e); } } 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 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); }
/* For showing the EBS Contact Details. * It can also be run in Report Explorer by creating a required filter on PERSON_PARTY_ID */ 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; Dictionary <string, string> dictDetail = null; String partyID = ""; // for running standalone report (from Report Explorer) if (_context == null) { // filter is PERSON_PARTY_ID if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode partyIDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.PERSON_PARTY_ID", this.Parent.Name, this.Name)); if (partyIDFilterNode != null) { partyID = partyIDFilterNode.ReportFilter.Value; System.Diagnostics.Debug.WriteLine(partyIDFilterNode.ReportFilter.OperatorType.ToString()); } } if (partyID == "" || partyID == null) { return(reportRows); } dictDetail = ContactModel.LookupDetail(Convert.ToInt32(partyID)); } else { IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; int contactPartyID = 0; contactPartyID = getContactPartyIdCustomAttr(contactRecord); if (contactPartyID == 0) { return(reportRows); } string logMessage = "Calling LookupDetail for Contact." + "contactPartyID: " + contactPartyID; ConfigurationSetting.logWrap.DebugLog(0, contactRecord.ID, logMessage: logMessage); // call EBS Contact.LookupDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = ContactModel.LookupDetail(contactPartyID, 0, contactRecord.ID); } if (dictDetail.Count == 0) { return(reportRows); } ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(ref dictDetail, ref columns, ref reportDataRow, ref reportRows); return(reportRows); }
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); }
/* For showing the EBS Contact Details. * It can also be run in Report Explorer by creating a required filter on PERSON_PARTY_ID */ 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; Dictionary<string, string> dictDetail = null; String partyID = ""; // for running standalone report (from Report Explorer) if (_context == null) { // filter is PERSON_PARTY_ID if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode partyIDFilterNode = filterNode.FilterNodes.ToList<IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.PERSON_PARTY_ID", this.Parent.Name, this.Name)); if (partyIDFilterNode != null) { partyID = partyIDFilterNode.ReportFilter.Value; System.Diagnostics.Debug.WriteLine(partyIDFilterNode.ReportFilter.OperatorType.ToString()); } } if (partyID == "" || partyID == null) return reportRows; dictDetail = ContactModel.LookupDetail(Convert.ToInt32(partyID)); } else { IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; int contactPartyID = 0; contactPartyID = getContactPartyIdCustomAttr(contactRecord); if (contactPartyID == 0) return reportRows; string logMessage = "Calling LookupDetail for Contact." + "contactPartyID: " + contactPartyID; ConfigurationSetting.logWrap.DebugLog(0, contactRecord.ID, logMessage: logMessage); // call EBS Contact.LookupDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = ContactModel.LookupDetail(contactPartyID, 0, contactRecord.ID); } if (dictDetail.Count == 0) return reportRows; ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(ref dictDetail, ref columns, ref reportDataRow, ref reportRows); 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); }
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; }
// 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 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; } }
/* this method is called from framework to show the report row (data) * It combines the incident report (ConfigurationSetting.incidentsByContactReportID) * and the ServiceRequest.LookupSRbyContactPartyID(contactPartyID) * Currently this list is only showing certain fields (because of combining 2 lists with common fields) * The Right Now incidents by a contact report is hidden, meaning the Report control of a contact * workspace tab is based on the EBS Service Request List Table report definition * Also, do not change the default column heading of Right Now incidents by a contact report * (they are hard coded to uppercase). Because they are hidden anyway. * The EBS Service Request List Table report definition column headings can be changed and those are * the ones being displayed. */ public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { IList<IReportRow> reportRows = new List<IReportRow>(); IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; if (_context == null) return reportRows; IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; /* report framework refresh every 30 sec (default) even though the tab is not active * so need to check contactRecord for null (when the editor is different) */ if (contactRecord == null) return reportRows; int contactPartyID = 0; // get the ebs contact party custom attribute on the contact workspace contactPartyID = getContactPartyIdCustomAttr(contactRecord); // following to get the rNow incidents report and filter is the rNow contactID AnalyticsReport reportIncident = new AnalyticsReport(); ID rId = new ID(); rId.id = ConfigurationSetting.incidentsByContactReportID; rId.idSpecified = true; reportIncident.ID = rId; byte[] outByte = new byte[1000]; AnalyticsReportFilter[] filter = new AnalyticsReportFilter[3]; filter[0] = new AnalyticsReportFilter(); String[] filterString = new String[1]; filterString[0] = "" + contactRecord.ID; filter[0].Values = filterString; filter[0].Name = "Contact"; // incidents by a contact, thus Contact filter NamedID datatype = new NamedID(); datatype.Name = "Integer"; filter[0].DataType = datatype; reportIncident.Filters = filter; ClientInfoHeader _cih = new ClientInfoHeader(); _cih.AppID = "Accelerator Report Add-In"; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); CSVTableSet tableSet = ConfigurationSetting.client.RunAnalyticsReport( _cih, reportIncident, 100, 0, "\t", false, false, out outByte ); stopwatch.Stop(); string logMessage = "Called RightNowSyncPortClient.RunAnalyticsReport." + "reportID: " + ConfigurationSetting.incidentsByContactReportID; ConfigurationSetting.logWrap.DebugLog(0, contactRecord.ID, logMessage: logMessage, timeElapsed:(int)stopwatch.ElapsedMilliseconds); CSVTable[] csvTables = tableSet.CSVTables; CSVTable table = csvTables[0]; string[] rowData = table.Rows; int rNowIncidentCount = table.Rows.Length; int srVirtualTableCount = this.Columns.Count; string[] colHeadingIncidentReport = table.Columns.Split('\t'); foreach (String commaRow in table.Rows) { ReportDataRow reportDataRow = new ReportDataRow(srVirtualTableCount); string[] colValue = commaRow.Split('\t'); // the report output is stored as <columnHeading, value> Dictionary<string, string> dictRow = new Dictionary<string, string>(); int i = 0; foreach (string val in colValue) { /* make the column heading upper case (because the custom attribute heading * in the report designer sometime all in lower case, sometime the reverse) */ dictRow.Add(colHeadingIncidentReport[i].ToUpper(), val); i++; } addRnowIncidentRow(ref columns, ref reportDataRow, ref reportRows, dictRow); } if (contactPartyID > 0) { ServiceRequest[] sRs = ServiceRequest.LookupSRbyContactPartyID(contactPartyID, 0, contactRecord.ID); foreach (ServiceRequest req in sRs) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (req != null) // live ebs row 316 of 319 of contact 4431 return null addEBSsrRow(ref columns, ref reportDataRow, ref reportRows, req); } } 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); }
/* this method is called from framework to show the report row (data) * It combines the incident report (ConfigurationSetting.incidentsByContactReportID) * and the ServiceRequest.LookupSRbyContactPartyID(contactPartyID) * Currently this list is only showing certain fields (because of combining 2 lists with common fields) * The Right Now incidents by a contact report is hidden, meaning the Report control of a contact * workspace tab is based on the EBS Service Request List Table report definition * Also, do not change the default column heading of Right Now incidents by a contact report * (they are hard coded to uppercase). Because they are hidden anyway. * The EBS Service Request List Table report definition column headings can be changed and those are * the ones being displayed. */ public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; if (_context == null) { return(reportRows); } IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; /* report framework refresh every 30 sec (default) even though the tab is not active * so need to check contactRecord for null (when the editor is different) */ if (contactRecord == null) { return(reportRows); } int contactPartyID = 0; // get the ebs contact party custom attribute on the contact workspace contactPartyID = getContactPartyIdCustomAttr(contactRecord); // following to get the rNow incidents report and filter is the rNow contactID AnalyticsReport reportIncident = new AnalyticsReport(); ID rId = new ID(); rId.id = ConfigurationSetting.incidentsByContactReportID; rId.idSpecified = true; reportIncident.ID = rId; byte[] outByte = new byte[1000]; AnalyticsReportFilter[] filter = new AnalyticsReportFilter[3]; filter[0] = new AnalyticsReportFilter(); String[] filterString = new String[1]; filterString[0] = "" + contactRecord.ID; filter[0].Values = filterString; filter[0].Name = "Contact"; // incidents by a contact, thus Contact filter NamedID datatype = new NamedID(); datatype.Name = "Integer"; filter[0].DataType = datatype; reportIncident.Filters = filter; ClientInfoHeader _cih = new ClientInfoHeader(); _cih.AppID = "Accelerator Report Add-In"; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); CSVTableSet tableSet = ConfigurationSetting.client.RunAnalyticsReport( _cih, reportIncident, 100, 0, "\t", false, false, out outByte ); stopwatch.Stop(); string logMessage = "Called RightNowSyncPortClient.RunAnalyticsReport." + "reportID: " + ConfigurationSetting.incidentsByContactReportID; ConfigurationSetting.logWrap.DebugLog(0, contactRecord.ID, logMessage: logMessage, timeElapsed: (int)stopwatch.ElapsedMilliseconds); CSVTable[] csvTables = tableSet.CSVTables; CSVTable table = csvTables[0]; string[] rowData = table.Rows; int rNowIncidentCount = table.Rows.Length; int srVirtualTableCount = this.Columns.Count; string[] colHeadingIncidentReport = table.Columns.Split('\t'); foreach (String commaRow in table.Rows) { ReportDataRow reportDataRow = new ReportDataRow(srVirtualTableCount); string[] colValue = commaRow.Split('\t'); // the report output is stored as <columnHeading, value> Dictionary <string, string> dictRow = new Dictionary <string, string>(); int i = 0; foreach (string val in colValue) { /* make the column heading upper case (because the custom attribute heading * in the report designer sometime all in lower case, sometime the reverse) */ dictRow.Add(colHeadingIncidentReport[i].ToUpper(), val); i++; } addRnowIncidentRow(ref columns, ref reportDataRow, ref reportRows, dictRow); } if (contactPartyID > 0) { ServiceRequest[] sRs = ServiceRequest.LookupSRbyContactPartyID(contactPartyID, 0, contactRecord.ID); foreach (ServiceRequest req in sRs) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (req != null) // live ebs row 316 of 319 of contact 4431 return null { addEBSsrRow(ref columns, ref reportDataRow, ref reportRows, req); } } } return(reportRows); }
/* For showing the either EBS Service Request Detail data (SrID_) or * open an incident workspace (_IncidentID) based on SrID_ OR _IncidentID * When creating the SR Detail report, specify the filter on HiddenSRconcatIncident_ID * so that the navigation can be determined */ public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { string logMessage; IList <IReportRow> reportRows = new List <IReportRow>(); if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null) { return(reportRows); } // for report linking, define filter RequestID String srID = ""; string[] hiddenSR_Inc = null; string filterValue = null; // filter is HiddenSRconcatIncident_ID if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode srIDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.HiddenSRconcatIncident_ID", this.Parent.Name, this.Name)); filterValue = srIDFilterNode.ReportFilter.Value; if (srIDFilterNode != null) { if (!filterValue.Contains("_")) { filterValue = "_" + filterValue; } //srID = srIDFilterNode.ReportFilter.Value; hiddenSR_Inc = filterValue.Split('_'); srID = hiddenSR_Inc[0]; System.Diagnostics.Debug.WriteLine(srIDFilterNode.ReportFilter.OperatorType.ToString()); } } // [1] is incidentID not null, open the incident WS, and return empty row in the detail report if (hiddenSR_Inc != null && hiddenSR_Inc[1] != "") { logMessage = "Opening Incident WS." + "incidentID: " + hiddenSR_Inc[1]; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage); ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.EditWorkspaceRecord( WorkspaceRecordType.Incident, Convert.ToInt32(hiddenSR_Inc[1]) ); return(reportRows); } if (srID == "") { return(reportRows); } logMessage = "Calling LookupDetail for srID: " + srID;; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage); // call EBS ServiceRequest.LookupDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) Dictionary <string, string> dictSRDetail = ServiceRequest.LookupDetail(Convert.ToInt32(srID), null); ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(ref dictSRDetail, ref columns, ref reportDataRow, ref reportRows); 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); }
/* For showing the either EBS Service Request Detail data (SrID_) or * open an incident workspace (_IncidentID) based on SrID_ OR _IncidentID * When creating the SR Detail report, specify the filter on HiddenSRconcatIncident_ID * so that the navigation can be determined */ public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { string logMessage; IList<IReportRow> reportRows = new List<IReportRow>(); if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null) return reportRows; // for report linking, define filter RequestID String srID = ""; string[] hiddenSR_Inc = null; string filterValue = null; // filter is HiddenSRconcatIncident_ID if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode srIDFilterNode = filterNode.FilterNodes.ToList<IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.HiddenSRconcatIncident_ID", this.Parent.Name, this.Name)); filterValue = srIDFilterNode.ReportFilter.Value; if (srIDFilterNode != null) { if (!filterValue.Contains("_")) { filterValue = "_" + filterValue; } //srID = srIDFilterNode.ReportFilter.Value; hiddenSR_Inc = filterValue.Split('_'); srID = hiddenSR_Inc[0]; System.Diagnostics.Debug.WriteLine(srIDFilterNode.ReportFilter.OperatorType.ToString()); } } // [1] is incidentID not null, open the incident WS, and return empty row in the detail report if (hiddenSR_Inc != null && hiddenSR_Inc[1] != "") { logMessage = "Opening Incident WS." + "incidentID: " + hiddenSR_Inc[1]; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage); ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.EditWorkspaceRecord( WorkspaceRecordType.Incident, Convert.ToInt32(hiddenSR_Inc[1]) ); return reportRows; } if (srID == "") return reportRows; logMessage = "Calling LookupDetail for srID: " + srID; ; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage); // call EBS ServiceRequest.LookupDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) Dictionary<string, string> dictSRDetail = ServiceRequest.LookupDetail(Convert.ToInt32(srID), null); ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow (ref dictSRDetail, ref columns, ref reportDataRow, ref reportRows); 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; } }
/// <summary> /// Gets rows for the report /// </summary> /// <param name="columns"></param> /// <param name="filterNode"></param> public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { IList<IReportRow> reportRows = new List<IReportRow>(); int rntContactId = 0, rntIncidentId = 0; decimal contact_id = getContactID(filterNode, out rntContactId); //check if ebs contact id is present switch (String.Format("{0:0}", contact_id)) { case "-1": return reportRows; } //get ebs incident id decimal incident_id = getIncidentID(filterNode, rntContactId, out rntIncidentId); RepairOrder[] items = RepairOrder.LookupRepairOrderList(contact_id, incident_id, rntIncidentId, rntContactId); foreach (RepairOrder item in items) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); if (item != null) addItem(ref columns, ref reportDataRow, ref reportRows, item); } 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; }