protected void Display(EmployeeInfo employee) { var fullname = employee.FullName; if (IsInPopup) { // set popup title to employee name ((CDefault)this.Page).Title = fullname; } else if (InViewModule) { if (Settings.AutoTitle) { UniversityModuleHelper.UpdateModuleTitle(TabModuleId, employee.FullName); } } else { // display employee name in label literalFullName.Text = "<h2>" + fullname + "</h2>"; } // 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 { panelPositions.Visible = false; } EmployeePhotoLogic.Bind(employee, imagePhoto, PhotoWidth); BindContacts(employee); BindBarcode(employee); BindExperience(employee); BindDisciplines(employee); // about if (!string.IsNullOrWhiteSpace(employee.Biography)) { litAbout.Text = Server.HtmlDecode(employee.Biography); } else { // hide entire About tab tabAbout.Visible = false; } }
/// <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 shouldBind = true; var now = HttpContext.Current.Timestamp; var viewModel = GetViewModel(); if (viewModel.IsEmpty()) { if (IsEditable) { this.Message("NothingToDisplay.Text", MessageType.Info, true); } shouldBind = false; } else if (!viewModel.EduProgram.IsPublished(now)) { if (IsEditable) { this.Message("NotPublished.Text", MessageType.Warning, true); } else { shouldBind = false; } } if (shouldBind) { // update module title if (Settings.AutoTitle) { UniversityModuleHelper.UpdateModuleTitle(TabModuleId, UniversityFormatHelper.FormatEduProgramTitle(viewModel.EduProgram.Code, viewModel.EduProgram.Title) ); } // bind the data formEduProgram.DataSource = new List <EduProgramViewModel> { viewModel.EduProgram }; formEduProgram.DataBind(); } else { ContainerControl.Visible = IsEditable; } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
/// <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, FormatHelper.AbbrName(employee.FirstName, employee.LastName, employee.OtherName) ); } // display employee info Display(employee); } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
protected virtual void OnSynchronizeModule() { ModuleController.SynchronizeModule(ModuleId); DataCache.ClearCache($"//r7_University/Modules/{UniversityModuleHelper.GetModuleName (ModuleConfiguration)}?ModuleId={ModuleId}"); }
protected virtual void OnSynchronizeModule() { ModuleController.SynchronizeModule(ModuleId); CacheHelper.RemoveCacheByPrefix($"//r7_University/Modules/{UniversityModuleHelper.GetModuleName (ModuleConfiguration)}?ModuleId={ModuleId}"); }