Add() public method

public Add ( Object key, Object value ) : void
key Object
value Object
return void
 public void setup()
 {
     tbl = new IndexedHashtable();
     for (int i = 0; i < 5; i++)
     {
         tbl.Add("Key" + i, "Value" + i);
     }
 }
Ejemplo n.º 2
0
 public void setup()
 {
     tbl = new IndexedHashtable();
     for (int i = 0; i < 5; i++)
     {
         tbl.Add("Key" + i, "Value" + i);
     }
 }
 public void testAddNullKey()
 {
     tbl.Add(null, null);
 }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
0
        public ZipcodeTO[] getCitiesInState(string stateAbbr)
        {
            gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao =
                new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString);
            ZipcodeTO[] result = new ZipcodeTO[1];
            result[0] = new ZipcodeTO();

            if (String.IsNullOrEmpty(stateAbbr))
            {
                result[0].fault = new FaultTO("Missing state abbreviation");
            }
            else if (stateAbbr.Length != 2)
            {
                result[0].fault = new FaultTO("Invalid state abbreviation", "Please supply a valid 2 letter abbreviation");
            }
            if (result[0].fault != null)
            {
                return result;
            }

            try
            {
                Zipcode[] zips = dao.getCitiesInState(stateAbbr);

                IndexedHashtable t = new IndexedHashtable();
                for (int i = 0; i < zips.Length; i++)
                {
                    if (!t.ContainsKey(zips[i].City))
                    {
                        t.Add(zips[i].City, zips[i]);
                    }
                }
                result = new ZipcodeTO[t.Count];
                for (int i = 0; i < t.Count; i++)
                {
                    result[i] = new ZipcodeTO((Zipcode)t.GetValue(i));
                }
            }
            catch (Exception exc)
            {
                result[0].fault = new FaultTO(exc);
            }
            return result;
        }
Ejemplo n.º 6
0
        public TaggedTextArray getNoteTitles(string sitecode, string target, string direction)
        {
            TaggedTextArray result = new TaggedTextArray();
            string msg = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);
            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            if (direction == "")
            {
                direction = "1";
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                Dictionary<string, ArrayList> x = _api.getNoteTitles(cxn, target, direction);
                IndexedHashtable t = new IndexedHashtable();
                t.Add(sitecode, x);
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Ejemplo n.º 7
0
 private IndexedHashtable mergeNotesAndDischargeSummaries(IndexedHashtable tNotes, IndexedHashtable tSummaries)
 {
     if (tNotes == null)
     {
         return tSummaries;
     }
     if (tSummaries == null)
     {
         return tNotes;
     }
     IndexedHashtable result = new IndexedHashtable(tNotes.Count + tSummaries.Count);
     for (int i = 0; i < tNotes.Count; i++)
     {
         Note[] notes = (Note[])tNotes.GetValue(i);
         int notesLength = (notes == null ? 0 : notes.Length);
         string key = (string)tNotes.GetKey(i);
         Note[] summaries = (Note[])tSummaries.GetValue(key);
         int summariesLength = (summaries == null ? 0 : summaries.Length);
         ArrayList lst = new ArrayList(notesLength + summariesLength);
         for (int j = 0; j < notesLength; j++)
         {
             lst.Add(notes[j]);
         }
         for (int j = 0; j < summariesLength; j++)
         {
             lst.Add(summaries[j]);
         }
         result.Add(key, (Note[])lst.ToArray(typeof(Note)));
     }
     return result;
 }