예제 #1
0
        // TODO: Calculate initial capacity for StringBuilder?
        string FormatDocumentsLinkWithData(IEnumerable <IDocument> documents, string linkText, string columnSlug, string microdata = "")
        {
            var microdataAttrs = !string.IsNullOrEmpty(microdata) ? " " + microdata : string.Empty;
            var docCount       = documents.Count();

            if (docCount > 0)
            {
                var docCountText = (docCount > 1 || string.IsNullOrEmpty(linkText)) ? " [" + docCount + "]" : string.Empty;
                var table        = new StringBuilder(
                    $"<span{microdataAttrs}>"
                    + $"<a type=\"button\" href=\"#\" data-toggle=\"modal\" data-target=\"#u8y-epp-docs-dlg-{Context.Module.ModuleId}\""
                    + $" data-table=\"doct-{RowId}-{columnSlug}\">{(linkText + docCountText).TrimStart ()}</a>"
                    + $"<table id=\"doct-{RowId}-{columnSlug}\" class=\"d-none\">"
                    + $"<thead><tr><th>{TitleColumnHeader}</th><th>{GroupColumnHeader}</th></tr></thead><tbody>"
                    );

                foreach (var document in documents)
                {
                    var docTitle        = !string.IsNullOrEmpty(document.Title) ? document.Title : Localization.GetString("LinkOpen.Text", Context.LocalResourceFile);
                    var docUrl          = UniversityUrlHelper.LinkClickIdnHack(document.Url, Context.Module.TabId, Context.Module.ModuleId);
                    var rowCssClassAttr = !document.IsPublished(HttpContext.Current.Timestamp) ? " class=\"u8y-not-published\"" : string.Empty;
                    table.Append($"<tr{rowCssClassAttr}><td><a href=\"{docUrl}\" target=\"_blank\">{docTitle}</a></td><td>{document.Group}</td></tr>");
                }

                table.Append("</tbody></table></span>");
                return(table.ToString());
            }

            if (!string.IsNullOrEmpty(linkText))
            {
                return($"<span{microdataAttrs}>{linkText}</span>");
            }

            return(string.Empty);
        }
예제 #2
0
        public static string FormatDocumentLink_WithMicrodata(this IDocument document, string documentTitle,
                                                              string defaultTitle, bool preferDocumentTitle, DocumentGroupPlacement groupPlacement, int tabId, int moduleId, string microdata, DateTime now)
        {
            var title = (preferDocumentTitle && !string.IsNullOrWhiteSpace(documentTitle))
                ? ((groupPlacement == DocumentGroupPlacement.InTitle)
                    ? TextUtils.FormatList(": ", document.Group, documentTitle)
                    : documentTitle)
                : ((groupPlacement == DocumentGroupPlacement.InTitle && !string.IsNullOrWhiteSpace(document.Group))
                    ? document.Group
                    : defaultTitle);

            if (!string.IsNullOrWhiteSpace(document.Url))
            {
                var linkMarkup = "<a href=\"" + UniversityUrlHelper.LinkClickIdnHack(document.Url, tabId, moduleId) + "\" "
                                 + TextUtils.FormatList(" ", !document.IsPublished(now) ? "class=\"u8y-not-published-element\"" : string.Empty, microdata)
                                 + " target=\"_blank\">" + title + "</a>";

                if (groupPlacement == DocumentGroupPlacement.BeforeTitle)
                {
                    return(TextUtils.FormatList(": ", document.Group, linkMarkup));
                }

                if (groupPlacement == DocumentGroupPlacement.AfterTitle)
                {
                    return(TextUtils.FormatList(": ", linkMarkup, document.Group));
                }

                return(linkMarkup);
            }

            return(string.Empty);
        }
        public static void ItemDataBound(PortalModuleBase module, object sender, RepeaterItemEventArgs e)
        {
            // exclude header & footer
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var gop = (GroupedOccupiedPosition)e.Item.DataItem;
                var op  = gop.OccupiedPosition;

                var labelPosition = (Label)e.Item.FindControl("labelPosition");
                var labelDivision = (Label)e.Item.FindControl("labelDivision");
                var linkDivision  = (HyperLink)e.Item.FindControl("linkDivision");

                labelPosition.Text = gop.Title;

                // don't display division title/link for single-entity divisions
                if (!op.Division.IsSingleEntity)
                {
                    var divisionShortTitle = FormatHelper.FormatShortTitle(
                        op.Division.ShortTitle,
                        op.Division.Title);

                    if (!string.IsNullOrWhiteSpace(op.Division.HomePage))
                    {
                        // link to division's homepage
                        labelDivision.Visible    = false;
                        linkDivision.NavigateUrl = UniversityUrlHelper.FormatCrossPortalTabUrl(
                            module,
                            int.Parse(op.Division.HomePage),
                            false);
                        linkDivision.Text = divisionShortTitle;
                    }
                    else
                    {
                        // only division title
                        linkDivision.Visible = false;
                        labelDivision.Text   = divisionShortTitle;
                    }

                    labelPosition.Text += ": "; // to prev label!
                }
                else
                {
                    labelDivision.Visible = false;
                    linkDivision.Visible  = false;
                }

                if (!op.Division.IsPublished(HttpContext.Current.Timestamp))
                {
                    labelPosition.CssClass = "u8y-not-published-element";
                    labelDivision.CssClass = "u8y-not-published-element";
                    linkDivision.CssClass  = "u8y-not-published-element";
                }
            }
        }
        /// <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()
                            .Where(p => IsEditable || p.OccupiedPosition.Division.IsPublished(HttpContext.Current.Timestamp));

            if (positions.Any())
            {
                repeaterPositions.DataSource = positions;
                repeaterPositions.DataBind();
            }
            else
            {
                repeaterPositions.Visible = false;
            }

            // Full name
            var fullName = FormatHelper.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 => FormatHelper.FormatShortTitle(ach.ShortTitle, ach.Title, ach.TitleSuffix).FirstCharToLower());

            var strTitles = TextUtils.FormatList(", ", titles);

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

            BindContacts(employee);
        }
        public static string FormatDivisionLink(this OccupiedPositionInfo op, IModuleControl module)
        {
            // don't display division title/link for single-entity divisions
            if (!op.Division.IsSingleEntity)
            {
                var strDivision = FormatHelper.FormatShortTitle(op.Division.ShortTitle, op.Division.Title);
                if (!string.IsNullOrWhiteSpace(op.Division.HomePage))
                {
                    strDivision = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>",
                                                UniversityUrlHelper.FormatURL(module, op.Division.HomePage, false), strDivision);
                }

                return(strDivision);
            }

            return(string.Empty);
        }
예제 #6
0
        // TODO: Use IEmployee
        void BindBarcode(EmployeeInfo employee)
        {
            labelBarcodeEmployeeName.Text = employee.FullName();

            // barcode image
            var barcodeWidth = UniversityConfig.Instance.Barcode.DefaultWidth;

            imageBarcode.ImageUrl = UniversityUrlHelper.FullUrl(string.Format(
                                                                    "/imagehandler.ashx?barcode=1&width={0}&height={1}&type=qrcode&encoding=UTF-8&content={2}",
                                                                    barcodeWidth, barcodeWidth,
                                                                    Server.UrlEncode(employee.VCard().ToString()
                                                                                     .Replace("+", "%2b")) // fix for "+" signs in phone numbers
                                                                    ));

            imageBarcode.ToolTip       = LocalizeString("imageBarcode.ToolTip");
            imageBarcode.AlternateText = LocalizeString("imageBarcode.AlternateText");
        }
        // TODO: Use IEmployee
        void BindBarcode(EmployeeInfo employee)
        {
            if (employee.ShowBarcode)
            {
                labelBarcodeEmployeeName.Text = employee.FullName;
                linkBarcode.Attributes.Add("data-target", "#employee-barcode-dialog-" + ModuleId);

                // barcode image
                var barcodeWidth = UniversityConfig.Instance.Barcode.DefaultWidth;
                imageBarcode.ImageUrl = UniversityUrlHelper.FullUrl(string.Format(
                                                                        "/imagehandler.ashx?barcode=1&width={0}&height={1}&type=qrcode&encoding=UTF-8&content={2}",
                                                                        barcodeWidth, barcodeWidth,
                                                                        Server.UrlEncode(employee.VCard.ToString()
                                                                                         .Replace("+", "%2b")) // fix for "+" signs in phone numbers
                                                                        ));

                imageBarcode.ToolTip       = LocalizeString("imageBarcode.ToolTip");
                imageBarcode.AlternateText = LocalizeString("imageBarcode.AlternateText");
            }
            else
            {
                linkBarcode.Visible = false;
            }
        }
