Exemplo n.º 1
0
        private async Task ExecuteRefresh()
        {
            try
            {
                int?id   = Selected?.ID;
                var logs = await _dbservicewms.GetLogs(DateFrom.TimeStamp, DateTo.TimeStamp);

                DataList.Clear();
                foreach (var p in logs)
                {
                    DataList.Add(new LogViewModel
                    {
                        ID       = p.ID,
                        Severity = (EnumLogWMS)p.Severity,
                        Source   = p.Source,
                        Message  = p.Message,
                        Time     = p.Time
                    });
                }
                foreach (var l in DataList)
                {
                    l.Initialize(_warehouse);
                }
                Records = DataList.Count();
                if (id != null)
                {
                    Selected = DataList.FirstOrDefault(p => p.ID == id);
                }
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                    string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }