예제 #1
0
        public void AddElement(LoadLevellingWork newelement)
        {
            var fname = MethodBase.GetCurrentMethod().DeclaringType?.Name + "." + MethodBase.GetCurrentMethod().Name;

            try
            {
                // Test di consistenza
                var invalid = (from rec in _list
                               where rec.ID != null && rec.ID == newelement.ID
                               select rec).Any();
                if (invalid)
                {
                    throw new TraceException(fname, "Rilevata chiave multipla. Oggetto non valido");
                }
                _list.Add(newelement);
            }
            catch (TraceException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new TraceException(fname, e.Message);
            }
        }
예제 #2
0
 public void Push(LoadLevellingWork newelement)
 {
     if (!_fifo.Contains(newelement))
     {
         _fifo.Enqueue(newelement);
     }
 }
예제 #3
0
        public LoadLevellingWork RemoveLast()
        {
            var count = _list.Count;
            LoadLevellingWork retval = null;

            if (count > 0)
            {
                retval = _list.Last();
                _list.RemoveAt(count - 1);
            }
            return(retval);
        }
예제 #4
0
 public bool RemoveElement(LoadLevellingWork toremove) => _list.Remove(toremove);