예제 #8
0
        protected void gridDivisions_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            var now = HttpContext.Current.Timestamp;

            // show / hide edit column
            e.Row.Cells [0].Visible = IsEditable;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var division = (DivisionInfo)e.Row.DataItem;

                if (IsEditable)
                {
                    // get edit link controls
                    var linkEdit = (HyperLink)e.Row.FindControl("linkEdit");
                    var iconEdit = (Image)e.Row.FindControl("iconEdit");

                    // fill edit link controls
                    linkEdit.NavigateUrl = EditUrl("division_id", division.DivisionID.ToString(), "EditDivision");
                    iconEdit.ImageUrl    = UniversityIcons.Edit;
                }

                if (!division.IsPublished(now))
                {
                    e.Row.AddCssClass("u8y-not-published");
                }

                if (division.IsInformal && IsEditable)
                {
                    e.Row.AddCssClass("u8y-informal-division");
                }

                if (division.IsGoverning)
                {
                    e.Row.AddCssClass("u8y-governing-division");
                }

                var labelTitle          = (Label)e.Row.FindControl("labelTitle");
                var linkTitle           = (HyperLink)e.Row.FindControl("linkTitle");
                var literalPhone        = (Literal)e.Row.FindControl("literalPhone");
                var linkEmail           = (HyperLink)e.Row.FindControl("linkEmail");
                var literalLocation     = (Literal)e.Row.FindControl("literalLocation");
                var linkDocument        = (HyperLink)e.Row.FindControl("linkDocument");
                var literalHeadEmployee = (Literal)e.Row.FindControl("literalHeadEmployee");

                // division label / link
                var divisionTitle = division.Title + ((UniversityModelHelper.HasUniqueShortTitle(division.ShortTitle, division.Title)) ? string.Format(
                                                          " ({0})",
                                                          division.ShortTitle) : string.Empty);
                if (!string.IsNullOrWhiteSpace(division.HomePage))
                {
                    linkTitle.NavigateUrl = UniversityUrlHelper.FormatURL(this, division.HomePage, false);
                    linkTitle.Text        = divisionTitle;
                    labelTitle.Visible    = false;
                }
                else
                {
                    labelTitle.Text   = divisionTitle;
                    linkTitle.Visible = false;
                }

                literalPhone.Text    = division.Phone;
                literalLocation.Text = division.Location;

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

                // (main) document
                if (!string.IsNullOrWhiteSpace(division.DocumentUrl))
                {
                    linkDocument.Text        = LocalizeString("Regulations.Text");
                    linkDocument.NavigateUrl = Globals.LinkClick(division.DocumentUrl, TabId, ModuleId);
                }
                else
                {
                    linkDocument.Visible = false;
                }

                // get head employee
                var headEmployee = new HeadEmployeesQuery(ModelContext)
                                   .ListHeadEmployees(division.DivisionID, division.HeadPositionID)
                                   .FirstOrDefault(he => he.IsPublished(now));

                if (headEmployee != null)
                {
                    literalHeadEmployee.Text = "<a href=\""
                                               + EditUrl("employee_id", headEmployee.EmployeeID.ToString(), "EmployeeDetails")
                                               + "\" title=\"" + headEmployee.FullName + "\">" + headEmployee.AbbrName + "</a>";
                }
                else if (division.HeadPositionID != null)
                {
                    literalHeadEmployee.Text = LocalizeString("HeadPosition_IsVacant.Text");
                }
                else
                {
                    literalHeadEmployee.Text = LocalizeString("HeadPosition_NotApplicable.Text");
                }
            }
        }
        /// <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        = FormatHelper.FullName(employee.FirstName, employee.LastName, employee.OtherName);
            linkFullName.NavigateUrl = employeeDetailsUrl;

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

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

            // employee title achievements
            var strTitles = TextUtils.FormatList(", ", titles);

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

            // phones
            var phones = TextUtils.FormatList(", ", 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 = FormatHelper.FormatWebSiteUrl(employee.WebSite);
                linkWebSite.Text        = FormatHelper.FormatWebSiteLabel(employee.WebSite, employee.WebSiteLabel);
            }
            else
            {
                linkWebSite.Visible = false;
            }

            // profile link
            if (!TypeUtils.IsNull <int> (employee.UserID))
            {
                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();

            // build positions value
            var positionsVisible = false;

            if (!gops.IsNullOrEmpty())
            {
                var strOps = string.Empty;
                foreach (var gop in gops)
                {
                    // gop.Title is a comma-separated list of grouped positions
                    strOps = TextUtils.FormatList("; ", strOps, TextUtils.FormatList(": ", 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));
                }

                if (!string.IsNullOrWhiteSpace(strOps))
                {
                    labelPositions.Text = $"<label>{LocalizeString ("OccupiedPositions.Text")}</label> {strOps}";
                    positionsVisible    = true;
                }
            }
            labelPositions.Visible = positionsVisible;
        }
        public static void Bind(IEmployee employee, Image imagePhoto, int photoWidth, bool listMode = false)
        {
            var image = default(IFileInfo);

            var photoFileId = GetPhotoFileId(employee, listMode);

            if (photoFileId != null && !Null.IsNull(photoFileId.Value))
            {
                image = FileManager.Instance.GetFile(photoFileId.Value);
            }

            var defaultWidth = listMode
                ? UniversityConfig.Instance.EmployeePhoto.ListDefaultWidth
                : UniversityConfig.Instance.EmployeePhoto.DefaultWidth;

            // TODO: Make PhotoWidth settings nullable
            photoWidth = (photoWidth > 0) ? photoWidth : defaultWidth;

            // if no photo specified (or not found), use fallback image
            var noPhotoUrl = default(string);

            if (image == null)
            {
                image        = new FileInfo();
                image.Width  = defaultWidth;
                image.Height = defaultWidth;
                noPhotoUrl   = UniversityGlobals.ASSETS_PATH + "/images/nophoto.png";
            }

            if (noPhotoUrl == null)
            {
                imagePhoto.ImageUrl = UniversityUrlHelper.FullUrl($"/imagehandler.ashx?fileid={image.FileId}&width={photoWidth}");
            }
            else
            {
                // files inside DesktopModules folder have no fileid
                imagePhoto.ImageUrl = UniversityUrlHelper.FullUrl($"/imagehandler.ashx?file={noPhotoUrl}&width={photoWidth}");
            }

            // apply CSS classes
            var imageWidth  = image.Width;
            var imageHeight = image.Height;

            if (Math.Abs(imageWidth - imageHeight) <= 1)
            {
                // for square and "almost" square images
                imagePhoto.CssClass += " rounded-circle";
            }
            else
            {
                imagePhoto.CssClass += " rounded";
            }

            if (noPhotoUrl != null)
            {
                imagePhoto.CssClass += " u8y-img-employee-nophoto";
            }

            // set alt & title
            var fullName = employee.FullName();

            imagePhoto.AlternateText = fullName;
            imagePhoto.ToolTip       = fullName;
        }
