public override Term Copy() { DateTerm dateTerm = new DateTerm(SystemTerm, _template, IsFilter); CopyBase(dateTerm, _template); dateTerm._value = _value; dateTerm._format = _format; return dateTerm; }
//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 CreateDateSearchControl(DateTerm dateTerm, bool canEditProfile, SecurityHelper securityHelper) { Panel pnl = new Panel(); //if current page is the Profile page, then display the MSO Control. Otherwise (e.g. Search), show a text box. BaseManagedItemPage p = HttpContext.Current.CurrentHandler as BaseManagedItemPage; if (p == null) { pnl.Controls.Add(DateRangeControl(dateTerm.Name)); } else { //Profile page pnl.Controls.Add(CreateDateControl(dateTerm.Name)); } return pnl; }