private void LoadFromDataBase()
        {
            DataTable dt = _provider.Select(_tableName);

            foreach (DataRow row in dt.Rows)
            {
                History history = new History(row);

                if (history.CanAdd)
                    Add(history);
            }
        }
        public static void Save(IHistory orgHistory, User user, HistoryAction action = HistoryAction.Создал)
        {
            HistoryList historyList = HistoryList.GetUniqueInstance();

            History history;

            if (action == HistoryAction.Удалил)
            {
                history = new History(orgHistory, user);
                history.Action = action;
            }
            else
            {
                var list = historyList.GetList(orgHistory);

                if (list.Count == 2)
                {
                    history = historyList.GetItem(orgHistory, HistoryAction.Редактировал);
                    history._user = user;
                }
                else
                {
                    history = new History(orgHistory, user);
                    history.Action = (list.Count == 0) ? HistoryAction.Создал : HistoryAction.Редактировал;
                }
            }

            history._datetime = DateTime.Now;

            history.Save();

            historyList.Add(history);
        }
 public void Add(History history)
 {
     if (!_list.Exists(item => item == history))
         _list.Add(history);
 }