コード例 #1
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);
        }