aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFileEvent.cs
blob: 49027f447e888999a121ffe4df1d3bb24f1d360a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Entities;

namespace Tango.Integration.Diagnostics
{
    [Serializable]
    public class DiagnosticsFileEvent
    {
        public DateTime DateTime { get; set; }

        public String EventTypeGuid { get; set; }

        public String HostName { get; set; }

        public String UserGuid { get; set; }

        public String MachineGuid { get; set; }

        public String Description { get; set; }

        public DiagnosticsFileEvent()
        {

        }

        public DiagnosticsFileEvent(MachinesEvent ev) : this()
        {
            DateTime = ev.DateTime;
            EventTypeGuid = ev.EventType.Guid;
            HostName = ev.HostName;
            UserGuid = ev.UserGuid;
            MachineGuid = ev.MachineGuid;
            Description = ev.Description;
        }

        public MachinesEvent ToMachineEvent()
        {
            MachinesEvent ev = new MachinesEvent();
            ev.DateTime = DateTime;
            ev.EventType = ObservablesStaticCollections.Instance.EventTypes.SingleOrDefault(x => x.Guid == EventTypeGuid);
            ev.Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.Guid == MachineGuid);
            ev.User = ObservablesStaticCollections.Instance.Users.SingleOrDefault(x => x.Guid == UserGuid);
            ev.Description = Description;
            ev.HostName = HostName;

            return ev;
        }
    }
}