Example #1
0
        /// <summary>
        /// Check if the objects are equal.
        /// </summary>
        /// <param name="obj">Comparison object.</param>
        /// <returns>bool indicating true = equal or false  = not equal.</returns>
        public override bool Equals(object obj)
        {
            bool equals = false;

            if (obj is CommonTimeFormat)
            {
                CommonTimeFormat thatCommonTime = (CommonTimeFormat)obj;
                if ((this.Hour == thatCommonTime.Hour) &&
                    (this.Minute == thatCommonTime.Minute) &&
                    (this.Second == thatCommonTime.Second))
                {
                    equals = true;
                }
            }
            return(equals);
        }
Example #2
0
 public override System.String FromHl7ToDicom(System.String hl7Value)
 {
     CommonTimeFormat commonTimeFormat = new CommonTimeFormat();
     commonTimeFormat.FromHl7Format(hl7Value);
     return commonTimeFormat.ToDicomFormat();
 }
Example #3
0
        private BaseCommonDataFormat CreateCommonDateFormat(AttributeBase attribute)
        {
            BaseCommonDataFormat commonDataFormat = new CommonStringFormat();

            switch (this.compareRule.CompareValueType)
            {
                case CompareValueTypes.Date:
                    commonDataFormat = new CommonDateFormat();
                    break;

                case CompareValueTypes.ID:
                    commonDataFormat = new CommonIdFormat();
                    break;

                case CompareValueTypes.Name:
                    commonDataFormat = new CommonNameFormat();
                    break;

                case CompareValueTypes.String:
                    commonDataFormat = new CommonStringFormat();
                    break;

                case CompareValueTypes.Time:
                    commonDataFormat = new CommonTimeFormat();
                    break;

                case CompareValueTypes.UID:
                    commonDataFormat = new CommonUidFormat();
                    break;

                default:
                    // Do nothing.
                    break;
            }

            if (attribute is DicomAttribute)
            {
                DvtkHighLevelInterface.Dicom.Other.Attribute dicomAttributeOnly = (attribute as DicomAttribute).AttributeOnly;

                if (dicomAttributeOnly.VM == 0)
                {
                    commonDataFormat.FromDicomFormat("");
                }
                else
                {
                    commonDataFormat.FromDicomFormat(dicomAttributeOnly.Values[0]);
                }

            }
            else if (attribute is Hl7Attribute)
            {
                commonDataFormat.FromHl7Format((attribute as Hl7Attribute).AttributeOnly);
            }
            else
            {
                throw new System.Exception("Not supposed to get here.");
            }

            return(commonDataFormat);
        }
Example #4
0
 public override System.String FromDicomToHl7(System.String dicomValue)
 {
     CommonTimeFormat commonTimeFormat = new CommonTimeFormat();
     commonTimeFormat.FromDicomFormat(dicomValue);
     return commonTimeFormat.ToHl7Format();
 }