/// <summary>
        /// Displays the specified employee.
        /// </summary>
        /// <param name="employee">Employee.</param>
        protected void Display(IEmployee employee)
        {
            // occupied positions
            var positions = employee.Positions
                            .OrderByDescending(op => op.Position.Weight)
                            .GroupByDivision(HttpContext.Current.Timestamp, IsEditable);

            // TODO: Grey out not published divisions
            if (positions.Any())
            {
                repeaterPositions.DataSource = positions;
                repeaterPositions.DataBind();
            }
            else
            {
                repeaterPositions.Visible = false;
            }

            // Full name
            var fullName = UniversityFormatHelper.FullName(employee.FirstName, employee.LastName, employee.OtherName);

            labelFullName.Text = fullName;

            EmployeePhotoLogic.Bind(employee, imagePhoto, Settings.PhotoWidth);

            var employeeDetailsUrl = UrlHelper.AdjustPopupUrl(
                UniversityUrlHelper.IESafeEditUrl(this, Request, "employee_id", employee.EmployeeID.ToString(), "EmployeeDetails"),
                responseRedirect: false
                );

            linkPhoto.NavigateUrl = employeeDetailsUrl;

            // Employee titles
            var titles = employee.Achievements
                         .Select(ach => new EmployeeAchievementViewModel(ach, new ViewModelContext(this)))
                         .Where(ach => ach.IsTitle)
                         .Select(ach => UniversityFormatHelper.FormatShortTitle(ach.ShortTitle, ach.Title, ach.TitleSuffix).FirstCharToLower());

            var strTitles = FormatHelper.JoinNotNullOrEmpty(", ", titles);

            if (!string.IsNullOrWhiteSpace(strTitles))
            {
                labelAcademicDegreeAndTitle.Text = "&nbsp;&ndash; " + strTitles;
            }
            else
            {
                labelAcademicDegreeAndTitle.Visible = false;
            }

            BindContacts(employee);
        }
        /// <summary>
        /// Handles the items being bound to the datalist control. In this method we merge the data with the
        /// template defined for this control to produce the result to display to the user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void listEmployees_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
        {
            var now = HttpContext.Current.Timestamp;

            // e.Item.DataItem is of EmployeeListInfo class
            var employee = (IEmployee)e.Item.DataItem;

            // find controls in DataList item template
            var linkEdit     = (HyperLink)e.Item.FindControl("linkEdit");
            var imageEdit    = (Image)e.Item.FindControl("imageEdit");
            var imagePhoto   = (Image)e.Item.FindControl("imagePhoto");
            var linkDetails  = (HyperLink)e.Item.FindControl("linkDetails");
            var linkFullName = (HyperLink)e.Item.FindControl("linkFullName");
            var labelAcademicDegreeAndTitle = (Label)e.Item.FindControl("labelAcademicDegreeAndTitle");
            var labelPositions     = (Label)e.Item.FindControl("labelPositions");
            var labelPhones        = (Label)e.Item.FindControl("labelPhones");
            var linkEmail          = (HyperLink)e.Item.FindControl("linkEmail");
            var linkSecondaryEmail = (HyperLink)e.Item.FindControl("linkSecondaryEmail");
            var linkWebSite        = (HyperLink)e.Item.FindControl("linkWebSite");
            var linkUserProfile    = (HyperLink)e.Item.FindControl("linkUserProfile");

            // edit link
            if (IsEditable)
            {
                if (Null.IsNull(Settings.DivisionID))
                {
                    linkEdit.NavigateUrl = EditUrl("employee_id", employee.EmployeeID.ToString(), "EditEmployee");
                }
                else
                {
                    linkEdit.NavigateUrl = EditUrl("employee_id", employee.EmployeeID.ToString(),
                                                   "EditEmployee", "division_id", Settings.DivisionID.ToString());
                }
            }

            // make edit link visible in edit mode
            linkEdit.Visible  = IsEditable;
            imageEdit.Visible = IsEditable;

            // mark non-published employees, as they visible only to editors
            if (!employee.IsPublished(now))
            {
                if (e.Item.ItemType == ListItemType.Item)
                {
                    e.Item.CssClass = listEmployees.ItemStyle.CssClass + " _nonpublished";
                }
                else
                {
                    e.Item.CssClass = listEmployees.AlternatingItemStyle.CssClass + " _nonpublished";
                }
            }

            // fill the controls

            // employee photo
            EmployeePhotoLogic.Bind(employee, imagePhoto, Settings.PhotoWidth, true);

            var employeeDetailsUrl = UrlHelper.AdjustPopupUrl(
                UniversityUrlHelper.IESafeEditUrl(this, Request, "employee_id", employee.EmployeeID.ToString(), "EmployeeDetails"),
                responseRedirect: false
                );

            // photo fallback
            if (string.IsNullOrWhiteSpace(imagePhoto.ImageUrl))
            {
                linkDetails.Visible = false;
            }
            else
            {
                // link to employee details
                linkDetails.NavigateUrl = employeeDetailsUrl;
            }

            // employee fullname
            linkFullName.Text        = UniversityFormatHelper.FullName(employee.FirstName, employee.LastName, employee.OtherName);
            linkFullName.NavigateUrl = employeeDetailsUrl;

            // get current employee title achievements
            var achievements = employee.Achievements
                               .Select(ea => new EmployeeAchievementViewModel(ea, ViewModelContext))
                               .Where(ach => ach.IsTitle);

            var titles = achievements.Select(ach => UniversityFormatHelper.FormatShortTitle(ach.ShortTitle, ach.Title, ach.TitleSuffix).FirstCharToLower());

            // employee title achievements
            var strTitles = FormatHelper.JoinNotNullOrEmpty(", ", titles);

            if (!string.IsNullOrWhiteSpace(strTitles))
            {
                labelAcademicDegreeAndTitle.Text = "&nbsp;&ndash; " + strTitles;
            }
            else
            {
                labelAcademicDegreeAndTitle.Visible = false;
            }

            // phones
            var phones = FormatHelper.JoinNotNullOrEmpty(", ", employee.Phone, employee.CellPhone);

            if (!string.IsNullOrWhiteSpace(phones))
            {
                labelPhones.Text = phones;
            }
            else
            {
                labelPhones.Visible = false;
            }

            // email
            if (!string.IsNullOrWhiteSpace(employee.Email))
            {
                linkEmail.NavigateUrl = "mailto:" + employee.Email;
                linkEmail.Text        = employee.Email;
            }
            else
            {
                linkEmail.Visible = false;
            }

            // secondary email
            if (!string.IsNullOrWhiteSpace(employee.SecondaryEmail))
            {
                linkSecondaryEmail.NavigateUrl = "mailto:" + employee.SecondaryEmail;
                linkSecondaryEmail.Text        = employee.SecondaryEmail;
            }
            else
            {
                linkSecondaryEmail.Visible = false;
            }

            // webSite
            if (!string.IsNullOrWhiteSpace(employee.WebSite))
            {
                linkWebSite.NavigateUrl = UniversityFormatHelper.FormatWebSiteUrl(employee.WebSite);
                linkWebSite.Text        = UniversityFormatHelper.FormatWebSiteLabel(employee.WebSite, employee.WebSiteLabel);
            }
            else
            {
                linkWebSite.Visible = false;
            }

            // profile link
            if (employee.UserID != null && !Null.IsNull(employee.UserID.Value))
            {
                linkUserProfile.NavigateUrl = Globals.UserProfileURL(employee.UserID.Value);
                // TODO: Replace profile text with something more sane
                linkUserProfile.Text = Localization.GetString("VisitProfile.Text", LocalResourceFile);
            }
            else
            {
                linkUserProfile.Visible = false;
            }

            // get current employee occupied positions, grouped
            var gops = employee.Positions
                       .OrderByDescending(op => op.DivisionID == Settings.DivisionID)
                       .ThenByDescending(op => op.Position.Weight)
                       .GroupByDivision(HttpContext.Current.Timestamp, IsEditable);

            // build positions value
            var positionsVisible = false;

            if (!gops.IsNullOrEmpty())
            {
                var strOps = string.Empty;
                foreach (var gop in gops)
                {
                    var cssClass = !gop.OccupiedPosition.Division.IsPublished(HttpContext.Current.Timestamp)
                        ? " class=\"u8y-not-published-element\"" : string.Empty;
                    strOps = FormatHelper.JoinNotNullOrEmpty("; ", strOps,
                                                             $"<span{cssClass}>"
                                                             // gop.Title is a comma-separated list of grouped positions
                                                             + FormatHelper.JoinNotNullOrEmpty(": ", gop.Title,
                                                             // TODO: Move to the module display settings?
                                                             // don't display division title also for current division
                                                                                               (gop.OccupiedPosition.DivisionID != Settings.DivisionID) ? gop.OccupiedPosition.FormatDivisionLink(this) : string.Empty)
                                                             + "</span>");
                }

                labelPositions.Text = $"<label>{LocalizeString ("OccupiedPositions.Text")}</label> {strOps}";
                positionsVisible    = true;
            }
            labelPositions.Visible = positionsVisible;
        }