2012-01-17 63 views
1

我希望有人可以幫助這一個,我已經創建了一個自定義對象類,包含多個數據和幾個列表。我通過使用多個SQL查詢和一些C#計算來填充對象。嵌套矩陣內ReportViewer類

在我有以下對象,

private int cell_id; 
    private string cell_name; 
    private string cell_supervisor; 
    private double cell_target; 
    private double cell_routing_target, cell_attended_target, cell_lost_time_target, cell_unaccounted_time_target, cell_absence_target; 
    private List<string> cell_machinists; 
    private List<double> cell_routing_actual, cell_attended_actual, cell_lost_time_actual, cell_unaccounted_time_actual, cell_absence_actual; 
    private List<int> cell_ncr_qty; 
    private List<double> cell_ncr_cost; 
    private List<int> cell_timelost; 

的想法是,我會設置一個CELL_NAME,監事等,然後針對電池我設置人用自己的實際分數。

我打電話,像這樣的對象:

results = new Cell(1, "Cell name 1", 80.00); 
      results.setSupervisor("John Doe"); 
      results.setTargets(90, 90, 7, 3, 6.5); 
      results.setMachinist("Bob Oblong", 76, 98, 0, 1, 2, 0, 0, 1); 
      results.setMachinist("Mary Mask", 72, 91, 0, 1, 2, 0, 0, 1); 
this.CellBindingSource.DataSource = results; 

      this.reportViewer1.RefreshReport(); 

的問題是我怎麼能建立一份報告,列出我想要的格式並在這些細胞中列出的機械師所有單元????

例報告輸出: Report Output Example

滿級以下代碼:

public class Cell 
{ 
    private int cell_id; 
    private string cell_name; 
    private string cell_supervisor; 
    private double cell_target; 
    private double cell_routing_target, cell_attended_target, cell_lost_time_target, cell_unaccounted_time_target, cell_absence_target; 
    private List<string> cell_machinists; 
    private List<double> cell_routing_actual, cell_attended_actual, cell_lost_time_actual, cell_unaccounted_time_actual, cell_absence_actual; 
    private List<int> cell_ncr_qty; 
    private List<double> cell_ncr_cost; 
    private List<int> cell_timelost; 

    public Cell(int id, string name, double target) 
    { 
     cell_id = id; 
     cell_name = name; 
     cell_target = target; 
    } 
    public void setSupervisor(string name){ 
     cell_supervisor = name; 
    } 

    public void setTargets(double routings, double attended, double losttime, double unacccounted, double abscence) 
    { 
     cell_routing_target = routings; 
     cell_attended_target = attended; 
     cell_lost_time_target = losttime; 
     cell_unaccounted_time_target = unacccounted; 
     cell_absence_target = abscence; 
    } 
    public void setMachinist(string name, double routings, double attended, double lost_time, double unaccounted_time, int ncr_qty, double ncr_cost, int time_lost, double absence) 
    { 
     cell_machinists.Add(name); 
     cell_routing_actual.Add(routings); 
     cell_attended_actual.Add(attended); 
     cell_lost_time_actual.Add(lost_time); 
     cell_unaccounted_time_actual.Add(unaccounted_time); 
     cell_ncr_qty.Add(ncr_qty); 
     cell_ncr_cost.Add(ncr_cost); 
     cell_timelost.Add(time_lost); 
     cell_absence_actual.Add(absence); 
    } 


    public string CellName 
    { 
     get { 
      return cell_name; 
     } 
    } 

    public string Supervisor 
    { 
     get 
     { 
      return cell_supervisor; 
     } 
    } 
    public List<string> Machinists 
    { 
     get 
     { 
      return cell_machinists; 
     } 
    } 

} 

回答

1

使用嵌套表和分報告是一個簡短的回答!