XCRM: Leads and opportunities

XAF Team Blog
03 October 2008

Domain Components (DC) is in maintenance mode and we do not recommend its use in new software projects.

This post is one in a series about our work on Domain Components (DC) framework and related component libraries. I’m just describing what we are working on, what problems we are facing and what results we've got so far.

A Lead is not directly linked to a Contact or Account. It can be converted into an Account, Contact or Opportunity later. I’ll just capture the fact that the Lead class exists and may have some basic info:

public void LeadsRelationships() {
    ILead romanFromDx = ObjectSpace.CreateObject<ILead>();
    romanFromDx.FirstName = "Roman";
    romanFromDx.LastName = "Eremin";
    romanFromDx.CompanyName = "DevExpress";
public interface ILead {
    string FirstName { get; set; }
    string LastName { get; set; }
    string CompanyName { get; set; }

At this point, I’m not sure that the ILead should be inherited from the IPerson. So, I've just added the FirstName and LastName properties, and made a note to resolve this problem later.

An Opportunity is a more probable possibility for business. It is related to an Account (who you want to sell to) and Product (what you want to sell). Simple CRM systems do not track products and prices, so I will leave them out in our CRM app. Here is the test for Opportunities:

public void OpportunityAccountRelationships() {
    IAccount dx = ObjectSpace.CreateObject<IAccount>();
    dx.Name = "DevExpress";
    IOpportunity sellComponents = ObjectSpace.CreateObject<IOpportunity>();
    sellComponents.Name = "Sell some third-party components to DX";
    sellComponents.Account = dx;
    Assert.IsTrue(Enumerator.Exists<IOpportunity>(dx.Opportunities, sellComponents));

To make this test pass I need the following:

public interface IOpportunity {
    string Name { get; set; }
    IAccount Account { get; set; }
public interface IAccount {
    IList<IOpportunity> Opportunities { get; }

Showcase Your Apps on DevExpress.com

Highlight your business app and share your development experiences with the DevExpress community. To include your app in our upcoming App Showcase, please forward an application screenshot to clientservices@devexpress.com and tell us which DevExpress products you currently use within your organization.
2 comment(s)

slightly off-topic, but Roman, by repeating the same text as the first sentences of each of these blogs, the blog listing repeats the same lines over and over. If this was moved to be the second paragraph and an appropriate summary places as the first line(s).. this will aid the blog listings..   just a thought.. cheers. drew..

5 October 2008
Alex Hoffman
Alex Hoffman

Just for those outside of the USA and new to CRM's, an "Account" is simply an "Organisation", and typically renamed as such.

5 October 2008

Please login or register to post comments.