logo

Creating a portlet for displaying the list of new users

To create a portlet, open page settings and in the toolbar select Add Portlet - Code type.

Code:
@using EleWise.ELMA.ComponentModel
@using EleWise.ELMA.Services
@using EleWise.ELMA
@using EleWise.ELMA.Model.Entities
@using EleWise.ELMA.Model.Services
@using EleWise.ELMA.Model.Ranges
@using EleWise.ELMA.Security.Models
@using EleWise.ELMA.Security.Managers
@using EleWise.ELMA.Model.Common
@using System.Linq
@* new employees are users, added over the last month *@
@{
var usersFilter = InterfaceActivator.Create<UserFilter>();
var daterange = new DateTimeRange();
daterange.From = DateTime.Now.AddDays(-30).Date;
usersFilter.EmployDate = daterange;
var latestUsers = UserManager.Instance.Find(usersFilter, null);
}
<table cellspacing="0" cellpadding="4" align="Center" border="0" style="border-color:Transparent;width:100%;border-collapse:collapse;">
<tbody><tr><th scope="col"> </th></tr>
@foreach(var u in latestUsers)
{
<tr>
  <td>
    <div style="float:left; width:34px; height:34px"><img src="http://elma.elewise.com/App_Themes/StandartTheme/Images/nophoto_32.jpeg" style="height:32px;width:32px;border-width:0px;">
  </div>
                <div style="margin-left:34px">
                    <p>Hired on: @u.EmployDate.Value.ToString("D"), @u.EmployDate.Value.ToString("dddd")</p>
                    <p><a href="javascript:showUserViewDivBlocker(217)" style="margin-right:10px">@u (Consulting department)</a>
                </div>
</td>
</tr>                           
}                           
</tbody>
</table>