The cleanest approach is perhaps to create a ViewModel that contains the
values from AssignmentEmployee and Assignment. The ViewModel can hold
references to the original objects and write data back if necessary.

-Markus

2009/6/24 JimmyJamz <[email protected]>

>
> Good morning,
>
> I have a question regarding object relations and trying to display
> information on a datagrid.
>
> To give a little background on how the objects are currently setup, I
> am dealing with three different classes.  Assignment,
> AssignmentEmployee, and the Employee class.
>
> Essentially we have many Assignments which contain a list of
> AssignmentEmployee's.  The Employee class is essentially a
> "definition" table of all the employee's available.
>
> So the relation from AssignmentEmployee to Assignment is that it
> BelongsTo the AssignmentNumber primary key on the Assignments table.
>
> [BelongsTo("Assignment_Number")]
>        public Assignment Assignment
>        { get; set; }
>
>
> The ultimate goal is to display the Assignment information for a
> specific EmployeeID.
>
> Currently what I am doing is doing a find method on the
> AssignmentEmployee class.
> Ex. BindingList<AssignmentEmployee> blist = new
> BindingList<AssignmentEmployee>(AssignmentEmployee.FindByEmployeeID
> ("ID_1"));
>
> The find method is as follows:
>
> public static IList<AssignmentEmployee> FindByEmployeeID(string
> Employee_ID)
> {
>    return (IList<AssignmentEmployee>)FindAll(typeof
> (AssignmentEmployee), Expression.Eq("Employee.Employee_ID",
> Employee_ID));
>  }
>
>
> When binding the list to the datagridview, I'm looking to display
> other fields from the Assignment class.  When utilizing active record
> objects in the codebehind, normally I would just do
> AssignmentEmployee.Assignment.Field_Name and be able to access the
> value on the Assignment table, but when trying to display the
> information on the datagridview using the same idealogy, it doesn't
> seem to display anything.
>
> I've read elsewhere on the web that the VS2008 datagridview doesn't
> support a hierarchy of objects.  So that leads me to my next couple
> questions of whether or not my approach to doing the finds and
> relations are correct and my second question being whether or not you
> possibly know of a third party datagrid that may support what I'm
> looking to do.  I've looked a bit on the web and have seem to come up
> short on finding a third party application.  I've found hierarchy
> datagrids but I'm looking to display on one row of the datagrid
> Assignment field1, Assignment field2, Assignment field3,
> AssignmentEmployee field4, AssignmentEmployee field5
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to