eXpress App Framework Team

This Blog

October 2013 - Posts

  • How to send email for any business scenario without coding

    A few weeks ago, the eXpandFramework released registration support as discussed in How to manage users (register a new user, restore a password, etc.) from the logon form. While users could register, the implementation process was still incomplete it was missing email notification. Thus, this post will discuss the new EmailModule which was made available beginning version 13.1.8.2.

    The module was designed following the workflow discussed in Declarative data auditing. In this post I will demonstrate how to install the module along with the registration functionality discussed in manage users from the logon post in order to create three mail rules.

    1) When new user is registered.
    2) When the password is forgotten.
    3) When a new customer is created.

    In addition I will discuss how to restrict the EmailModue to sending emails only when a specific user role is logged in.

    1) Installation

    To complete installation, drag & drop the EmailModule from the toolbox into the module designer.

    image

    2) Enabling Registration

    To use the registration process, the XpandSecurityWinModule & XpandSecurityWebModule must be installed just as we did with the EmailModule in step 1. Drag & drop these two modules from the toolbox into the module desinger. In addition, use the XpandLogonParemeters as the LogonParametersType of our authentication as illustrated in the following image.

    image

    The final step is to configure the model as shown below.

    image

    When the application starts, the logon form will have two extra actions. See below.

    image

    When the end user executes the top action, the XpandSecurity module will create a new view from the non-persistent RegisterUserParameters class.

    image

    Let’s stop here and configure the rule that will actually send an email..

    4) Sending an email when a user is registered

    The EmailModule will extend the Application model with an extra node

    image

    The first step towards sending an email is to setup the SmtpClient. See below.

    image

    Next we need to create an EmailContext that will instruct the EmailModule on how to locate the email template used for this type of notification.

    image

    Now it’s time to create the actual EmailTemplate. The EmailModule uses the Razor engine and provides an EmailTemplate persistent object for this. Thus, the code snippet inside a ModuleUpdater bellow can do the job!

    image

    And of course, XAF can do its usual magic in terms of the UI, allowing the end user to fully design the template at runtime in both windows and web!

    image

    The next stop is to create the rule that will send an email based on the template created when a new user registers. This is illustrated below.

    image

    and the mail is send!

    5) Sending an email for a forgotten password

    As you might have guessed, the process is awfully similar here. We create a different EmailTemplate persistent object for this type of a notification and then create a new model EmailTemplateContent.

    image

    Then we form a rule, which instead of using the RegisterUserParameters class will use the RestorePasswordParameter and the “pass forgotten Template” context.

    image

    6) Sending an email to all admins when a new customer is created

    The procedure is pretty similar to the steps in the previous section. The difference is that in this case we will not set the CurrentObjectEmailMember attribute, since we want to send the email to all the admins and not to the customer. This is why we will need to create an EmailRecipient context as the image below illustrates.

    image

    After, we must create the actual rule where we will set the EmailReceipientContext attribute..

    image

    7) Sending emails only when a specific user role is logged in

    If you already read the Declarative data auditing post you probably know that all modules that use the Logic module can create rules using three different ways.Code Attributes decorating a class, using the Application Model or using permissions as you see bellow.

    image

     

    image

    Note that the above layout is inherited from the Logic module using the technique discussed in the Model View inheritance version post.

    An alternative approach is to use the Model Application modifications discussed in this post and using the ModelDifference module apply them to a Role Model and assign that model to the roles you want. For more information on this approach, see Changing your web Model at runtime with Model Editor and no IIS reset.

    Feel free to explore what I discussed in this post in the eXpand source code under Demos/Modules/Email/EmailTester.sln

    As always feel free to use the eXpand forums for your feedback and questions.

    Happy XAF’ing to all!

  • The XAF training week in Germany

    Last week I had the privilege to join many of our customers at Oliver’s XAF Training Class in Germany. I wanted to take the time and share with you what happened at the event – as it was an amazing week and highly recommend it to all XAF users. 

    The location

    The hotel is located high in the mountains and the above an amazing landscape…a simply beautiful location.

    image

    The agenda

    Day 1:

    The organizers (Oliver and John) did a great job with course content. You can see all the XAF courseware below.

    image

    Day 1 started with XPO and how it works independent of XAF. Oliver is an XPO legend so the introduction was amazing and even I learned some new stuff. Oliver then took the time to describe XAF Domain Components and other data layer related subjects.

    The day continued with a number of hands on labs so everyone can learn by actually doing.

    To help get relaxed after a busy day of learning, we spent some time on the golf course.

    image

    Day 2:

    The day started with instruction on editing and maintaining the model as well as standard functionality available through it. Actions, controller extensions binding business logic was also on the menu.

    Oliver is an experienced instructor and did great job in this topic area as well. Like day 1, hands on labs were on day 2’s agenda.

    image

    The day ended with time at the spa and a great dinner.

    Day 3:

    This day involved learning about the built-in modules in XAF and so Oliver spoke to us about Security, Validation, Printing, Reporting, Auditing, State Machines. We covered all simple modules with a few hours of hands on labs.

    To blow off steam, John and Oliver organized an evening at the mini-car race track. Many of us gave it our best shot to win….

    image

    Unfortunately only one person can win… Smile.

    image

    Day 4

    With spirits high, Oliver moved onto more advanced modules like XAF’s Scheduler, KPI, WorkFlow and of course a few hours of hands on labs. He also took the time to go further into more difficult topics such as extending and working outside the XAF framework.

    The class insisted so I also did a presentation on eXpandFramework where I described how you can use all that extended functionality in our community project.

    Day 4’s final event involved alcohol, so I’m not going to post any pictures  here Smile.

    Day 5 

    Unfortunately I had a early flight on the last day and couldn’t attend however I can share the daily agenda.

    • Modularizing your own functionality

    • Testing

    • Deployment / Update / ALM / Security Considerations

    • Q&A

    Way to go to John, Oliver and DevExpress for this amazing XAF training week!

    Until next time, Happy XAF’ing to all!

    Subscribe to XAF feed
    Subscribe to community feed

LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

FOLLOW US

DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2017 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners