示例#1
0
        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);
        }
示例#2
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>();

            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);
        }
        /*  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;
        }
示例#4
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);
        }
示例#5
0
        /*  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);
        }
示例#6
0
        // Add Siebel Service Request row
        private void addSiebelSrRow(ref IList <string> columns, ref ReportDataRow reportDataRow, ref IList <IReportRow> reportRows, Hashtable srHashtable, ServiceRequest req)
        {
            bool srInRnow = false;

            foreach (var column in columns)
            {
                ReportDataCell reportDataCell = new ReportDataCell();

                switch (column)
                {
                case "Siebel$SRlistTable.SrNumber":
                    reportDataCell.GenericValue = req.RequestNumber;
                    if (srHashtable.ContainsKey(req.RequestNumber))
                    {
                        srInRnow = true;
                    }
                    break;

                case "Siebel$SRlistTable.Status":
                    reportDataCell.GenericValue = req.Status;
                    break;

                case "Siebel$SRlistTable.Summary":
                    reportDataCell.GenericValue = req.Summary;
                    break;

                case "Siebel$SRlistTable.Created":
                    reportDataCell.GenericValue = req.RequestDate;
                    break;

                case "Siebel$SRlistTable.IncidentRef":
                    reportDataCell.GenericValue = "";
                    break;

                case "Siebel$SRlistTable.HiddenSRconcatIncident_ID":
                    reportDataCell.GenericValue = req.RequestID + "_";
                    break;
                }
                reportDataRow.Cells.Add(reportDataCell);
            }
            if (!srInRnow)
            {
                reportRows.Add(reportDataRow);
                srInRnow = false;
            }
        }
        /*  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);
        }
        // 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 "Siebel$SRlistTable.SrNumber":
                            heading = "SIEBEL_SR_NUM";
                            reportDataCell.GenericValue = colValue[heading];
                            break;
                        case "Siebel$SRlistTable.IncidentRef":
                            heading = "REFERENCE #";
                            reportDataCell.GenericValue = colValue[heading];
                            break;
                        case "Siebel$SRlistTable.Created":
                            heading = "DATE CREATED";
                            dateTimeString = colValue[heading];
                            // remove the single '
                            dateTimeString = dateTimeString.TrimStart('\'');
                            dateTimeString = dateTimeString.TrimEnd('\'');
                            reportDataCell.GenericValue = Convert.ToDateTime(dateTimeString);
                            break;
                        case "Siebel$SRlistTable.Summary":
                            heading = "SUBJECT";
                            reportDataCell.GenericValue = colValue[heading];
                            break;
                        case "Siebel$SRlistTable.Status":
                            heading = "STATUS";
                            reportDataCell.GenericValue = colValue[heading];
                            break;
                        case "Siebel$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)
         *  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;
        }
        /*  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;
        }
        /*  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;
        }
        /*  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;
        }
示例#13
0
        // add Right Now Incident report row
        private void addRnowIncidentRow(ref IList <string> columns, ref ReportDataRow reportDataRow,
                                        ref IList <IReportRow> reportRows, ref Hashtable srHashtable, Dictionary <string, string> colValue)
        {
            string heading        = null;
            string dateTimeString = null;

            try
            {
                foreach (var column in columns)
                {
                    ReportDataCell reportDataCell = new ReportDataCell();
                    switch (column)
                    {
                    case "Siebel$SRlistTable.SrNumber":
                        heading = "SIEBEL_SR_NUM";
                        reportDataCell.GenericValue = colValue[heading];
                        if (!String.IsNullOrEmpty(colValue[heading]))
                        {
                            srHashtable.Add(colValue[heading], true);
                        }
                        break;

                    case "Siebel$SRlistTable.IncidentRef":
                        heading = "REFERENCE #";
                        reportDataCell.GenericValue = colValue[heading];
                        break;

                    case "Siebel$SRlistTable.Created":
                        heading        = "DATE CREATED";
                        dateTimeString = colValue[heading];
                        // remove the single '
                        dateTimeString = dateTimeString.TrimStart('\'');
                        dateTimeString = dateTimeString.TrimEnd('\'');
                        reportDataCell.GenericValue = Convert.ToDateTime(dateTimeString);
                        break;

                    case "Siebel$SRlistTable.Summary":
                        heading = "SUBJECT";
                        reportDataCell.GenericValue = colValue[heading];
                        break;

                    case "Siebel$SRlistTable.Status":
                        heading = "STATUS";
                        reportDataCell.GenericValue = colValue[heading];
                        break;

                    case "Siebel$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;
            }
        }
示例#14
0
        /*  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');
            Hashtable srHashtable = new Hashtable();

            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, ref srHashtable, 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, srHashtable, req);
                    }
                }
            }
            return(reportRows);
        }
        // Add Siebel Service Request row
        private void addSiebelSrRow(ref IList<string> columns, ref ReportDataRow reportDataRow, ref  IList<IReportRow> reportRows, Hashtable srHashtable, ServiceRequest req)
        {
            bool srInRnow = false;

            foreach (var column in columns)
            {
                ReportDataCell reportDataCell = new ReportDataCell();

                switch (column)
                {
                    case "Siebel$SRlistTable.SrNumber":
                        reportDataCell.GenericValue = req.RequestNumber;
                        if (srHashtable.ContainsKey(req.RequestNumber))
                            srInRnow = true;
                        break;
                    case "Siebel$SRlistTable.Status":
                        reportDataCell.GenericValue = req.Status;
                        break;
                    case "Siebel$SRlistTable.Summary":
                        reportDataCell.GenericValue = req.Summary;
                        break;
                    case "Siebel$SRlistTable.Created":
                        reportDataCell.GenericValue = req.RequestDate;
                        break;
                    case "Siebel$SRlistTable.IncidentRef":
                        reportDataCell.GenericValue = "";
                        break;
                    case "Siebel$SRlistTable.HiddenSRconcatIncident_ID":
                        reportDataCell.GenericValue = req.RequestID + "_";
                        break;
                }
                reportDataRow.Cells.Add(reportDataCell);
            }
            if (!srInRnow)
            {
                reportRows.Add(reportDataRow);
                srInRnow = false;
            }
        }
示例#16
0
        // Add Siebel Service Request row
        private void addSiebelSrRow(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 "Siebel$SRlistTable.SrNumber":
                        reportDataCell.GenericValue = req.RequestNumber;
                        break;
                    case "Siebel$SRlistTable.Status":
                        reportDataCell.GenericValue = req.Status;
                        break;
                    case "Siebel$SRlistTable.Summary":
                        reportDataCell.GenericValue = req.Summary;
                        break;
                    case "Siebel$SRlistTable.Created":
                        reportDataCell.GenericValue = req.RequestDate;
                        break;
                    case "Siebel$SRlistTable.IncidentRef":
                        reportDataCell.GenericValue = "";
                        break;
                    case "Siebel$SRlistTable.HiddenSRconcatIncident_ID":
                        reportDataCell.GenericValue = req.RequestID + "_";
                        break;
                }
                reportDataRow.Cells.Add(reportDataCell);
            }
            reportRows.Add(reportDataRow);
        }
示例#17
0
        // used by SR and Contact Details, and null check before doing Convert.
        protected void addDetailRow(Dictionary<string, string> dictDetail, ref IList<string> columns, ref ReportDataRow reportDataRow, ref  IList<IReportRow> reportRows)
        {
            foreach (string column in columns)
            {
                ReportDataCell reportDataCell = new ReportDataCell();
                // put the "Siebel$SRDetailTable." package name back, that's required by the report framework
                string pkgNtblName = "Siebel$" + this.Name + ".";
                string removePkgTblName = column.Replace(pkgNtblName, "");
                string[] typeValArray = Regex.Split(dictDetail[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 != "" && !val.Contains("1/1/0001"))
                            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);
        }
        /*  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;
        }
示例#19
0
 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);
 }
示例#20
0
        // used by SR and Contact Details, and null check before doing Convert.
        protected void addDetailRow(Dictionary <string, string> dictDetail, ref IList <string> columns, ref ReportDataRow reportDataRow, ref IList <IReportRow> reportRows)
        {
            foreach (string column in columns)
            {
                ReportDataCell reportDataCell = new ReportDataCell();
                // put the "Siebel$SRDetailTable." package name back, that's required by the report framework
                string   pkgNtblName      = "Siebel$" + this.Name + ".";
                string   removePkgTblName = column.Replace(pkgNtblName, "");
                string[] typeValArray     = Regex.Split(dictDetail[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 != "" && !val.Contains("1/1/0001"))
                    {
                        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);
        }
示例#21
0
        /*  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);
        }