Esempio n. 1
0
 public void Add(ref HttpContext cctx, ref IDBManager dbmgr, ref Contact contact)
 {
     try
     {
         m_Rwlock.EnterWriteLock();
         int newId = 0;
         if (m_cachekey != "" && cctx != null && cctx.Cache[m_cachekey] != null)
         {
             var currentData = ((Contact[])cctx.Cache[m_cachekey]).ToList();
             newId = 1;
             if (currentData.Count > 0)
             {
                 Contact[] contactarray = (Contact[])cctx.Cache[m_cachekey];
                 newId = contactarray[currentData.Count - 1].Id + 1;
             }
             contact.Id = newId;
             currentData.Add(contact);
             cctx.Cache[m_cachekey] = currentData.ToArray();
         }
         dbmgr.Add(ref contact);
         SetCacheLastWriteTime(ref cctx, ref dbmgr);
     }
     finally
     {
         m_Rwlock.ExitWriteLock();
     }
     //catch (Exception ex)
     //{
     //    dbmgr.GetException(ref ex);
     //}
 }