1

I want to created a master-detail Report.

I have two classes PayStub & Payments that payments have foreignkey of PayStubId.

public class PayStub
{
 public int PayStubId { get; set; }
 public int Code { get; set; }
 public string Name { get; set; }
}
public class Payment
{
 [ForeignKey("PayStub ")]
 public int PayStubId { get; set; }
 public  PayStub PayStub { get; set; }
 public int Amount{ get; set; }
 public string Description{ get; set; }
}

I've tried two ways:

  1. Business object.Insert parent business object & child business object and in wpf.

    report.RegBusinessObject("PayStub", payList); report.RegBusinessObject("Payments", paymentList);

this show master and don't show detail.

  1. DataTable.Insert two DataTable and a relation for this.

in wpf:

report.RegData("PayStub", payList);
report.RegData("Payments", paymentList);

I get error parentkey and childkey are identical.

1 Answer 1

0

I change models like this.

public class PayStub
{
public int PayStubId { get; set; }
public int Code { get; set; }
public string Name { get; set; }
public List<Payment> Payments{ get; set; }
}
public class Payment

{ [ForeignKey("PayStub ")] public int PayStubId { get; set; } public PayStub PayStub { get; set; } public int Amount{ get; set; } public string Description{ get; set; } }

and set payments value in PsyStubList.

and set BusinessObject only for PayStub

report.RegBusinessObject("PayStub", payList);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.