or
public class ViagemInfo{ public int IDEmpresa { get; set; } public int AnoViagem { get; set; } public int IDViagem { get; set; } public int IDConta { get; set; } public List<MotoristaViagemInfo> MotoristasViagem { get; set; }}public class MotoristaViagemInfo{ public int IDMotorista { get; set; } public int Nome { get; set; }} private void LoadData(int IdEmpresa, int AnoViagem, int IdViagem){ ViagemInfo viagemInfo; try { using (PedidoProxy.Pedido svcProxy = new PedidoProxy.Pedido()) { //load the ViagemInfo with a List<MotoristaViagemInfo> viagemInfo = svcProxy.ObterViagemDetalhada(IdEmpresa); } CertificadoViagem reportCertificado = new CertificadoViagem(); reportCertificado.ReportParameters["IdEmpresa"].Value = IdEmpresa; reportCertificado.DataSource = viagemInfo; } catch { throw; }}private void Pie_NeedDataSource(object sender, EventArgs e) { Telerik.Reporting.Processing.Chart chart = sender as Telerik.Reporting.Processing.Chart; //Telerik.Reporting.Chart defChart = (Telerik.Reporting.Chart)chart.ItemDefinition; //Processing.TextBox textBox21 = (defChart.Items["textBox21"] as Processing.TextBox); Telerik.Reporting.Chart chartDef = (Telerik.Reporting.Chart)chart.ItemDefinition; Telerik.Reporting.Charting.ChartSeries series = new Telerik.Reporting.Charting.ChartSeries(); series.Type = ChartSeriesType.Pie; Telerik.Reporting.Charting.ChartLegend legend = new Telerik.Reporting.Charting.ChartLegend(); string CoverDescription; int itemValue; string commandText = string.Empty; SqlConnection connection = new SqlConnection(global::QTaskReporting.Properties.Settings.Default.QTDbConnString); commandText = "SELECT COUNT(*) AS ItemCount, SDesc FROM vwSubTasksAndStatuses where TaskID=" + textBox21.Value + " GROUP BY SDesc"; SqlCommand cmd = new SqlCommand(commandText, connection); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); foreach (DataRow rowView in ds.Tables[0].Rows) { Telerik.Reporting.Charting.ChartSeriesItem seriesItem = new Telerik.Reporting.Charting.ChartSeriesItem(); //The chart Y value will be based on the Value amount seriesItem.YValue = Convert.ToInt32(rowView["ItemCount"]); seriesItem.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid; //The chart item label should be set to the Value amount itemValue = Convert.ToInt32(rowView["ItemCount"]); seriesItem.Label.TextBlock.Text = itemValue.ToString("##"); seriesItem.Label.Appearance.LabelLocation = Telerik.Reporting.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside; seriesItem.Label.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(58)))), ((int)(((byte)(112))))); //Assign the chart item description CoverDescription = rowView["SDesc"].ToString(); seriesItem.Name = CoverDescription.Trim(); //Give the "Shortfall in Cover" chart item an exploded appearance if (seriesItem.Name == "New") { seriesItem.Appearance.Exploded = true; } series.AddItem(seriesItem); } //Display the legend series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels; series.Appearance.Border.Color = System.Drawing.Color.White; series.Appearance.Border.Visible = false; series.Appearance.DiameterScale = .90; series.Appearance.ExplodePercent = 10; chartDef.Series.Clear(); chartDef.Series.Add(series); chartDef.Legend.Appearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.TopRight; }reportBook.Reports(2).PageNumberingStyle = PageNumberingStyle.ResetNumberingAndCount