protected override void CreateChildControls() { base.CreateChildControls(); try { //Loads a user control DirectReports directReports = (DirectReports)Page.LoadControl("~/_controltemplates/TrainingManagement/DirectReports.ascx"); directReports.Web = SPContext.Current.Web; directReports.LoginName = SPContext.Current.Web.CurrentUser.LoginName; directReports.ShowLogin = this.showLogin; this.Controls.Add(directReports); } catch (HttpException ex) { this.Controls.Add(new LiteralControl("<br />An unexpected error occurred loading Web Part. " + ex.Message)); } }
private void InitializeDirectReports() { if (UserEntry != null) { PropertyValueCollection reports = UserEntry.Properties["directReports"]; foreach (string report in reports) { FullyQualifiedADName adName = GetADNameFromDescriptor(report); UserInformation uiReport = new UserInformation(); if (!uiReport.InitializeWithFullName(adName.Name, adName.DomainName)) { Planner.Instance.WriteToEventLog("Updating team members: fullname did not resolve: " + adName.Name); } DirectReports.Add(uiReport); } } }