예제 #11
0
        public static void Bind(IEmployee employee, Image imagePhoto, int photoWidth, bool square = false)
        {
            IFileInfo image       = null;
            var       imageHeight = 0;
            var       imageWidth  = 0;

            if (!TypeUtils.IsNull(employee.PhotoFileID))
            {
                image = FileManager.Instance.GetFile(employee.PhotoFileID.Value);
                if (image != null && square)
                {
                    // trying to get square image
                    var squareImage = FileManager.Instance.GetFile(
                        FolderManager.Instance.GetFolder(image.FolderId),
                        Path.GetFileNameWithoutExtension(image.FileName)
                        + UniversityConfig.Instance.EmployeePhoto.SquareSuffix
                        + Path.GetExtension(image.FileName));

                    if (squareImage != null)
                    {
                        image = squareImage;
                    }
                }
            }

            if (image != null)
            {
                imageHeight = image.Height;
                imageWidth  = image.Width;

                // do we need to scale image?
                if (!Null.IsNull(photoWidth) && photoWidth != imageWidth)
                {
                    imagePhoto.ImageUrl = UniversityUrlHelper.FullUrl(string.Format(
                                                                          "/imagehandler.ashx?fileid={0}&width={1}", image.FileId, photoWidth));
                }
                else
                {
                    // use original image
                    imagePhoto.ImageUrl = FileManager.Instance.GetUrl(image);
                }
            }
            else
            {
                // if not photo specified, or not found, use fallback image
                imageWidth  = square ? UniversityConfig.Instance.EmployeePhoto.SquareDefaultWidth : UniversityConfig.Instance.EmployeePhoto.DefaultWidth;
                imageHeight = square ? UniversityConfig.Instance.EmployeePhoto.SquareDefaultWidth : UniversityConfig.Instance.EmployeePhoto.DefaultWidth * 4 / 3;

                // TODO: Make fallback image resizable through image handler
                imagePhoto.ImageUrl = string.Format("/DesktopModules/MVC/R7.University/R7.University/images/nophoto_{0}{1}.png",
                                                    CultureInfo.CurrentCulture.TwoLetterISOLanguageName, square ?
                                                    UniversityConfig.Instance.EmployeePhoto.SquareSuffix : "");
            }

            // do we need to scale image dimensions?
            if (!Null.IsNull(photoWidth) && photoWidth != imageWidth)
            {
                imagePhoto.Width  = photoWidth;
                imagePhoto.Height = (int)(imageHeight * (float)photoWidth / imageWidth);
            }
            else
            {
                imagePhoto.Width  = imageWidth;
                imagePhoto.Height = imageHeight;
            }

            // set alt & title for photo
            var fullName = FormatHelper.FullName(employee.FirstName, employee.LastName, employee.OtherName);

            imagePhoto.AlternateText = fullName;
            imagePhoto.ToolTip       = fullName;
        }