Пример #1
0
        public FacilityTerm(XmlNode termNode, Template template, bool isFilter)
            : base(termNode, template, isFilter)
		{
			TermType = TermType.Facility;
			NameRequired = true;
			_multiSelect = Utility.XMLHelper.GetAttributeBool(termNode, XMLNames._A_MultiSelect);
			_useUserSecurity = Utility.XMLHelper.GetAttributeBool(termNode, XMLNames._A_UseUserSecurity);
			_includeChildren = Utility.XMLHelper.GetAttributeBool(termNode, XMLNames._A_IncludeChildren);
			_isPrimary = Utility.XMLHelper.GetAttributeBool(termNode, XMLNames._A_IsPrimary);
			int? facilityStatus = Utility.XMLHelper.GetAttributeInt(termNode, XMLNames._A_FacilityStatus) ?? 0;
			_facilityStatus = (FacilityStatusType)facilityStatus;

			_sort = new FacilitySort(FacilitySortField.FacilityName);   //default to sorting by FacilityName
			string sortField = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_FacilitySort);
			if (!string.IsNullOrEmpty(sortField))
				_sort.Field = (FacilitySortField)Enum.Parse(typeof(FacilitySortField), sortField);

			XmlNodeList facilityTypeNodes = termNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_FacilityTypes,XMLNames._E_FacilityType));
			_facilityTypes = new List<int>(facilityTypeNodes.Count);
			foreach (XmlNode facilityTypeNode in facilityTypeNodes)
			{
				_facilityTypes.Add(Utility.XMLHelper.GetAttributeIntNonNull(facilityTypeNode, XMLNames._A_TypeID));
			}

			XmlNodeList selectedFacilityIDNodes = termNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_SelectedFacilityIDs, XMLNames._E_FacilityID));
			_selectedFacilityIDs = new List<int>(selectedFacilityIDNodes.Count);
			if (selectedFacilityIDNodes.Count > 0)
			{
				foreach (XmlNode facilityIDNode in selectedFacilityIDNodes)
				{
					_selectedFacilityIDs.Add(Utility.XMLHelper.GetAttributeIntNonNull(facilityIDNode, XMLNames._A_ID));
				}
			}

			XmlNodeList owningFacilityIDNodes = termNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_OwningFacilityIDs, XMLNames._E_FacilityID));
			_owningFacilityIDs = new List<int>(owningFacilityIDNodes.Count);
			if (owningFacilityIDNodes.Count > 0)
			{
				foreach (XmlNode facilityIDNode in owningFacilityIDNodes)
				{
					_owningFacilityIDs.Add(Utility.XMLHelper.GetAttributeIntNonNull(facilityIDNode, XMLNames._A_ID));
				}
			}
		}
Пример #2
0
        public FacilityTerm(bool systemTerm, Template template, bool isFilter)
            : base(systemTerm, template, isFilter)
		{
			TermType = TermType.Facility;
			NameRequired = true;
			_facilityTypes = new List<int>();
			_selectedFacilityIDs = new List<int>();
			_owningFacilityIDs = new List<int>();
			_sort = new FacilitySort();
		}