Staff Listing Page

@foreach(
    string dept in new string[] {
        "Communications", 
        "Accounting", 
        "Creative", 
        "Production",  
        "Human Resources", 
        "Finances"
    } 
) {
    <h3>@dept</h3>
    @BRT.Lister(
    tableId:"Contacts", viewId: "People", 
    fields: new[] {"FirstName","PreferredName","LastName","PrimaryImage","Email","JobTitle","Phone1"},   
    condition: "[Departments.Label]='" + dept + "'",
    sortFields: new EngineCore.Meta.SortFieldMeta[] {new EngineCore.Meta.SortFieldMeta {FieldId = "LastName"}},  
    template:  
        @foreach(EngineRecord p in item) {
            @if(!p.IsDBNull("PrimaryImage") && p.GetFiles("PrimaryImage").Count==1) {
                <img src="@p.GetFiles("PrimaryImage")[0].Url?width=96&height=128&mode=crop" />
            }
            <h4>@((p.IsDBNull("PreferredName") ? p["FirstName"] : p["PreferredName"]) + " " + p["LastName"])</h4>
            @if(!p.IsDBNull("JobTitle")) {
                <p>
                    @p["JobTitle"]
                </p>
            }
            <p><a href="mailto:@p["Email"]">@p["Email"]</a></p>              
            <p>@p["Phone1"]</p>          
        }    
    </div>)  
}