Example #1
0
        void IXmlSerializable.ReadXml(System.Xml.XmlReader a)
        {
            a.ReadStartElement();
            this.ProfileId = int.Parse(a.ReadElementString("ProfileId"));
            this.UserName  = a.ReadElementString("UserName");
            this.FullName  = a.ReadElementString("FullName");
            var b = Security.Profile.ProfileSearchMode.All;

            if (Enum.TryParse <Colosoft.Security.Profile.ProfileSearchMode> (a.ReadElementString("SearchMode"), out b))
            {
                this.SearchMode = b;
            }
            LastActivityDate = a.ReadDateTimeOffset();
            LastUpdatedDate  = a.ReadDateTimeOffset();
            if (!a.IsEmptyElement)
            {
                Source = new AuthenticationSource();
                ((IXmlSerializable)this.Source).ReadXml(a);
            }
            else
            {
                a.Skip();
            }
            if (a.LocalName == "IsAnonymous" && !a.IsEmptyElement)
            {
                this.IsAnonymous = a.ReadElementContentAsBoolean();
            }
            else
            {
                a.Skip();
            }
            if (!a.IsEmptyElement)
            {
                this.MarkGroupId = a.ReadElementContentAsInt();
            }
            else
            {
                a.Skip();
            }
            if (!a.IsEmptyElement)
            {
                this.SellerTreeId = a.ReadElementContentAsInt();
            }
            else
            {
                a.Skip();
            }
            if (!a.IsEmptyElement)
            {
                this.IntermediateId = a.ReadElementContentAsInt();
            }
            else
            {
                a.Skip();
            }
            a.ReadEndElement();
        }
Example #2
0
        void IXmlSerializable.ReadXml(System.Xml.XmlReader a)
        {
            a.ReadStartElement();
            DefaultValueGroupId = int.Parse(a.ReadElementString("DefaultValueGroupId"));
            FullName            = a.ReadElementString("FullName");
            GroupRoleId         = int.Parse(a.ReadElementString("GroupRoleId"));
            IsAnonymous         = a.ReadElementContentAsBoolean();
            ProfileSearchMode b = ProfileSearchMode.All;

            if (Enum.TryParse <ProfileSearchMode> (a.ReadElementString("SearchMode"), out b))
            {
                SearchMode = b;
            }
            LastActivityDate = a.ReadDateTimeOffset();
            LastUpdatedDate  = a.ReadDateTimeOffset();
            ProfileId        = a.ReadElementContentAsInt();
            if (!a.IsEmptyElement)
            {
                a.ReadStartElement("Properties");
                var c = new List <ProfileProperty> ();
                var d = new XmlSerializer(typeof(ProfileProperty), new XmlRootAttribute("ProfileProperty"));
                while (a.LocalName == "ProfileProperty" && a.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    c.Add((ProfileProperty)d.Deserialize(a));
                }
                this.Properties = c.ToArray();
                a.ReadEndElement();
            }
            else
            {
                a.Skip();
            }
            if (!a.IsEmptyElement)
            {
                RoleSet = new ProfileRoleSet();
                ((IXmlSerializable)RoleSet).ReadXml(a);
            }
            else
            {
                a.Skip();
            }
            if (!a.IsEmptyElement)
            {
                Source = new AuthenticationSource();
                ((IXmlSerializable)Source).ReadXml(a);
            }
            else
            {
                a.Skip();
            }
            SourceId = a.ReadElementContentAsInt();
            UserId   = a.ReadElementContentAsInt();
            UserName = a.ReadElementString("UserName");
            if (!a.IsEmptyElement)
            {
                MarkGroupId = a.ReadElementContentAsInt();
            }
            else
            {
                a.Skip();
            }
            if (!a.IsEmptyElement)
            {
                SellerTreeId = a.ReadElementContentAsInt();
            }
            else
            {
                a.Skip();
            }
            if (!a.IsEmptyElement)
            {
                IntermediateId = a.ReadElementContentAsInt();
            }
            else
            {
                a.Skip();
            }
            a.ReadEndElement();
        }
Example #3
0
        /// <summary>
        /// LĂȘ os dados do xml para a instancia.
        /// </summary>
        /// <param name="reader"></param>
        void IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();

            DefaultValueGroupId = int.Parse(reader.ReadElementString("DefaultValueGroupId"));
            FullName            = reader.ReadElementString("FullName");
            GroupRoleId         = int.Parse(reader.ReadElementString("GroupRoleId"));
            IsAnonymous         = reader.ReadElementContentAsBoolean();

            ProfileSearchMode searchMode = ProfileSearchMode.All;

            if (Enum.TryParse <ProfileSearchMode>(reader.ReadElementString("SearchMode"), out searchMode))
            {
                SearchMode = searchMode;
            }

            LastActivityDate = reader.ReadDateTimeOffset();
            LastUpdatedDate  = reader.ReadDateTimeOffset();

            ProfileId = reader.ReadElementContentAsInt();

            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement("Properties");

                var properties = new List <ProfileProperty>();
                var serializer = new XmlSerializer(typeof(ProfileProperty), new XmlRootAttribute("ProfileProperty"));

                while (reader.LocalName == "ProfileProperty" &&
                       reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    properties.Add((ProfileProperty)serializer.Deserialize(reader));
                }

                this.Properties = properties.ToArray();
                reader.ReadEndElement();
            }
            else
            {
                reader.Skip();
            }

            if (!reader.IsEmptyElement)
            {
                RoleSet = new ProfileRoleSet();
                ((IXmlSerializable)RoleSet).ReadXml(reader);
            }
            else
            {
                reader.Skip();
            }

            if (!reader.IsEmptyElement)
            {
                Source = new AuthenticationSource();
                ((IXmlSerializable)Source).ReadXml(reader);
            }
            else
            {
                reader.Skip();
            }

            SourceId = reader.ReadElementContentAsInt();
            UserId   = reader.ReadElementContentAsInt();
            UserName = reader.ReadElementString("UserName");

            // MarkGroupId
            if (!reader.IsEmptyElement)
            {
                MarkGroupId = reader.ReadElementContentAsInt();
            }
            else
            {
                reader.Skip();
            }

            // SellerTreeId
            if (!reader.IsEmptyElement)
            {
                SellerTreeId = reader.ReadElementContentAsInt();
            }
            else
            {
                reader.Skip();
            }

            // IntermediateId
            if (!reader.IsEmptyElement)
            {
                IntermediateId = reader.ReadElementContentAsInt();
            }
            else
            {
                reader.Skip();
            }

            reader.ReadEndElement();
        }