/// <summary> /// Handles Load event for a control /// </summary> /// <param name="e">Event args.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { var employee = GetEmployee(); var hasData = employee != null; var now = HttpContext.Current.Timestamp; if (!hasData) { // employee wasn't set or not found if (IsEditable) { this.Message("NothingToDisplay.Text", MessageType.Info, true); } } else if (!employee.IsPublished(now)) { // employee isn't published if (IsEditable) { this.Message("EmployeeNotPublished.Text", MessageType.Warning, true); } } // display module only in edit mode and only if we have published data to display ContainerControl.Visible = IsEditable || (hasData && employee.IsPublished(now)); // display module content only if it exists and published (or in edit mode) var displayContent = hasData && (IsEditable || employee.IsPublished(now)); panelEmployee.Visible = displayContent; if (displayContent) { if (Settings.AutoTitle) { UniversityModuleHelper.UpdateModuleTitle(TabModuleId, UniversityFormatHelper.AbbrName(employee.FirstName, employee.LastName, employee.OtherName) ); } // display employee info Display(employee); } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
string GetFileName(IEmployee employee, string extension) { return(UniversityFormatHelper.AbbrName( employee.FirstName, employee.LastName, employee.OtherName) .Replace(".", "").Replace(" ", "_") + extension); }