I need to have a database that starts with a table called "User", which must refer to itself and have a very deep graph of related objects. It should look like the left side of the image below (ignoring the right side).
I also need to go through this graph up and down to calculate percentages, totals, etc. In other words, I will need to track the entire chart anyway.
Is this possible and / or how is this done? Can I scroll right in a LINQ statement? Examples?
EDIT: I am basically trying to create a network marketing scenario and have to calculate each personβs income.
Examples:
- To be able to calculate the total sales for each user under a specific user (therefore, each user will have some kind of income).
- Calculate the commission at a certain tree level (for example, if the top person had 3 people below them, each of whom sold the product for $ 1, and the commission was 50%, then it would be $ 1.50.)
- If I requested the image above (left) for "B", I should get "B, H, I, J, N, O"
Hope this helps: S
source share