예제 #1
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            Check.Assert(reader.LocalName == "language", "Expected LocalName is 'language' rather than " +
                         reader.LocalName);
            this.language = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.language.ReadXml(reader);

            Check.Assert(reader.LocalName == "encoding", "Expected LocalName is 'encoding' rather than " +
                         reader.LocalName);
            this.encoding = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.encoding.ReadXml(reader);

            Check.Assert(reader.LocalName == "subject", "Expected LocalName is 'subject' rather than " +
                         reader.LocalName);
            string subjectType = RmXmlSerializer.ReadXsiType(reader);

            this.subject = RmFactory.PartyProxy(subjectType);

            this.subject.ReadXml(reader);


            if (reader.LocalName == "provider")
            {
                string providerType = RmXmlSerializer.ReadXsiType(reader);
                this.provider = RmFactory.PartyProxy(providerType);

                this.provider.ReadXml(reader);
            }

            if (reader.LocalName == "other_participations")
            {
                this.otherParticipations = new OpenEhr.AssumedTypes.List <Participation>();
                do
                {
                    Participation p = new Participation();
                    p.ReadXml(reader);

                    this.otherParticipations.Add(p);
                } while (reader.LocalName == "other_participations");
            }

            if (reader.LocalName == "work_flow_id")
            {
                string workFlowIdType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

                // CM: 06/09/10 when workFlowIdType is null or empty, it's type of OBJECT_REF
                if (string.IsNullOrEmpty(workFlowIdType))
                {
                    this.workflowId = new ObjectRef();
                }
                else
                {
                    this.workflowId = ObjectRef.GetObjectRefByType(workFlowIdType);
                }

                this.workflowId.ReadXml(reader);
            }
        }
예제 #2
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            DesignByContract.Check.Assert(reader.LocalName == "language",
                                          "Expected LocalName is 'language', but it is " + reader.LocalName);
            this.language = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.language.ReadXml(reader);

            DesignByContract.Check.Assert(reader.LocalName == "territory",
                                          "Expected LocalName is 'territory', but it is " + reader.LocalName);
            this.territory = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.territory.ReadXml(reader);

            DesignByContract.Check.Assert(reader.LocalName == "category",
                                          "Expected LocalName is 'category', but it is " + reader.LocalName);
            this.category = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            this.category.ReadXml(reader);

            DesignByContract.Check.Assert(reader.LocalName == "composer",
                                          "Expected LocalName is 'composer', but it is " + reader.LocalName);
            string composerType = RmXmlSerializer.ReadXsiType(reader);

            this.composer = RmFactory.PartyProxy(composerType);

            this.composer.ReadXml(reader);

            if (reader.LocalName == "context")
            {
                this.context = new EventContext();
                this.context.ReadXml(reader);
                this.context.Parent = this;
            }

            if (reader.LocalName == "content")
            {
                OpenEhr.AssumedTypes.Impl.LocatableList <ContentItem> contents =
                    new OpenEhr.AssumedTypes.Impl.LocatableList <ContentItem>();
                do
                {
                    string contentType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                    Check.Assert(!string.IsNullOrEmpty(contentType), "content type must not be null or empty.");

                    ContentItem aContentItem = ContentItem.GetLocatableObjectByType(contentType)
                                               as ContentItem;
                    if (aContentItem == null)
                    {
                        throw new InvalidOperationException("Composition contentType must be type of ContentItem: " + contentType);
                    }
                    aContentItem.ReadXml(reader);

                    aContentItem.Parent = this;
                    contents.Add(aContentItem);
                } while (reader.LocalName == "content" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.content = contents;
            }
        }
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture,
                                         object value, Type destinationType)
        {
            DataTypes.Text.CodePhrase codePhrase = value as DataTypes.Text.CodePhrase;
            if (destinationType == typeof(string) && codePhrase != null)
            {
                string s = codePhrase.TerminologyId.Value + "::" + codePhrase.CodeString;
                if (s == "::")
                {
                    return("");
                }

                return(s);
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
예제 #4
0
파일: Entry.cs 프로젝트: nickvane/OpenEHR
        protected Entry(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid,
           Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit,
            CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider,
            Participation[] otherParticipations, ObjectRef workflowId)
            : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit)
        {
            Check.Require(language != null, "language must not be null");
            Check.Require(encoding != null, "encoding must not be null");
            Check.Require(subject != null, "subject must not be null");

            this.language = language;
            this.encoding = encoding;
            this.subject = subject;
            this.provider = proider;
            if (otherParticipations != null)
                this.otherParticipations = new OpenEhr.AssumedTypes.List<Participation>(otherParticipations);
            this.workflowId = workflowId;
        }
예제 #5
0
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            if (value is string)
            {
                try
                {
                    string s = (string)value;

                    string[] parts = s.Split(':');

                    DataTypes.Text.CodePhrase codePhrase = new DataTypes.Text.CodePhrase(parts[2], parts[0]);

                    return codePhrase;
                }
                catch (Exception ex)
                {
                    throw new ArgumentException("Can not convert '" + (string)value + "' to type DV_CODE_PHRASE");
                }
            }

            return base.ConvertFrom(context, culture, value);
        }
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            if (value is string)
            {
                try
                {
                    string s = (string)value;

                    string[] parts = s.Split(':');

                    DataTypes.Text.CodePhrase codePhrase = new DataTypes.Text.CodePhrase(parts[2], parts[0]);

                    return(codePhrase);
                }
                catch (Exception ex)
                {
                    throw new ArgumentException("Can not convert '" + (string)value + "' to type DV_CODE_PHRASE");
                }
            }

            return(base.ConvertFrom(context, culture, value));
        }
예제 #7
0
파일: Entry.cs 프로젝트: nickvane/OpenEHR
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            Check.Assert(reader.LocalName == "language", "Expected LocalName is 'language' rather than " +
                reader.LocalName);
            this.language = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.language.ReadXml(reader);

            Check.Assert(reader.LocalName == "encoding", "Expected LocalName is 'encoding' rather than " +
                reader.LocalName);
            this.encoding = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.encoding.ReadXml(reader);

            Check.Assert(reader.LocalName == "subject", "Expected LocalName is 'subject' rather than " +
                reader.LocalName);
            string subjectType = RmXmlSerializer.ReadXsiType(reader);
            this.subject = RmFactory.PartyProxy(subjectType);

            this.subject.ReadXml(reader);

            if (reader.LocalName == "provider")
            {
                string providerType = RmXmlSerializer.ReadXsiType(reader);
                this.provider = RmFactory.PartyProxy(providerType);

                this.provider.ReadXml(reader);
            }

            if (reader.LocalName == "other_participations")
            {
                this.otherParticipations = new OpenEhr.AssumedTypes.List<Participation>();
                do
                {
                    Participation p = new Participation();
                    p.ReadXml(reader);

                    this.otherParticipations.Add(p);

                } while (reader.LocalName == "other_participations");
            }

            if (reader.LocalName == "work_flow_id")
            {
                string workFlowIdType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

                // CM: 06/09/10 when workFlowIdType is null or empty, it's type of OBJECT_REF
                if (string.IsNullOrEmpty(workFlowIdType))
                    this.workflowId = new ObjectRef();
                else
                    this.workflowId = ObjectRef.GetObjectRefByType(workFlowIdType);

                this.workflowId.ReadXml(reader);

            }
        }