コード例 #1
0
ファイル: ProfileInfo.cs プロジェクト: fabrimaciel/colosoft
 /// <summary>
 /// Construtor usado na serialização dos dados.
 /// </summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected ProfileInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {
     _profileId        = info.GetInt32("ProfileId");
     _isAnonymous      = info.GetBoolean("IsAnonymous");
     _lastActivityDate = (DateTimeOffset)info.GetValue("LastActivityDate", typeof(DateTimeOffset));
     _lastUpdatedDate  = (DateTimeOffset)info.GetValue("LastUpdatedDate", typeof(DateTimeOffset));
     _userName         = info.GetString("UserName");
     _fullName         = info.GetString("FullName");
     _searchMode       = (ProfileSearchMode)info.GetInt32("SearchMode");
     _source           = (IAuthenticationSource)info.GetValue("Source", typeof(AuthenticationSource));
     _markGroupId      = (int?)info.GetValue("MarkGroupId", typeof(int?));
     _sellerTreeId     = (int?)info.GetValue("SellerTreeId", typeof(int?));
     _intermediateId   = (int?)info.GetValue("IntermediateId", typeof(int?));
 }
コード例 #2
0
ファイル: ProfileInfo.cs プロジェクト: fabrimaciel/colosoft
 /// <summary>
 /// Cria uma instancia com base nos dados do perfil.
 /// </summary>
 /// <param name="profile"></param>
 public ProfileInfo(IProfile profile)
 {
     profile.Require("profile").NotNull();
     _profileId        = profile.ProfileId;
     _fullName         = profile.FullName;
     _userName         = profile.UserName;
     _source           = profile.Source;
     _lastActivityDate = profile.LastActivityDate;
     _lastUpdatedDate  = profile.LastUpdatedDate;
     _isAnonymous      = profile.IsAnonymous;
     _markGroupId      = profile.MarkGroupId;
     _searchMode       = profile.SearchMode;
     _sellerTreeId     = profile.SellerTreeId;
     _intermediateId   = profile.IntermediateId;
 }
コード例 #3
0
ファイル: ProfileInfo.cs プロジェクト: fabrimaciel/colosoft
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="profileId"></param>
 /// <param name="username"></param>
 /// <param name="fullName"></param>
 /// <param name="searchMode">Modo de pesquisa associado.</param>
 /// <param name="source">Source.</param>
 /// <param name="isAnonymous"></param>
 /// <param name="lastActivityDate"></param>
 /// <param name="lastUpdatedDate"></param>
 /// <param name="markGroupId"></param>
 /// <param name="sellerTreeId"></param>
 /// <param name="intermediateId"></param>
 public ProfileInfo(int profileId, string username, string fullName, bool isAnonymous, ProfileSearchMode searchMode, IAuthenticationSource source, DateTimeOffset lastActivityDate, DateTimeOffset lastUpdatedDate, int?markGroupId, int?sellerTreeId, int?intermediateId)
 {
     _profileId = profileId;
     _fullName  = fullName;
     if (username != null)
     {
         username = username.Trim();
     }
     _userName         = username;
     _source           = source;
     _lastActivityDate = lastActivityDate;
     _lastUpdatedDate  = lastUpdatedDate;
     _isAnonymous      = isAnonymous;
     _markGroupId      = markGroupId;
     _sellerTreeId     = sellerTreeId;
     _intermediateId   = intermediateId;
     _searchMode       = searchMode;
 }
コード例 #4
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();
        }
コード例 #5
0
ファイル: Profile.cs プロジェクト: fabrimaciel/colosoft
        /// <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();
        }
コード例 #6
0
ファイル: ProfileInfo.cs プロジェクト: fabrimaciel/colosoft
 /// <summary>
 /// Construtor usado na serialização.
 /// </summary>
 public ProfileInfo()
 {
     _searchMode = ProfileSearchMode.All;
 }