Ejemplo n.º 1
0
		public static string GetTermType(ReportTermType reportTermType)
		{
			switch (reportTermType)
			{
				case ReportTermType.Text: return TermType.Text.ToString();
				case ReportTermType.Date: return TermType.Date.ToString();
				case ReportTermType.MSO: return TermType.MSO.ToString();
				case ReportTermType.Renewal: return TermType.Renewal.ToString();
				case ReportTermType.Facility: return TermType.Facility.ToString();
				case ReportTermType.PickList: return TermType.PickList.ToString();
				case ReportTermType.Link: return TermType.Link.ToString();
				case ReportTermType.External: return TermType.External.ToString();
			}
			return null;
		}
Ejemplo n.º 2
0
        //AccessibleTermGroupIDs was added in order to restrict access to the data contained within the term.
        //If AccessibleTermGroupIDs is null, then no restriction applies.
        public ReportTerm(List<Guid> AccessibleTermGroupIDs, Term term)
		{
			_name = term.Name;
			_displayName = term.Name;
			_reportTermType = GetReportTermType(term.TermType);
			_systemTerm = term.SystemTerm;
			_visible = false;
			_sortOrder = ReportTermSortOrder.None;

            if (AccessibleTermGroupIDs != null)
            {
                if (!AccessibleTermGroupIDs.Contains(term.TermGroupID))
                {
                    _value = string.Empty;
                    return;
                }
            }

			switch (_reportTermType)
			{
				case ReportTermType.ManagedItemNumber:
				case ReportTermType.Status:
				case ReportTermType.TemplateName:
					//Not handled here....
					break;
				case ReportTermType.Text:
					_value = (term as TextTerm).Value;
					break;
				case ReportTermType.Date:
					_dateTimeValue = (term as DateTerm).Value;
					_value = (term as DateTerm).DisplayValue(XMLNames._TPS_None);
					break;
				case ReportTermType.MSO:
					_value = (term as MSOTerm).MSOValue;
					break;
				case ReportTermType.Renewal:
					RenewalTerm renewalTerm = term as RenewalTerm;					
					switch (renewalTerm.DisplayedDate)
					{
						case DisplayedDate.EffectiveDate:
							_dateTimeValue = renewalTerm.EffectiveDate;
							_value = renewalTerm.DisplayValue(XMLNames._TPS_EffectiveDate);
							break;
						case DisplayedDate.ExpirationDate:
						default:
							_dateTimeValue = renewalTerm.ExpirationDate;
							_value = renewalTerm.DisplayValue(XMLNames._TPS_ExpirationDate);
							break;
					}
					break;
				case ReportTermType.Facility:
					_value = (term as FacilityTerm).DisplayValue(XMLNames._TPS_None);
					break;
				case ReportTermType.PickList:
					_value = (term as PickListTerm).DisplayValue(XMLNames._TPS_None);
					break;
				case ReportTermType.Link:
					_value = (term as LinkTerm).DisplayValue(XMLNames._TPS_None);
					break;
				case ReportTermType.External:
					_value = (term as ExternalTerm).DisplayValue(XMLNames._TPS_None);
					break;
				default:
					throw new Exception(string.Format("ReportTerm type '{0}' not handled", _reportTermType.ToString()));
			}
		}
Ejemplo n.º 3
0
		public ReportTerm(string name,
							ReportTermType reportTermType,
							string value,
							bool visible)
		{
			_name = name;
			_displayName = name;
			_reportTermType = reportTermType;
			_systemTerm = true;
			_value = value;
			_visible = visible;
			_sortOrder = ReportTermSortOrder.None;
		}
Ejemplo n.º 4
0
		public ReportTerm(XmlNode node)
		{
			_name = Utility.XMLHelper.GetAttributeString(node, XMLNames._A_Name);
			_displayName = Utility.XMLHelper.GetAttributeString(node, XMLNames._A_DisplayName);
			_visible = Utility.XMLHelper.GetAttributeBool(node, XMLNames._A_Visible);
			_systemTerm = Utility.XMLHelper.GetAttributeBool(node, XMLNames._A_SystemTerm);
			//_value = Utility.XMLHelper.GetText(node);

			try
			{
				_sortOrder = (ReportTermSortOrder)Enum.Parse(typeof(ReportTermSortOrder), Utility.XMLHelper.GetAttributeString(node, XMLNames._A_SortOrder));
			}
			catch
			{
				_sortOrder = ReportTermSortOrder.None;
			}

			try
			{
				_reportTermType = (ReportTermType)Enum.Parse(typeof(ReportTermType), Utility.XMLHelper.GetAttributeString(node, XMLNames._A_Type));
			}
			catch
			{
				_reportTermType = ReportTermType.None;
			}
		}