/// <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; }
/// <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); }