Hello,
I use OS: Win 8.1
.Net4.5
UI fo Winforms Vers. 2014.2 715
I try to make a relation between 2 tables in my MS Entity (Framework 6.0.1),
The problem is the tables don't have a column in common so that i can make a direct relation,
What i need is a possibility to .Join a third table to my parent which provides the missing column.
My 3 tables are
tbl_AffiliateCommision which should be my parent template in the Hierarchygridview this table provides me the column "AffiliateUser" and the grouping would be done with this column.
tbl_Affiliate in this table every AffiliateUser gets his specific "IdAffiliates". This table would provide both columns. This table should not be shown in the grid
ItemAffiliate which should be the child template and provides me the sold items and the column "IdAffiliate" which is a undergroup of the Column "AffiliateUser" ( AffiliateUser is not available in this table)
e.g.: AffiliateUser : 12354 has the IdAffiliates: 1,4,6
AffiliateUser: 32145 has the IdAffiliates: 2,3,7
Here some code for better a understanding
in the 01 line i just look up the data i would use the same Join in teh 02 line if it would work like this.
the rest of the code shows how i would make my grid.
Please let me know if i forgot to give you important information.
best regards
I use OS: Win 8.1
.Net4.5
UI fo Winforms Vers. 2014.2 715
I try to make a relation between 2 tables in my MS Entity (Framework 6.0.1),
The problem is the tables don't have a column in common so that i can make a direct relation,
What i need is a possibility to .Join a third table to my parent which provides the missing column.
My 3 tables are
tbl_AffiliateCommision which should be my parent template in the Hierarchygridview this table provides me the column "AffiliateUser" and the grouping would be done with this column.
tbl_Affiliate in this table every AffiliateUser gets his specific "IdAffiliates". This table would provide both columns. This table should not be shown in the grid
ItemAffiliate which should be the child template and provides me the sold items and the column "IdAffiliate" which is a undergroup of the Column "AffiliateUser" ( AffiliateUser is not available in this table)
e.g.: AffiliateUser : 12354 has the IdAffiliates: 1,4,6
AffiliateUser: 32145 has the IdAffiliates: 2,3,7
Here some code for better a understanding
in the 01 line i just look up the data i would use the same Join in teh 02 line if it would work like this.
the rest of the code shows how i would make my grid.
Please let me know if i forgot to give you important information.
01.
var g = db.tbl_wat_Affiliate_Commission.Join(db.tbl_wat_Affiliate, ac => ac.IdAffiliateUser, a => a.AffiliateUser, (ac, a) =>
new
{ ac, a });
02.
this
.radGridView1.DataSource = db.tbl_wat_Affiliate_Commission.Local.ToBindingList();
03.
this
.radGridView1.AllowAddNewRow =
true
;
04.
this
.radGridView1.AllowEditRow =
true
;
05.
this
.radGridView1.AllowDeleteRow =
true
;
06.
07.
// Create and load child
08.
09.
db.tbl_sst_ItemAffiliate.Load();
10.
11.
GridViewTemplate template =
new
GridViewTemplate();
12.
template.DataSource = db.tbl_sst_ItemAffiliate.Local.ToBindingList();
13.
// Hinzufügen des childtemps.//
14.
this
.radGridView1.MasterTemplate.Templates.Add(template);
15.
16.
//Create relation//
17.
GridViewRelation relation =
new
GridViewRelation(
this
.radGridView1.MasterTemplate);
18.
relation.ChildTemplate = template;
19.
relation.RelationName =
"Affiliate"
;
20.
relation.ParentColumnNames.Add(
"IdAffiliateUser"
);
21.
relation.ChildColumnNames.Add(
"IdAffiliateUser"
);
22.
this
.radGridView1.Relations.Add(relation);
best regards