Ejemplo n.º 1
0
        /// <summary>
        /// Add an unsafe item to the list
        /// </summary>
        /// <param name="type"></param>
        /// <param name="layoutId"></param>
        /// <param name="id"></param>
        /// <param name="reason"></param>
        /// <param name="ttl"></param>
        public void AddUnsafeItem(UnsafeItemType type, int layoutId, string id, string reason, int ttl)
        {
            if (ttl == 0)
            {
                ttl = 86400;
            }

            try
            {
                UnsafeItem item = _unsafeItems
                                  .Where(i => i.Type == type && i.LayoutId == layoutId && i.Id == id)
                                  .First();

                item.DateTime = DateTime.Now;
                item.Reason   = reason;
            }
            catch
            {
                _unsafeItems.Add(new UnsafeItem
                {
                    DateTime = DateTime.Now,
                    Type     = type,
                    LayoutId = layoutId,
                    Id       = id,
                    Reason   = reason,
                    Ttl      = ttl
                });
            }

            ClientInfo.Instance.UpdateUnsafeList(UnsafeListAsString());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Add an unsafe item to the list
 /// </summary>
 /// <param name="type"></param>
 /// <param name="layoutId"></param>
 /// <param name="id"></param>
 /// <param name="reason"></param>
 public void AddUnsafeItem(UnsafeItemType type, int layoutId, string id, string reason)
 {
     AddUnsafeItem(type, layoutId, id, reason, 86400);
 }