Exemplo n.º 1
0
        internal IndexedHashtable removeDups(IndexedHashtable t)
        {
            IndexedHashtable result = new IndexedHashtable();

            for (int i = 0; i < t.Count; i++)
            {
                string source = (string)t.GetKey(i);
                if (t.GetValue(i) == null)
                {
                    result.Add(source, null);
                    continue;
                }
                if (t.GetValue(i).GetType().Name.EndsWith("Exception"))
                {
                    gov.va.medora.mdo.exceptions.MdoException e = new gov.va.medora.mdo.exceptions.MdoException(
                        gov.va.medora.mdo.exceptions.MdoExceptionCode.DATA_INVALID, (Exception)t.GetValue(i));
                    result.Add(source, e);
                    continue;
                }
                List <Person>             persons = (List <Person>)t.GetValue(i);
                List <DemographicsRecord> rex     = new List <DemographicsRecord>(persons.Count);
                Hashtable ht = new Hashtable(persons.Count);
                foreach (Person p in persons)
                {
                    PersonTO           pto = new PersonTO(p);
                    DemographicsRecord rec = new DemographicsRecord(pto, source);
                    long hashcode          = new TOReflection.TOEqualizer(rec).HashCode;
                    if (!ht.ContainsKey(hashcode))
                    {
                        ht.Add(hashcode, rec);
                        rex.Add(rec);
                    }
                }
                result.Add(source, rex);
            }
            return(result);
        }
Exemplo n.º 2
0
 internal IndexedHashtable removeDups(IndexedHashtable t)
 {
     IndexedHashtable result = new IndexedHashtable();
     for (int i = 0; i < t.Count; i++)
     {
         string source = (string)t.GetKey(i);
         if (t.GetValue(i) == null)
         {
             result.Add(source, null);
             continue;
         }
         if (t.GetValue(i).GetType().Name.EndsWith("Exception"))
         {
             gov.va.medora.mdo.exceptions.MdoException e = new gov.va.medora.mdo.exceptions.MdoException(
                 gov.va.medora.mdo.exceptions.MdoExceptionCode.DATA_INVALID, (Exception)t.GetValue(i));
             result.Add(source,e);
             continue;
         }
         List<Person> persons = (List<Person>)t.GetValue(i);
         List<DemographicsRecord> rex = new List<DemographicsRecord>(persons.Count);
         Hashtable ht = new Hashtable(persons.Count);
         foreach (Person p in persons)
         {
             PersonTO pto = new PersonTO(p);
             DemographicsRecord rec = new DemographicsRecord(pto, source);
             long hashcode = new TOReflection.TOEqualizer(rec).HashCode;
             if (!ht.ContainsKey(hashcode))
             {
                 ht.Add(hashcode, rec);
                 rex.Add(rec);
             }
         }
         result.Add(source, rex);
     }
     return result;
 }