this.BindingSource_Member.DataSource = from pu in project.ProjectUsers
join u in project.ProjectUsers.Select(p => p.User)
on pu.User.SN equals u.SN
select new
{
PersonalId = u.PersonalId,
Name = u.Name,
RoleName = pu.Role.Description
};
更複雜的:
var t1 = (from u1 in mWorkspace.SystemUserList
join u2 in CurrentProject.ProjectUsers
on u1.SN equals u2.User.SN
select new
{
IsMember = true,
PersonalId = u1.PersonalId,
Name = u1.Name,
IsLead = (u2.Role.Name == "InvestigationLead") ? "" : "設定為管理員"
});
var t2 = from u in
(from u1 in mWorkspace.SystemUserList select u1).Except
(from u2 in CurrentProject.ProjectUsers select u2.User)
select new
{
IsMember = false,
PersonalId = u.PersonalId,
Name = u.Name,
IsLead = ""
};
this.BindingSource_Member.DataSource = t1.Union(t2);
join u in project.ProjectUsers.Select(p => p.User)
on pu.User.SN equals u.SN
select new
{
PersonalId = u.PersonalId,
Name = u.Name,
RoleName = pu.Role.Description
};
更複雜的:
var t1 = (from u1 in mWorkspace.SystemUserList
join u2 in CurrentProject.ProjectUsers
on u1.SN equals u2.User.SN
select new
{
IsMember = true,
PersonalId = u1.PersonalId,
Name = u1.Name,
IsLead = (u2.Role.Name == "InvestigationLead") ? "" : "設定為管理員"
});
var t2 = from u in
(from u1 in mWorkspace.SystemUserList select u1).Except
(from u2 in CurrentProject.ProjectUsers select u2.User)
select new
{
IsMember = false,
PersonalId = u.PersonalId,
Name = u.Name,
IsLead = ""
};
this.BindingSource_Member.DataSource = t1.Union(t2);