Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CustomList <SegmentNames> lstSegmentNames = SegmentNamesSavedList;
                if (lstSegmentNames.Count == 0)
                {
                    SegmentNames newSegmentNames = new SegmentNames();
                    lstSegmentNames.Add(newSegmentNames);
                }
                SetDataFromControlToObj(ref lstSegmentNames);
                CustomList <SegmentValues> lstSegmentValues = (CustomList <SegmentValues>)SegmentValuesList;

                if (!CheckUserAuthentication(lstSegmentNames, lstSegmentValues))
                {
                    return;
                }
                manager.SaveItemSegment(ref lstSegmentNames, ref lstSegmentValues);
                InitializeCombo();
                ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg);
            }
            catch (SqlException ex)
            {
                this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
            }
            catch (Exception ex)
            {
                this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }
Пример #2
0
 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="sequenceNumber">Segment Sequence Number in HL7 message.</param>
 /// <param name="name">Enumerated Segment Name</param>
 public Hl7Segment(int sequenceNumber, Hl7SegmentEnum name)
 {
     _sequenceNumber = sequenceNumber;
     _segmentId      = new Hl7SegmentId(name);
     _values         = new ArrayList();
     System.String val = SegmentNames.Name(name);
     _values.Insert(0, val);
 }
Пример #3
0
        /// <summary>
        /// Sets the segment name of the specified segment
        /// </summary>
        /// <param name="seg">The segment to parse</param>
        /// <returns>The segment name</returns>
        private string SetSegName(string seg)
        {
            string segmentName = seg.Substring(0, seg.IndexOf(FSeperator)).ToUpper();

            if (!SegmentNames.Contains(segmentName))
            {
                SegmentNames.Add(segmentName);
            }
            return(segmentName);
        }
Пример #4
0
 private void SetDataFromControlToObj(ref CustomList <SegmentNames> lstSegmentNames)
 {
     try
     {
         SegmentNames obj = lstSegmentNames[0];
         obj.SegName = txtSegmentName.Text;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Пример #5
0
        /// <summary>
        /// Decode the segment. The HL7 message delimiters has been set to the correct value before calling this method.
        /// </summary>
        /// <param name="segmentString">Encoded segment string.</param>
        /// <param name="messageDelimiters">HL7 message delimiters to use to encode the message.</param>
        public void Decode(System.String segmentString, Hl7MessageDelimiters messageDelimiters)
        {
            int index = 0;

            System.String val   = System.String.Empty;
            int           i     = 0;
            bool          isVal = false;

            while (i < segmentString.Length)
            {
                if (segmentString.Substring(i, 1) == messageDelimiters.FieldDelimiter)
                {
                    _values.Insert(index, val);
                    index++;

                    if ((index == 1) &&
                        ((System.String)_values[0] == "MSH"))
                    {
                        // special insert for the field delimiter itself.
                        _values.Insert(index, messageDelimiters.FieldDelimiter);
                        index++;
                    }

                    val   = System.String.Empty;
                    isVal = false;
                }
                else
                {
                    val  += segmentString[i];
                    isVal = true;
                }
                i++;
            }

            if (isVal == true)
            {
                _values.Insert(index, val);
            }

            if (_values.Count > 0)
            {
                // use segment index 0 here - the correct value will be determined when the segment is added to the message
                _segmentId = new Hl7SegmentId(SegmentNames.NameEnum((System.String)_values[0]), 0);
            }
        }
Пример #6
0
 public CustomList <SegmentNames> GetGroupSegmentNames(String itemGroupID)
 {
     return(SegmentNames.GetGroupSegmentNames(itemGroupID));
 }
Пример #7
0
 public CustomList <SegmentNames> GetAllSegmentNames()
 {
     return(SegmentNames.GetAllSegmentNames());
 }
Пример #8
0
        /// <summary>
        /// Compare the two messages.
        /// </summary>
        /// <param name="tagValueFilterCollection">Tag Value Filter.</param>
        /// <param name="resultsReporter">Results reporter.</param>
        /// <param name="thatBaseComparator">Reference comparator.</param>
        /// <returns>bool - true = messages compared, false messages not compared</returns>
        public override bool Compare(TagValueCollection tagValueFilterCollection, ResultsReporter resultsReporter, BaseComparator thatBaseComparator)
        {
            bool compared = false;

            if (thatBaseComparator is Hl7Comparator)
            {
                Hl7Comparator thatHl7Comparator = (Hl7Comparator)thatBaseComparator;

                // Check if both templates have been initialized correctly
                if ((this.Template == null) ||
                    (thatHl7Comparator.Template == null))
                {
                    return(false);
                }

                // Check for comparator equality
                if (this == thatHl7Comparator)
                {
                    return(true);
                }

                // filter out comparators for the same message types
                if ((this.Template.MessageType == thatHl7Comparator.Template.MessageType) &&
                    (this.Template.MessageSubType == thatHl7Comparator.Template.MessageSubType))
                {
                    return(false);
                }

                // generate a local Tag Value collection from this
                // - this collection will include any tag value pair from the original collection and
                // the tag value pairs of any tags only (in the original collection) that match from this
                // comparator - that is the values are taken from this comparator.
                TagValueCollection lTagValueFilterCollection = GenerateTagValueCollection(tagValueFilterCollection);

                // check to see if the comparision filters match - without Univeral Matching
                // - now try to match this local filter collection against thatDicomComparator
                // - comparators that match will have the same tag value pairs (including the value) as
                // each other.
                if ((tagValueFilterCollection.Count == lTagValueFilterCollection.Count) &&
                    (thatHl7Comparator.UseComparator(lTagValueFilterCollection, false) == true))
                {
                    MessageComparisonResults messageComparisonResults
                        = new MessageComparisonResults(this.Name,
                                                       thatHl7Comparator.Name,
                                                       this.Template.MessageType,
                                                       thatHl7Comparator.Template.MessageType,
                                                       this.Template.MessageSubType,
                                                       thatHl7Comparator.Template.MessageSubType);

                    // Iterate over this comparator
                    foreach (Hl7ComparisonTag thisComparisonTag in this.Template.ComparisonTags)
                    {
                        // try to get the equivalent tag in thatHl7Comparator
                        Hl7ComparisonTag thatComparisonTag = thatHl7Comparator.Template.ComparisonTags.Find(thisComparisonTag.Tag);
                        if (thatComparisonTag != null)
                        {
                            AttributeComparisonResults attributeComparisonResults
                                = new AttributeComparisonResults(SegmentNames.Name(thisComparisonTag.Tag.Segment),
                                                                 thisComparisonTag.Tag.FieldIndex,
                                                                 thisComparisonTag.DataFormat.ToHl7Format(),
                                                                 thatComparisonTag.DataFormat.ToHl7Format());
                            attributeComparisonResults.Name = DicomHl7TagMapTemplate.Hl7NameFromHl7Tag(thisComparisonTag.Tag);
                            if (thisComparisonTag.DataFormat.Equals(thatComparisonTag.DataFormat) == false)
                            {
                                DvtkData.Validation.ValidationMessage validationMessage = new DvtkData.Validation.ValidationMessage();
                                validationMessage.Type    = DvtkData.Validation.MessageType.Error;
                                validationMessage.Message = "Attribute values do not match.";

                                attributeComparisonResults.Messages.Add(validationMessage);
                            }
                            messageComparisonResults.Add(attributeComparisonResults);
                        }
                    }

                    resultsReporter.WriteMessageComparisonResults(messageComparisonResults);

                    compared = true;
                }
            }
            else if (thatBaseComparator is DicomComparator)
            {
                DicomComparator thatDicomComparator = (DicomComparator)thatBaseComparator;

                // Check if both templates have been initialized correctly
                if ((this.Template == null) ||
                    (thatDicomComparator.Template == null))
                {
                    return(false);
                }

                // generate a local Tag Value collection from this
                // - this collection will include any tag value pair from the original collection and
                // the tag value pairs of any tags only (in the original collection) that match from this
                // comparator - that is the values are taken from this comparator.
                TagValueCollection lTagValueFilterCollection = GenerateTagValueCollection(tagValueFilterCollection);

                // check to see if the comparision filters match - without Univeral Matching
                // - now try to match this local filter collection against thatDicomComparator
                // - comparators that match will have the same tag value pairs (including the value) as
                // each other.
                if ((tagValueFilterCollection.Count == lTagValueFilterCollection.Count) &&
                    (thatDicomComparator.UseComparator(lTagValueFilterCollection, false) == true))
                {
                    MessageComparisonResults messageComparisonResults
                        = new MessageComparisonResults(this.Name,
                                                       thatDicomComparator.Name,
                                                       this.Template.MessageType,
                                                       thatDicomComparator.Template.Command,
                                                       this.Template.MessageSubType,
                                                       thatDicomComparator.Template.SopClassUid);

                    // Iterate over this comparator
                    foreach (Hl7ComparisonTag thisComparisonTag in this.Template.ComparisonTags)
                    {
                        // try to get the equivalent tag in thatDicomComparator
                        DicomComparisonTag thatComparisonTag = thatDicomComparator.Template.ComparisonTags.Find(DicomHl7TagMapTemplate.Hl7ToDicomTag(thisComparisonTag.Tag));
                        if (thatComparisonTag != null)
                        {
                            AttributeComparisonResults attributeComparisonResults
                                = new AttributeComparisonResults(thatComparisonTag.Tag,
                                                                 SegmentNames.Name(thisComparisonTag.Tag.Segment),
                                                                 thisComparisonTag.Tag.FieldIndex,
                                                                 thisComparisonTag.DataFormat.ToHl7Format(),
                                                                 thatComparisonTag.DataFormat.ToDicomFormat());

                            if (thisComparisonTag.DataFormat.Equals(thatComparisonTag.DataFormat) == false)
                            {
                                DvtkData.Validation.ValidationMessage validationMessage = new DvtkData.Validation.ValidationMessage();
                                validationMessage.Type    = DvtkData.Validation.MessageType.Error;
                                validationMessage.Message = "Attribute values do not match.";

                                attributeComparisonResults.Messages.Add(validationMessage);
                            }
                            messageComparisonResults.Add(attributeComparisonResults);
                        }
                    }

                    resultsReporter.WriteMessageComparisonResults(messageComparisonResults);

                    compared = true;
                }
            }

            return(compared);
        }
Пример #9
0
 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="sequenceNumber">Segment Sequence Number in HL7 message.</param>
 /// <param name="setId">Set ID</param>
 public Hl7Segment(int sequenceNumber, System.String setId) : this(sequenceNumber, SegmentNames.NameEnum(setId))
 {
 }