private BaseProfileControl CreateControl(Business.Term term, bool canEdit) { if (canEdit) if (!term.Runtime.Enabled) term.SetDefaultValue(); BaseProfileControl c = null; //if (term.Runtime.Visible) //{ switch (term.TermType) { case Business.TermType.Date: { c = (DateTermControl)LoadControl(Common.Names._UC_DateTermControl); ((DateTermControl)c).DateFormat = _itatSystem.DefaultDateFormat; c.CanEdit = term.Runtime.Enabled; break; } case Business.TermType.Renewal: { c = (RenewalTermControl)LoadControl(Common.Names._UC_RenewalTermControl); ((RenewalTermControl)c).DateFormat = _itatSystem.DefaultDateFormat; c.CanEdit = term.Runtime.Enabled; break; } case Business.TermType.Text: { c = (TextTermControl)LoadControl(Common.Names._UC_TextTermControl); c.CanEdit = term.Runtime.Enabled; break; } case Business.TermType.MSO: { c = (MSOTermControl)LoadControl(Common.Names._UC_MSOTermControl); c.CanEdit = term.Runtime.Enabled; break; } case Business.TermType.Facility: { c = (FacilityTermControl)LoadControl(Common.Names._UC_FacilityTermControl); c.CanEdit = false; if (canEdit) if (!(((FacilityTerm)term).IsPrimary ?? false)) c.CanEdit = true; ((FacilityTermControl)c).SecurityHelper = _securityHelper; break; } case Business.TermType.PickList: { c = (PickListTermControl)LoadControl(Common.Names._UC_PickListTermControl); c.CanEdit = term.Runtime.Enabled; break; } case Business.TermType.Link: { //only show the term on the Profile page if it is NOT a ManagedItemReference link if (!((Business.LinkTerm)term).IsManagedItemReference ?? false) { c = (LinkTermControl)LoadControl(Common.Names._UC_LinkTermControl); c.CanEdit = true; if (Business.Term.ValidID(((Business.LinkTerm)term).ComplexListID)) { Business.ComplexList complexList = (Business.ComplexList)(this.Page as BaseManagedItemPage).ManagedItem.FindTerm(((Business.LinkTerm)term).ComplexListID); c.CanEdit = complexList.Runtime.Enabled; } } break; } case Business.TermType.External: { c = (ExternalTermControl)LoadControl(Common.Names._UC_ExternalTermControl); c.CanEdit = term.Runtime.Enabled; break; } default: break; } //} // if (term.Runtime.Visible) if (c != null) { c.Term = term; c.ID = Helper.ControlID(term.Name); //if (!string.IsNullOrEmpty(_termNameHasFocus)) //{ // if (_termNameHasFocus == term.Name) // { // c.ControlHasFocus = _controlHasFocus; // } //} } return c; }