Example #1
0
        public object Clone()
        {
            Trip newTrip = new Trip()
            {
                TripId = 0,//Should reset the trip id value.
                ShareId = this.ShareId,
                Name = this.Name,
                Budget = this.Budget,
                Description = this.Description,
                StartsAt = this.StartsAt,
                EndsAt = this.EndsAt,
                Tags = null,
            };

            if (this.Tags != null)
            {
                newTrip.Tags = new Collection<string>();
                foreach (var tag in this.Tags)
                {
                    newTrip.Tags.Add(tag);
                }
            }

            newTrip.PlanItems = new List<PlanItem>();
            foreach (var planItem in this.PlanItems)
            {
                newTrip.PlanItems.Add(planItem.Clone() as PlanItem);
            }

            return newTrip;
        }
        public ICollection<Person> GetInvolvedPeople(Trip trip)
        {
            var shareID = trip.ShareId;
            ICollection<Person> sharingPersons = new Collection<Person>();

            foreach (var person in People)
            {
                if (person.Trips != null)
                {
                    foreach (var t in person.Trips)
                    {
                        if (shareID.Equals(t.ShareId))
                        {
                            sharingPersons.Add(person);
                            break;
                        }
                    }
                }
            }

            return sharingPersons;
        }