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); }
/* For showing the Siebel 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 (((SiebelVirtualReportTablesPackage)this.Parent)._globalContext == null) { return(reportRows); } IRecordContext _context = ((SiebelVirtualReportTablesPackage)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(columns, partyID); } else { IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; string contactPartyID = ""; contactPartyID = getContactPartyIdCustomAttr(contactRecord); if (contactPartyID == "") { return(reportRows); } string logMessage = "Calling LookupDetail for Contact." + "contactPartyID: " + contactPartyID; ConfigurationSetting.logWrap.DebugLog(0, contactRecord.ID, logMessage: logMessage); // call Siebel Contact.LookupDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = ContactModel.LookupDetail(columns, contactPartyID, 0, contactRecord.ID); } ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); 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); }
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 Siebel Activity 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>(); IRecordContext _context = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; List<Dictionary<string, string>> dictDetailList = null; if (_context == null) return reportRows; IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; string siebelSrId = null; if (incidentRecord != null) { siebelSrId = getIncidentWSCustomAttr(incidentRecord, "siebel_sr_id"); } if (siebelSrId == "" || siebelSrId == null) return reportRows; string logMessage = "Calling LookupActivityList for a Siebel SR." + "siebelSrId: " + siebelSrId; ConfigurationSetting.logWrap.DebugLog(incidentRecord.ID, 0, logMessage: logMessage); // call Siebel Activity.LookupActivityList, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetailList = Activity.LookupActivityList(columns, siebelSrId, incidentRecord.ID, 0); if (dictDetailList == null) return reportRows; foreach (Dictionary<string, string> dictDetail in dictDetailList) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); } return reportRows; }
/* For showing the either Siebel 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 (((SiebelVirtualReportTablesPackage)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); ((SiebelVirtualReportTablesPackage)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 Siebel ServiceRequest.LookupDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) Dictionary<string, string> dictSRDetail = ServiceRequest.LookupDetail(columns, srID); ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow (dictSRDetail, ref columns, ref reportDataRow, ref reportRows); 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; }
private decimal getContactID(IReportFilterNode filterNode, out int rntContactId) { IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; string logMessage; string logNote; if (null != _context) { WorkspaceRecordType workspaceType = _context.WorkspaceType; if ((workspaceType == WorkspaceRecordType.Incident) || (workspaceType == WorkspaceRecordType.Contact)) { IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; if (null != contactRecord) { IList <ICustomAttribute> customAttributes = contactRecord.CustomAttributes; rntContactId = contactRecord.ID; object val = CustomAttrHelper.fetchCustomAttrValue(customAttributes, new string[] { "Accelerator$ebs_contact_party_id" }, 0, rntContactId) ["Accelerator$ebs_contact_party_id"]; if (null == val) { logMessage = "Provide an EBS Contact ID to search for Repair Orders. No search performed."; logNote = null; ConfigurationSetting.logWrap.DebugLog(0, rntContactId, logMessage, logNote); return(-1); } else if (Convert.ToDecimal(val) <= 0) { logMessage = "Provide a valid EBS Contact ID to search for Repair Orders. No search performed for ebs_contact_party_id " + val; logNote = null; ConfigurationSetting.logWrap.DebugLog(0, rntContactId, logMessage, logNote); return(-1); } else { return(Convert.ToDecimal(val)); } } } } rntContactId = 0; decimal contact_id = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenContactID", true); if (null != filter_value) { contact_id = Convert.ToDecimal(filter_value); } if (contact_id > 0) { return(contact_id); } logMessage = "Provide a valid EBS Contact ID to search for Repair Orders. Ignoring ebs_contact_party_id " + contact_id; logNote = null; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); return(0); }
/* For showing the Siebel 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>(); IRecordContext _context = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; Dictionary <string, string> dictDetail = null; if (_context == null) { return(reportRows); } IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; if (incidentRecord == null) { return(reportRows); } string serialNum = null; // get the serialNum custom attribute on the incident workspace serialNum = getIncidentWSCustomAttr(incidentRecord, "siebel_serial_number"); if (serialNum == "" || serialNum == null) { return(reportRows); } string logMessage = "Calling LookupAsset for Asset." + "serialNum: " + serialNum; ConfigurationSetting.logWrap.DebugLog(incidentRecord.ID, 0, logMessage: logMessage); string orgId = null; IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; if (contactRecord != null) { orgId = getContactOrgIdCustomAttr(contactRecord); } if (orgId == "" || orgId == null) { return(reportRows); } // call Siebel Asset.LookupAsset, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = Asset.LookupAsset(columns, serialNum, orgId, 0, incidentRecord.ID); if (dictDetail == null) { return(reportRows); } ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); 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; }
/* For showing the Siebel Activity 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>(); IRecordContext _context = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; Dictionary <string, string> dictDetail = null; if (_context == null) { return(reportRows); } String actvtyId = ""; string filterValue = null; // filter is ActivityId if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode actvtyIDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ActivityId", this.Parent.Name, this.Name)); if (actvtyIDFilterNode != null) { actvtyId = actvtyIDFilterNode.ReportFilter.Value; } } IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; string siebelSrId = null; if (incidentRecord != null) { siebelSrId = getIncidentWSCustomAttr(incidentRecord, "siebel_sr_id"); } if (siebelSrId == "" || siebelSrId == null) { return(reportRows); } string logMessage = "Calling LookupActivityDetail for a Siebel SR." + "siebelSrId: " + siebelSrId + ", actvtyId: " + actvtyId; ConfigurationSetting.logWrap.DebugLog(incidentRecord.ID, 0, logMessage: logMessage); // call Siebel Activity.LookupActivityDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = Activity.LookupActivityDetail(columns, siebelSrId, actvtyId, incidentRecord.ID, 0); if (dictDetail == null) { return(reportRows); } ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); return(reportRows); }
public override IList <IReportRow2> GetRows(IList <string> columns, IReportFilterNode filterNode) { Stopwatch clickLogStopwatch = new Stopwatch(); clickLogStopwatch.Start(); IList <IReportRow2> reportRows = getRows(columns, filterNode); clickLogStopwatch.Stop(); ConfigurationSetting.logWrap.ClickLog(0, 0, "SrmRepliesListVirtualTable report AddIn GetRows() total time:", null, (int)clickLogStopwatch.ElapsedMilliseconds); return(reportRows); }
private string getValidateFlag(IReportFilterNode filterNode) { string flag = ""; object filter_value = getEqualsFilterValue(filterNode, "HiddenValidateFlag", false); if (null != filter_value) { flag = Convert.ToString(filter_value); } if (!String.IsNullOrEmpty(flag)) { return flag; } return "F"; }
private string getValidateFlag(IReportFilterNode filterNode) { string flag = ""; object filter_value = getEqualsFilterValue(filterNode, "HiddenValidateFlag", false); if (null != filter_value) { flag = Convert.ToString(filter_value); } if (!String.IsNullOrEmpty(flag)) { return(flag); } return("F"); }
/* For showing the Siebel 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>(); IRecordContext _context = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; Dictionary<string, string> dictDetail = null; if (_context == null) return reportRows; IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; if (incidentRecord == null) return reportRows; string serialNum= null; // get the serialNum custom attribute on the incident workspace serialNum = getIncidentWSCustomAttr(incidentRecord, "siebel_serial_number"); if (serialNum == "" || serialNum == null) return reportRows; string logMessage = "Calling LookupAsset for Asset." + "serialNum: " + serialNum; ConfigurationSetting.logWrap.DebugLog(incidentRecord.ID, 0, logMessage: logMessage); string orgId = null; IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; if (contactRecord != null) { orgId = getContactOrgIdCustomAttr(contactRecord); } if (orgId == "" || orgId == null) return reportRows; // call Siebel Asset.LookupAsset, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = Asset.LookupAsset(columns, serialNum, orgId, 0, incidentRecord.ID); if (dictDetail == null) return reportRows; ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); 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; }
/* For showing the Siebel 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>(); IRecordContext _context = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; List <Dictionary <string, string> > dictDetailList = null; if (_context == null) { return(reportRows); } IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; string siebelContactId = null; if (contactRecord != null) { siebelContactId = getContactPartyIdCustomAttr(contactRecord); } if (siebelContactId == "" || siebelContactId == null) { return(reportRows); } string logMessage = "Calling LookupAssetList for a Siebel Contact." + "siebelContactId: " + siebelContactId; ConfigurationSetting.logWrap.DebugLog(0, contactRecord.ID, logMessage: logMessage); // call Siebel Asset.LookupAssetList, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetailList = Asset.LookupAssetList(columns, siebelContactId, 0, contactRecord.ID); if (dictDetailList == null) { return(reportRows); } foreach (Dictionary <string, string> dictDetail in dictDetailList) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); } return(reportRows); }
/* For showing the Siebel Activity 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>(); IRecordContext _context = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; Dictionary<string, string> dictDetail = null; if (_context == null) return reportRows; String actvtyId = ""; string filterValue = null; // filter is ActivityId if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode actvtyIDFilterNode = filterNode.FilterNodes.ToList<IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ActivityId", this.Parent.Name, this.Name)); if (actvtyIDFilterNode != null) actvtyId = actvtyIDFilterNode.ReportFilter.Value; } IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; string siebelSrId = null; if (incidentRecord != null) { siebelSrId = getIncidentWSCustomAttr(incidentRecord, "siebel_sr_id"); } if (siebelSrId == "" || siebelSrId == null) return reportRows; string logMessage = "Calling LookupActivityDetail for a Siebel SR." + "siebelSrId: " + siebelSrId + ", actvtyId: " + actvtyId; ConfigurationSetting.logWrap.DebugLog(incidentRecord.ID, 0, logMessage: logMessage); // call Siebel Activity.LookupActivityDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) dictDetail = Activity.LookupActivityDetail(columns,siebelSrId, actvtyId, incidentRecord.ID, 0); if (dictDetail == null) return reportRows; ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictDetail, ref columns, ref reportDataRow, ref reportRows); 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; }
/// <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); }
private decimal getIncidentID(IReportFilterNode filterNode, int rntContactId, out int rntIncidentId) { IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; if (null != _context) { WorkspaceRecordType workspaceType = _context.WorkspaceType; if (workspaceType == WorkspaceRecordType.Incident) { IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; if (null != incidentRecord) { IList <ICustomAttribute> customAttributes = incidentRecord.CustomAttributes; rntIncidentId = incidentRecord.ID; object val = CustomAttrHelper.fetchCustomAttrValue(customAttributes, new string[] { "Accelerator$ebs_sr_id" }, rntIncidentId, rntContactId) ["Accelerator$ebs_sr_id"]; return((null != val) ? Convert.ToDecimal(val) : 0); } } } decimal incident_id = 0; rntIncidentId = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenIncidentID", false); if (null != filter_value) { incident_id = Convert.ToDecimal(filter_value); } if (incident_id > 0) { return(incident_id); } string logMessage = "Provide a valid EBS Incident ID to search for Repair Orders. Ignoring ebs_sr_id " + incident_id; string logNote = null; ConfigurationSetting.logWrap.DebugLog(rntIncidentId, 0, logMessage, logNote); return(0); }
/// <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) { 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); }
protected object getEqualsFilterValue(IReportFilterNode filterNode, string filter_name, bool is_mandatory) { string mandatory = is_mandatory ? "This is a required filter. " : ""; string logMessage, logNote; if ((null == filterNode) || (null == filterNode.FilterNodes)) { if (is_mandatory) { logMessage = this.Name + " is missing the filter " + filter_name; logNote = mandatory + "Alternatively, you may want to read filter values from the workspace."; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); } return(null); } IReportFilterNode node = filterNode.FilterNodes.ToList <IReportFilterNode>() .Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}." + filter_name, this.Parent.Name, this.Name)); if (null == node) { if (is_mandatory) { logMessage = this.Name + " is missing the required filter " + filter_name; logNote = mandatory + "Alternatively, you may want to read this value from the workspace."; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); } return(null); } if (ReportFilterOperatorType.Equals != node.ReportFilter.OperatorType) { logMessage = this.Name + " requires an Equals operator on the filter " + filter_name; logNote = mandatory + Convert.ToString(node.ReportFilter.OperatorType) + " operator found on " + node.ReportFilter.Expression; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); return(null); } return(node.ReportFilter.Value); }
private string getSerialNumber(IReportFilterNode filterNode, int rntContactId, out int rntIncidentId) { IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; if (null != _context) { WorkspaceRecordType workspaceType = _context.WorkspaceType; if (workspaceType == WorkspaceRecordType.Incident) { IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; if (null != incidentRecord) { IList <ICustomAttribute> customAttributes = incidentRecord.CustomAttributes; rntIncidentId = incidentRecord.ID; object val = CustomAttrHelper.fetchCustomAttrValue(customAttributes, new string[] { "Accelerator$ebs_serial_number" }, rntIncidentId, rntContactId) ["Accelerator$ebs_serial_number"]; return((null != val) ? val.ToString() : ""); } } } string serial_number = ""; rntIncidentId = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenSerialNumber", true); if (null != filter_value) { serial_number = Convert.ToString(filter_value); } if (!String.IsNullOrWhiteSpace(serial_number)) { return(serial_number); } return(""); }
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; }
/* this method is called from framework to show the report row (data) * refer to QA 140910-000144 for the story * 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 Siebel 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 Siebel 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 = ((SiebelVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; if (_context == null) return reportRows; IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; /* if auto refresh every x sec is enabled even though the tab is not active * so need to check contactRecord for null (when the editor is different) */ if (contactRecord == null) return reportRows; string contactPartyID = null; // 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 != null) { ServiceRequest[] sRs = ServiceRequest.LookupSRbyContactPartyID(columns, contactPartyID, 0, contactRecord.ID); if (sRs == null) return reportRows; 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 addSiebelSrRow(ref columns, ref reportDataRow, ref reportRows, req); } } 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 Siebel 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 (((SiebelVirtualReportTablesPackage)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); ((SiebelVirtualReportTablesPackage)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 Siebel ServiceRequest.LookupDetail, which return <columnName, type+TYPE_VALUE_DELIMITER+value) Dictionary <string, string> dictSRDetail = ServiceRequest.LookupDetail(columns, srID); ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); addDetailRow(dictSRDetail, ref columns, ref reportDataRow, ref reportRows); return(reportRows); }
private IList <IReportRow2> getRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow2> reportRows = new List <IReportRow2>(); IRecordContext _context = ((SrmReportTablePackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; IIncident incidentRecord = null; int convId = 0, bundleId = 0; String endpoint = null; if (_context != null) { incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; convId = ConfigurationSetting.getSrmCustomAttr(incidentRecord, "srm_conversation_id"); bundleId = ConfigurationSetting.getSrmCustomAttr(incidentRecord, "srm_bundle_id"); if (convId == 0 || bundleId == 0) { return(reportRows); } } else { if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode convIDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ConversationID", this.Parent.Name, this.Name)); if (convIDFilterNode != null) { convId = Convert.ToInt32(convIDFilterNode.ReportFilter.Value); } if (convId == 0) { return(reportRows); } IReportFilterNode bundleIDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.BundleID", this.Parent.Name, this.Name)); if (bundleIDFilterNode != null) { bundleId = Convert.ToInt32(bundleIDFilterNode.ReportFilter.Value); } } } endpoint = String.Format(ConfigurationSetting.convReplyGETEndpoint, convId, bundleId, ConfigurationSetting.max_srm_rows_fetch); // determine whether to close or re-open a conversation String jsonStr = "{\"status\" : \"active\"}"; HttpContent content = new StringContent(jsonStr, Encoding.UTF8, "application/json"); ConfigurationSetting.logWrap.DebugLog(logMessage: Accelerator.SRM.SharedServices.Properties.Resources.GETRequestMessage, logNote: endpoint); var results = RESTHelper.PerformGET(endpoint, ref ((SrmReportTablePackage)this.Parent)._globalContext); if (results != null) { if (!results.Success) { MessageBox.Show(Properties.Resources.GetRowsError, Properties.Resources.Error); ConfigurationSetting.logWrap.ErrorLog(logMessage: "Response GET Conversation message error", logNote: results.JSON); } var jsonData = results.JSON; if (jsonData == null || jsonData == "") { return(reportRows); } JavaScriptSerializer ser = new JavaScriptSerializer(); RootObject replies = ser.Deserialize <RootObject>(jsonData); foreach (Item req in replies.items) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); object reportDataKey = req.id; foreach (var column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); switch (column) { case "SRM_Data$SrmRepliesListTable.ReplyID": reportDataCell.GenericValue = req.content.id; break; case "SRM_Data$SrmRepliesListTable.liked": reportDataCell.GenericValue = Convert.ToBoolean(req.content.liked); break; case "SRM_Data$SrmRepliesListTable.likesCount": reportDataCell.GenericValue = Convert.ToInt32(req.content.likesCount); break; case "SRM_Data$SrmRepliesListTable.authorName": reportDataCell.GenericValue = req.content.author.name; break; case "SRM_Data$SrmRepliesListTable.authorImage": reportDataCell.GenericValue = req.content.author.authorImage; break; case "SRM_Data$SrmRepliesListTable.attachmentType": reportDataCell.GenericValue = req.content.attachments != null ? req.content.attachments[0].type : null; break; case "SRM_Data$SrmRepliesListTable.attachmentUrl": reportDataCell.GenericValue = req.content.attachments != null ? req.content.attachments[0].url : null; break; case "SRM_Data$SrmRepliesListTable.authorProfileUrl": reportDataCell.GenericValue = req.content.author.authorProfileUrl; break; case "SRM_Data$SrmRepliesListTable.externalId": reportDataCell.GenericValue = req.content.externalId; break; case "SRM_Data$SrmRepliesListTable.type": reportDataCell.GenericValue = req.content.type; break; case "SRM_Data$SrmRepliesListTable.postedAt": DateTime utcTime = DateTime.Parse(req.content.postedAt); DateTime localTime = utcTime.ToLocalTime(); reportDataCell.GenericValue = localTime != null?localTime.ToString() : ""; break; case "SRM_Data$SrmRepliesListTable.status": reportDataCell.GenericValue = req.content.status; break; case "SRM_Data$SrmRepliesListTable.body": reportDataCell.GenericValue = req.content.body; break; case "SRM_Data$SrmRepliesListTable.labels": if (req.content.labels.Count == 0) { reportDataCell.GenericValue = "No Value"; } else { foreach (String label in req.content.labels) { reportDataCell.GenericValue += ", " + label; } } break; } reportDataRow.Cells.Add(reportDataCell); } //Please set the Key, it is necessary to edit report cell reportDataRow.Key = reportDataKey; 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); }
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); }
/* 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); }
private decimal getIncidentID(IReportFilterNode filterNode, int rntContactId, out int rntIncidentId) { IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; if (null != _context) { WorkspaceRecordType workspaceType = _context.WorkspaceType; if (workspaceType == WorkspaceRecordType.Incident) { IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; if (null != incidentRecord) { IList<ICustomAttribute> customAttributes = incidentRecord.CustomAttributes; rntIncidentId = incidentRecord.ID; object val = CustomAttrHelper.fetchCustomAttrValue(customAttributes, new string[] { "Accelerator$ebs_sr_id" }, rntIncidentId, rntContactId) ["Accelerator$ebs_sr_id"]; return (null != val) ? Convert.ToDecimal(val) : 0; } } } decimal incident_id = 0; rntIncidentId = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenIncidentID", false); if (null != filter_value) { incident_id = Convert.ToDecimal(filter_value); } if (incident_id > 0) { return incident_id; } string logMessage = "Provide a valid EBS Incident ID to search for Repair Orders. Ignoring ebs_sr_id " + incident_id; string logNote = null; ConfigurationSetting.logWrap.DebugLog(rntIncidentId, 0, logMessage, logNote); return 0; }
/// <summary> /// Overriden method responsible for populating a report with opportunity data /// </summary> /// <param name="columns"></param> /// <param name="filterNode"></param> /// <returns>Rows with opportunity data</returns> public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow> reportRows = new List <IReportRow>(); IRecordContext _context = ((OpportunityReportAddIn.OpportunityReportAddIn) this.Parent)._globalContext.AutomationContext.CurrentWorkspace; List <OpportunityModel> opportunitesList = getOpportunitesList(_context); if (null != opportunitesList) { foreach (OpportunityModel oppData in opportunitesList) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (var column in columns) { var reportDataCell = new ReportDataCell(); switch (column) { case "Opportunity$OSCOpportunity.osc_contact_party_id": reportDataCell.GenericValue = (oppData.KeyContactId != null) ? oppData.KeyContactId.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_account_party_id": reportDataCell.GenericValue = (oppData.SalesAccountId != null) ? oppData.SalesAccountId.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.org_name": reportDataCell.GenericValue = oppData.TargetPartyName ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_id": reportDataCell.GenericValue = oppData.OptyId.ToString(); break; case "Opportunity$OSCOpportunity.osc_op_owner_name": reportDataCell.GenericValue = oppData.PartyName1 ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_owner_email": reportDataCell.GenericValue = oppData.EmailAddress ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_name": reportDataCell.GenericValue = oppData.Name ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_desc": reportDataCell.GenericValue = oppData.Description ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_status": reportDataCell.GenericValue = oppData.StatusCode ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_method": reportDataCell.GenericValue = oppData.SalesMethod ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_stage": reportDataCell.GenericValue = oppData.SalesStage ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_channel": reportDataCell.GenericValue = oppData.SalesChannelCd ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_currency": reportDataCell.GenericValue = oppData.CurrencyCode ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_revenue": reportDataCell.GenericValue = (oppData.Revenue != null) ? oppData.Revenue.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_win_percent": reportDataCell.GenericValue = (oppData.WinProb != null) ? oppData.WinProb + "%" : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_fcst_close_date": reportDataCell.GenericValue = (oppData.ForecastedCloseDate != null) ? oppData.ForecastedCloseDate.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_created_by": reportDataCell.GenericValue = oppData.CreatedBy ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_created": reportDataCell.GenericValue = (oppData.CreationDate != null) ? oppData.CreationDate.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_number": reportDataCell.GenericValue = oppData.OptyNumber ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_contact_name": reportDataCell.GenericValue = oppData.PrimaryContactPartyName ?? OSCOpportunitiesCommon.NoValue; break; } reportDataRow.Cells.Add(reportDataCell); } reportRows.Add(reportDataRow); } } return(reportRows); }
private string getSerialNumber(IReportFilterNode filterNode, int rntContactId, out int rntIncidentId) { IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; if (null != _context) { WorkspaceRecordType workspaceType = _context.WorkspaceType; if (workspaceType == WorkspaceRecordType.Incident) { IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; if (null != incidentRecord) { IList<ICustomAttribute> customAttributes = incidentRecord.CustomAttributes; rntIncidentId = incidentRecord.ID; object val = CustomAttrHelper.fetchCustomAttrValue(customAttributes, new string[] { "Accelerator$ebs_serial_number" }, rntIncidentId, rntContactId) ["Accelerator$ebs_serial_number"]; return (null != val) ? val.ToString() : ""; } } } string serial_number = ""; rntIncidentId = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenSerialNumber", true); if (null != filter_value) { serial_number = Convert.ToString(filter_value); } if (!String.IsNullOrWhiteSpace(serial_number)) { return serial_number; } return ""; }
public abstract IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode node);
protected object getEqualsFilterValue(IReportFilterNode filterNode, string filter_name, bool is_mandatory) { string mandatory = is_mandatory ? "This is a required filter. " : ""; string logMessage, logNote; if ((null == filterNode) || (null == filterNode.FilterNodes)) { if (is_mandatory) { logMessage = this.Name + " is missing the filter " + filter_name; logNote = mandatory + "Alternatively, you may want to read filter values from the workspace."; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); } return null; } IReportFilterNode node = filterNode.FilterNodes.ToList<IReportFilterNode>() .Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}." + filter_name, this.Parent.Name, this.Name)); if (null == node) { if (is_mandatory) { logMessage = this.Name + " is missing the required filter " + filter_name; logNote = mandatory + "Alternatively, you may want to read this value from the workspace."; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); } return null; } if (ReportFilterOperatorType.Equals != node.ReportFilter.OperatorType) { logMessage = this.Name + " requires an Equals operator on the filter " + filter_name; logNote = mandatory + Convert.ToString(node.ReportFilter.OperatorType) + " operator found on " + node.ReportFilter.Expression; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); return null; } return node.ReportFilter.Value; }
private decimal getContactOrgID(IReportFilterNode filterNode, out int rntContactId) { IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; if (null != _context) { WorkspaceRecordType workspaceType = _context.WorkspaceType; if ( (workspaceType == WorkspaceRecordType.Incident) || (workspaceType == WorkspaceRecordType.Contact)) { IContact contactRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact) as IContact; if (null != contactRecord) { IList<ICustomAttribute> customAttributes = contactRecord.CustomAttributes; rntContactId = contactRecord.ID; object val = CustomAttrHelper.fetchCustomAttrValue(customAttributes, new string[] { "Accelerator$ebs_contact_org_id" }, 0, rntContactId) ["Accelerator$ebs_contact_org_id"]; if (null == val) return 0; else return Convert.ToDecimal(val); } } } decimal contact_org_id = 0; rntContactId = 0; object filter_value = getEqualsFilterValue(filterNode, "HiddenContactOrgID", true); if (null != filter_value) { contact_org_id = Convert.ToDecimal(filter_value); } if (contact_org_id > 0) { return contact_org_id; } string logMessage = "Provide a valid EBS Contact Org ID to search for products. Ignoring contact_org_id " + contact_org_id; string logNote = null; ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote); return 0; }
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; }
/// <summary> /// Overriden method responsible for populating a report with opportunity data /// </summary> /// <param name="columns"></param> /// <param name="filterNode"></param> /// <returns>Rows with opportunity data</returns> public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode) { IList<IReportRow> reportRows = new List<IReportRow>(); IRecordContext _context = ((OpportunityReportAddIn.OpportunityReportAddIn)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; List<OpportunityModel> opportunitesList = getOpportunitesList(_context); if (null != opportunitesList) { foreach (OpportunityModel oppData in opportunitesList) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); foreach (var column in columns) { var reportDataCell = new ReportDataCell(); switch (column) { case "Opportunity$OSCOpportunity.osc_contact_party_id": reportDataCell.GenericValue = (oppData.KeyContactId != null) ? oppData.KeyContactId.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_account_party_id": reportDataCell.GenericValue = (oppData.SalesAccountId != null) ? oppData.SalesAccountId.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.org_name": reportDataCell.GenericValue = oppData.TargetPartyName ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_id": reportDataCell.GenericValue = oppData.OptyId.ToString(); break; case "Opportunity$OSCOpportunity.osc_op_owner_name": reportDataCell.GenericValue = oppData.PartyName1 ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_owner_email": reportDataCell.GenericValue = oppData.EmailAddress ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_name": reportDataCell.GenericValue = oppData.Name ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_desc": reportDataCell.GenericValue = oppData.Description ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_status": reportDataCell.GenericValue = oppData.StatusCode ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_method": reportDataCell.GenericValue = oppData.SalesMethod ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_stage": reportDataCell.GenericValue = oppData.SalesStage ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_channel": reportDataCell.GenericValue = oppData.SalesChannelCd ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_currency": reportDataCell.GenericValue = oppData.CurrencyCode ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_revenue": reportDataCell.GenericValue = (oppData.Revenue != null) ? oppData.Revenue.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_win_percent": reportDataCell.GenericValue = (oppData.WinProb != null) ? oppData.WinProb + "%" : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_fcst_close_date": reportDataCell.GenericValue = (oppData.ForecastedCloseDate != null) ? oppData.ForecastedCloseDate.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_created_by": reportDataCell.GenericValue = oppData.CreatedBy ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_created": reportDataCell.GenericValue = (oppData.CreationDate != null) ? oppData.CreationDate.ToString() : OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_op_number": reportDataCell.GenericValue = oppData.OptyNumber ?? OSCOpportunitiesCommon.NoValue; break; case "Opportunity$OSCOpportunity.osc_contact_name": reportDataCell.GenericValue = oppData.PrimaryContactPartyName ?? OSCOpportunitiesCommon.NoValue; break; } 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); }
public abstract IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode node);
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; }