Blogs

eXpress App Framework Team

XCRM: Leads and opportunities

     

This post may be outdated. For the latest Domain Components concepts and examples refer to the current online documentation.

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:

[Test]
public void LeadsRelationships() {
    RegisterDC<ILead>();
    Generate();
    ILead romanFromDx = ObjectSpace.CreateObject<ILead>();
    romanFromDx.FirstName = "Roman";
    romanFromDx.LastName = "Eremin";
    romanFromDx.CompanyName = "DevExpress";
}
[DomainComponent]
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:

[Test]
public void OpportunityAccountRelationships() {
    RegisterDC<IContact>();
    RegisterDC<IAccount>();
    RegisterDC<IOpportunity>();
    Generate();
    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:

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

Published Oct 03 2008, 06:00 AM by Roman Eremin (DevExpress)
Filed under: , ,
Technorati tags: XAF, DC, XCRM
Bookmark and Share

Comments

 

drew.. said:

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..

October 5, 2008 12:16 PM
 

Alex Hoffman said:

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

October 5, 2008 7:21 PM
More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.