Наследование: AbstractTaggedArrayTO
Пример #1
0
 public TaggedVisitArrays(IndexedHashtable t)
 {
     if (t.Count == 0)
     {
         return;
     }
     arrays = new TaggedVisitArray[t.Count];
     for (int i = 0; i < t.Count; i++)
     {
         if (t.GetValue(i) == null)
         {
             arrays[i] = new TaggedVisitArray((string)t.GetKey(i));
         }
         else if (MdwsUtils.isException(t.GetValue(i)))
         {
             arrays[i] = new TaggedVisitArray((string)t.GetKey(i), (Exception)t.GetValue(i));
         }
         else if (t.GetValue(i).GetType().IsArray)
         {
             arrays[i] = new TaggedVisitArray((string)t.GetKey(i), (Visit[])t.GetValue(i));
         }
         else
         {
             arrays[i] = new TaggedVisitArray((string)t.GetKey(i), (Visit)t.GetValue(i));
         }
     }
     count = t.Count;
 }
Пример #2
0
        public TaggedVisitArray getVisits(string sitecode, string fromDate, string toDate)
        {
            TaggedVisitArray result = new TaggedVisitArray();
            string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode);
            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (fromDate == "")
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            else if (toDate == "")
            {
                toDate = DateTime.Today.ToString("yyyyMMdd");
            }
            if (result.fault != null)
            {
                return result;
            }

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

            try
            {
                AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi api = new EncounterApi();
                Visit[] v = api.getVisits(cxn, fromDate, toDate);
                result = new TaggedVisitArray(sitecode, v);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return result;
        }