Пример #1
0
 public static void Flush(ref ItemAccountStudents ActiveItem)
 {
     if (ActiveItem != null)
     {
         ActiveItem.lastVisted          = DateTime.Now;
         Pool_Logined[ActiveItem.token] = ActiveItem;
     }
 }
Пример #2
0
 public static void Push(ItemAccountStudents ActiveItem)
 {
     if (!Pool_Logined.ContainsKey(ActiveItem.token))
     {
         Pool_Logined.Add(ActiveItem.token, ActiveItem);
     }
     else
     {
         Flush(ref ActiveItem);
         Pool_Logined[ActiveItem.token] = ActiveItem;
     }
 }
Пример #3
0
        public static ItemAccountStudents CreateNewItem(string uid, string name, string password, object value)
        {
            ItemAccountStudents newStudentsItem = new ItemAccountStudents();

            newStudentsItem.id         = uid;
            newStudentsItem.token      = Guid.NewGuid().ToString();
            newStudentsItem.password   = password;
            newStudentsItem.regedtime  = DateTime.Now;
            newStudentsItem.lastVisted = DateTime.Now;
            newStudentsItem.value      = value;
            return(newStudentsItem);
        }
Пример #4
0
 public static void Clear()
 {
     foreach (string token in Pool_Logined.Keys)
     {
         ItemAccountStudents activeItem = Pool_Logined[token];
         if ((DateTime.Now - activeItem.regedtime).Hours > SPAN_REG_HOURS)
         {
             lock (Pool_Logined)
             {
                 Pool_Logined.Remove(activeItem.token);
             }
         }
         else if ((DateTime.Now - activeItem.lastVisted).Minutes > SPAN_EXPIRED_HOURS)
         {
             lock (Pool_Logined)
             {
                 Pool_Logined.Remove(activeItem.token);
             }
         }
     }
 }