コード例 #1
0
		//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;
		}
コード例 #2
0
 private int GetBaseOffsetDays(Event eachEvent, RenewalTerm renewalTerm)
 {
     int baseOffsetDays = 0;
     Term offsetTerm = FindTerm(renewalTerm.RenewalEvent.OffsetTermID, renewalTerm.RenewalEvent.OffsetTermName);
     if (offsetTerm != null)
     {
         try { baseOffsetDays += int.Parse(offsetTerm.DisplayValue("")); }
         catch { baseOffsetDays += eachEvent.OffsetDefaultValue; }
     }
     else
     {
         baseOffsetDays += renewalTerm.RenewalEvent.OffsetDefaultValue;
     }
     return baseOffsetDays;
 }
コード例 #3
0
ファイル: Helper.cs プロジェクト: dlnuckolls/glorykidd-public
		private static Panel CreateRenewalSearchControl(RenewalTerm renewalTerm, bool canEditProfile, SecurityHelper securityHelper)
		{
			Panel pnl = new Panel();
			pnl.ID = ControlID(renewalTerm.Name);
			pnl.Controls.Add(DateRangeControl(renewalTerm.Name));
			return pnl;
		}