Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Email.Length != 0)
            {
                hash ^= Email.GetHashCode();
            }
            if (Username.Length != 0)
            {
                hash ^= Username.GetHashCode();
            }
            if (Password.Length != 0)
            {
                hash ^= Password.GetHashCode();
            }
            if (Firstname.Length != 0)
            {
                hash ^= Firstname.GetHashCode();
            }
            if (Lastname.Length != 0)
            {
                hash ^= Lastname.GetHashCode();
            }
            if (Birthday.Length != 0)
            {
                hash ^= Birthday.GetHashCode();
            }
            if (PictureUrl.Length != 0)
            {
                hash ^= PictureUrl.GetHashCode();
            }
            if (Height != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Height);
            }
            if (Weight != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Weight);
            }
            if (AffiliatedBox.Length != 0)
            {
                hash ^= AffiliatedBox.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 2
0
        protected override void SetStateByEvent(IEvent @event)
        {
            switch (@event)
            {
            case PictureAddedToAdvertisment e:
                Id       = e.PictureId;
                Location = PictureUrl.FromString(e.Url);
                Size     = new PictureSize(e.Height, e.Width);
                Order    = e.Order;
                break;

            case AdvertismentPictureResized e:
                Size = new PictureSize(e.Height, e.Width);
                break;
            }
        }
Ejemplo n.º 3
0
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.index)
            {
                hashcode = (hashcode * 397) + Index.GetHashCode();
            }
            if (__isset.forceUpdate)
            {
                hashcode = (hashcode * 397) + ForceUpdate.GetHashCode();
            }
            if (__isset.title)
            {
                hashcode = (hashcode * 397) + Title.GetHashCode();
            }
            if (__isset.text)
            {
                hashcode = (hashcode * 397) + Text.GetHashCode();
            }
            if (__isset.createdTime)
            {
                hashcode = (hashcode * 397) + CreatedTime.GetHashCode();
            }
            if (__isset.pictureUrl)
            {
                hashcode = (hashcode * 397) + PictureUrl.GetHashCode();
            }
            if (__isset.thumbnailUrl)
            {
                hashcode = (hashcode * 397) + ThumbnailUrl.GetHashCode();
            }
        }
        return(hashcode);
    }
Ejemplo n.º 4
0
 public bool hasExternalLink()
 {
     return(PictureUrl.StartsWith("http://") || PictureUrl.StartsWith("https://") == true);
 }
Ejemplo n.º 5
0
 public void Configure(EntityTypeBuilder <Picture> builder)
 {
     builder.Property(c => c.Location).HasConversion(c => c.Url,
                                                     d => PictureUrl.FromString(d));
     builder.OwnsOne(c => c.Size);
 }
Ejemplo n.º 6
0
 public string GetThumbnailUrl(string cdnUrl, string containerName, string extension) =>
 PictureUrl.StartsWith("http") && !PictureUrl.Contains("cdn.podnoms.com")
         ? //TODO: <-- this is temporary
 PictureUrl
         : $"{cdnUrl}/{containerName}/profile/{Id}.{extension}?width=64&height=64";
Ejemplo n.º 7
0
 public void ReplacePicturePlaceholder(string oldValue, string newValue)
 {
     PictureUrl = PictureUrl.Replace(oldValue, newValue);
 }
Ejemplo n.º 8
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("Announcement(");
        bool __first = true;

        if (__isset.index)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Index: ");
            Index.ToString(sb);
        }
        if (__isset.forceUpdate)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ForceUpdate: ");
            ForceUpdate.ToString(sb);
        }
        if (Title != null && __isset.title)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Title: ");
            Title.ToString(sb);
        }
        if (Text != null && __isset.text)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Text: ");
            Text.ToString(sb);
        }
        if (__isset.createdTime)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CreatedTime: ");
            CreatedTime.ToString(sb);
        }
        if (PictureUrl != null && __isset.pictureUrl)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("PictureUrl: ");
            PictureUrl.ToString(sb);
        }
        if (ThumbnailUrl != null && __isset.thumbnailUrl)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ThumbnailUrl: ");
            ThumbnailUrl.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
Ejemplo n.º 9
0
        /// <summary>Parse accepts an XmlNode and parses values</summary>
        public void Parse(XmlNode xNode)
        {
            XmlNode xResultNode = null;
            string  strTmp      = null;

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_USER_ID);
                strTmp      = xResultNode.InnerText;
                UserID      = (long)Convert.ToInt32(strTmp);
            }
            catch
            {
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_USER_ROLE_ID);
                UserRoleID  = (long)Convert.ToInt32(xResultNode.InnerText);
            }
            catch
            {
                UserRoleID = 0;
            }

            try
            {
                xResultNode      = xNode.SelectSingleNode(TAG_BEGIN_DATE_CREATED);
                BeginDateCreated = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode    = xNode.SelectSingleNode(TAG_END_DATE_CREATED);
                EndDateCreated = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode       = xNode.SelectSingleNode(TAG_BEGIN_DATE_MODIFIED);
                BeginDateModified = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode     = xNode.SelectSingleNode(TAG_END_DATE_MODIFIED);
                EndDateModified = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_FIRSTNAME);
                Firstname   = xResultNode.InnerText;
                if (Firstname.Trim().Length == 0)
                {
                    Firstname = null;
                }
            }
            catch
            {
                Firstname = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_MIDDLENAME);
                Middlename  = xResultNode.InnerText;
                if (Middlename.Trim().Length == 0)
                {
                    Middlename = null;
                }
            }
            catch
            {
                Middlename = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_LASTNAME);
                Lastname    = xResultNode.InnerText;
                if (Lastname.Trim().Length == 0)
                {
                    Lastname = null;
                }
            }
            catch
            {
                Lastname = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_USERNAME);
                Username    = xResultNode.InnerText;
                if (Username.Trim().Length == 0)
                {
                    Username = null;
                }
            }
            catch
            {
                Username = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_PASSWD);
                Passwd      = xResultNode.InnerText;
                if (Passwd.Trim().Length == 0)
                {
                    Passwd = null;
                }
            }
            catch
            {
                Passwd = null;
            }

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_PICTURE_URL);
                PictureUrl  = xResultNode.InnerText;
                if (PictureUrl.Trim().Length == 0)
                {
                    PictureUrl = null;
                }
            }
            catch
            {
                PictureUrl = null;
            }
            // Cannot reliably convert a byte[] to a string.

            try
            {
                xResultNode = xNode.SelectSingleNode(TAG_IS_DISABLED);
                IsDisabled  = Convert.ToBoolean(xResultNode.InnerText);
            }
            catch
            {
                IsDisabled = false;
            }

            try
            {
                xResultNode        = xNode.SelectSingleNode(TAG_BEGIN_LAST_LOGIN_DATE);
                BeginLastLoginDate = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }

            try
            {
                xResultNode      = xNode.SelectSingleNode(TAG_END_LAST_LOGIN_DATE);
                EndLastLoginDate = DateTime.Parse(xResultNode.InnerText);
            }
            catch
            {
            }
        }