//Generate the Terms collection (of Term) based on an xml document //Called by BasicTerms.Create, once from ITATSystem.LoadFromDatabase public static List<Term> Create(XmlNode termsNode, ManagedItem managedItem, Template template) { List<Term> rtn = new List<Term>(termsNode.ChildNodes.Count); int order = 0; foreach (XmlNode termNode in termsNode) { Term t = null; switch (termNode.Name.ToString()) { case XMLNames._E_Text: t = new TextTerm(termNode, template, false); break; case XMLNames._E_Date: t = new DateTerm(termNode, template, false); break; case XMLNames._E_MSO: t = new MSOTerm(termNode, template, false); break; case XMLNames._E_Link: t = new LinkTerm(termNode, template, false); break; case XMLNames._E_Facility: t = new FacilityTerm(termNode, template, false); break; case XMLNames._E_Renewal: t = new RenewalTerm(termNode, managedItem != null, template, false); break; case XMLNames._E_PickList: t = new PickListTerm(termNode, template, false); break; case XMLNames._E_External: t = new ExternalTerm(termNode, managedItem, template, false); break; case XMLNames._E_PlaceHolderAttachments: t = new PlaceHolderAttachments(termNode, template, false); break; case XMLNames._E_PlaceHolderComments: t = new PlaceHolderComments(termNode, template, false); break; default: throw new XmlException(string.Format("Tried to create undefined term type {0}", termNode.Name.ToString())); } t.Order = order++; rtn.Add(t); } //If this is not a load of the ITATSystem terms, then ensure that the collection includes the Attachments and Comments terms. if (template != null) { List<Term> placeholderTerms = FindTermsOfType(rtn, (TermType.PlaceHolderAttachments | TermType.PlaceHolderComments)); if (placeholderTerms == null || (placeholderTerms != null && placeholderTerms.Count == 0)) { //If this is the first time these are being added, then this should be under Basic Security. Term t = new PlaceHolderAttachments(false, template, false); t.TermGroupID = template.BasicSecurityTermGroupID; t.Order = order++; rtn.Add(t); t = new PlaceHolderComments(false, template, false); t.TermGroupID = template.BasicSecurityTermGroupID; t.Order = order++; rtn.Add(t); } else if (placeholderTerms.Count != 2) { throw new Exception(string.Format("Encountered a PlaceHolder term count of {0:D} when 2 were expected", placeholderTerms.Count)); } } return rtn; }
private static Panel CreateMSOSearchControl(MSOTerm msoTerm, bool canEditProfile, SecurityHelper securityHelper) { Panel pnl = new Panel(); pnl.ID = ControlID(msoTerm.Name); TextBox txtMso = new TextBox(); txtMso.ID = pnl.ID + "_lst"; txtMso.Width = Unit.Percentage(100.0); pnl.Controls.Add(txtMso); return pnl; }