Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public override bool Equals(Issue other)
 {
     if (other == null)
     {
         return(false);
     }
     return(Id == other.Id &&
            Project == other.Project &&
            Tracker == other.Tracker &&
            Status == other.Status &&
            Priority == other.Priority &&
            Author == other.Author &&
            Category == other.Category &&
            Subject == other.Subject &&
            Description == other.Description &&
            StartDate == other.StartDate &&
            DueDate == other.DueDate &&
            DoneRatio == other.DoneRatio &&
            EstimatedHours == other.EstimatedHours &&
            (CustomFields != null ? CustomFields.Equals <IssueCustomField>(other.CustomFields) : other.CustomFields == null) &&
            CreatedOn == other.CreatedOn &&
            UpdatedOn == other.UpdatedOn &&
            AssignedTo == other.AssignedTo &&
            FixedVersion == other.FixedVersion &&
            Notes == other.Notes &&
            (Watchers != null ? Watchers.Equals <Watcher>(other.Watchers) : other.Watchers == null) &&
            ClosedOn == other.ClosedOn &&
            SpentHours == other.SpentHours &&
            PrivateNotes == other.PrivateNotes &&
            (Attachments != null ? Attachments.Equals <Attachment>(other.Attachments) : other.Attachments == null) &&
            (ChangeSets != null ? ChangeSets.Equals <ChangeSet>(other.ChangeSets) : other.ChangeSets == null) &&
            (Children != null ? Children.Equals <IssueChild>(other.Children) : other.Children == null) &&
            (Journals != null ? Journals.Equals <Journal>(other.Journals) : other.Journals == null) &&
            (Relations != null ? Relations.Equals <IssueRelation>(other.Relations) : other.Relations == null));
 }
        } // Work with classes

        public static bool GetMarried(THuman pearson1, THuman pearson2)
        {
            bool canMarry1      = false;
            bool canMarry2      = false;
            var  relationships1 = new Relations();
            var  relationships2 = new Relations();

            // Read Attribute [5]
            Type p1          = pearson1.GetType();
            var  attributes1 = p1.GetCustomAttributes(typeof(SocialAttitude), true);

            foreach (SocialAttitude attribute in attributes1)
            {
                relationships1 = attribute.Couple;
            }

            Type p2          = pearson2.GetType();
            var  attributes2 = p2.GetCustomAttributes(true);

            foreach (SocialAttitude attribute in attributes2)
            {
                relationships2 = attribute.Couple;
            }

            // If they meaning about couple identical
            if (!relationships1.Equals(relationships2))
            {
                return(false);
            }

            foreach (String r in pearson1.Relationships.Keys)
            {
                if (relationships1.HasFlag((Relations)Enum.Parse(typeof(Relations), r)))
                {
                    if (pearson1.Relationships[r] == pearson2.Id)
                    {
                        canMarry1 = true;
                    }
                }
            }

            foreach (String r in pearson2.Relationships.Keys)
            {
                if (relationships1.HasFlag((Relations)Enum.Parse(typeof(Relations), r)))
                {
                    if (pearson2.Relationships[r] == pearson1.Id)
                    {
                        canMarry2 = true;
                    }
                }
            }

            return(canMarry1 & canMarry2);
        }