Esempio n. 1
0
        protected Person (BasicPerson basic)
            : base(basic)
        {
            // Today, we set the Swedish handle provider. This can be changed as desired.

            this.handleProvider = new SwedishForumHandleProvider();
        }
Esempio n. 2
0
 public ListPerson (BasicPerson b)
     : base(b)
 {
 }
Esempio n. 3
0
 private static void MatchPerson (Dictionary<int, BasicPerson> result, Person p, BasicPerson sameperson)
 {
     var matches = 0;
     if (p.Name.Trim().ToLower() == sameperson.Name.Trim().ToLower())
         ++matches;
     if (p.Phone.Trim() == sameperson.Phone.Trim())
         ++matches;
     if (p.Mail.Trim().ToLower() == sameperson.Email.Trim().ToLower())
         ++matches;
     if (matches > 1)
     {
         if (!result.ContainsKey(p.PersonId))
             result.Add(p.PersonId, p);
         if (!result.ContainsKey(sameperson.PersonId))
             result.Add(sameperson.PersonId, sameperson);
     }
 }
Esempio n. 4
0
        public static BasicPerson[] FilterUniquePeople (BasicPerson[] people)
        {
            // Somewhat crude dupelist, but atleast it can give some hints

            // changed to 3 different lists, should be more efficient // JL
            var uniqueTableName = new Dictionary<string, List<Person>>();
            var uniqueTablePhone = new Dictionary<string, List<Person>>();
            var uniqueTableEmail = new Dictionary<string, List<Person>>();

            var result = new Dictionary<int, BasicPerson>();
            var inputLookup = new Dictionary<int, BasicPerson>();

            // If list is empty, return empty

            if (people == null || people.Length == 0)
            {
                return (new List<BasicPerson>(result.Values)).ToArray();
            }

            foreach (Person p in people)
            {

                if (uniqueTableName.ContainsKey(p.Name))
                {
                    foreach (var sameperson in uniqueTableName[p.Name])
                    {
                        MatchPerson(result, p, sameperson);
                    }
                    uniqueTableName[p.Name].Add(p);
                }
                else
                {
                    uniqueTableName[p.Name] = new List<Person>();
                    uniqueTableName[p.Name].Add(p);
                }

                if (uniqueTablePhone.ContainsKey(p.Phone) && p.Phone.Replace("0", "").Trim() != "")
                {
                    foreach (var sameperson in uniqueTablePhone[p.Phone])
                    {
                        MatchPerson(result, p, sameperson);
                    }
                    uniqueTablePhone[p.Phone].Add(p);
                }
                else
                {
                    uniqueTablePhone[p.Phone] = new List<Person>();
                    uniqueTablePhone[p.Phone].Add(p);
                }

                if (uniqueTableEmail.ContainsKey(p.Mail))
                {
                    foreach (var sameperson in uniqueTableEmail[p.Mail])
                    {
                        MatchPerson(result, p, sameperson);
                    }
                    uniqueTableEmail[p.Mail].Add(p);
                }
                else
                {
                    uniqueTableEmail[p.Mail] = new List<Person>();
                    uniqueTableEmail[p.Mail].Add(p);
                }
            }

            return (new List<BasicPerson>(result.Values)).ToArray();
        }
Esempio n. 5
0
        public static BasicPerson[] FilterUnlistedPeople (BasicPerson[] people)
        {
            var unlistedTable = new Dictionary<int, bool>();
            var result = new List<BasicPerson>();

            // If list is empty, return empty

            if (people == null || people.Length == 0)
            {
                return result.ToArray();
            }

            // Get ALL unlisted people from database. They're not that many. Build a hashtable with them.

            int[] anonymousPersonIds = SwarmDb.GetDatabaseForReading().GetObjectsByOptionalData(ObjectType.Person, ObjectOptionalDataType.Anonymous, "1");

            foreach (int anonymousPersonId in anonymousPersonIds)
            {
                unlistedTable[anonymousPersonId] = true;
            }

            // Build list

            foreach (BasicPerson person in people)
            {
                if (!unlistedTable.ContainsKey(person.Identity))
                {
                    result.Add(person);
                }
            }

            return result.ToArray();
        }
Esempio n. 6
0
 internal static Person FromBasic (BasicPerson basic)
 {
     return new Person(basic);
 }
Esempio n. 7
0
 public BasicPerson(BasicPerson original)
     : this(original.PersonId, original.PasswordHash, original.Name, original.Email, original.Street,
            original.PostalCode, original.CityName, original.CountryId, original.Phone,
            original.GeographyId, original.Birthdate, original.Gender)
 {
 }
Esempio n. 8
0
 public BasicPerson (BasicPerson original)
     : this (original.PersonId, original.PasswordHash, original.Name, original.Email, original.Street, 
             original.PostalCode, original.CityName, original.CountryId, original.Phone, 
             original.GeographyId, original.Birthdate, original.Gender)
 {
 }