-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvent.cs
71 lines (62 loc) · 2.42 KB
/
Event.cs
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
using System.Windows;
namespace powerLabel
{
public class Event
{
public int id { get; set; }
public string employee { get; set; }
public string name { get; set; }
public string description { get; set; }
public string note { get; set; }
public ComputerSystem computerSystem { get; set; }
public DateTime date { get; set; }
public Event()
{
}
public Event(string employee, string eventName, string description, DateTime date, ComputerSystemContext db, ComputerSystem cs, string note = "")
{
try
{
this.computerSystem = cs;
}
catch (Exception)
{
MessageBox.Show("Cannot make event when there is no system scanned.");
throw;
}
this.employee = employee;
this.name = eventName;
this.description = description;
this.note = note;
this.date = date;
}
public static Event NewPrintEvent(string employee, DateTime date, ComputerSystemContext db, ComputerSystem cs, string note = "")
{
string name = "Printed Label";
string description = "A label with the specs of this system has been printed.";
return new Event(employee, name, description, date, db, cs, note);
}
public static Event NewScanEvent(string employee, DateTime date, ComputerSystemContext db, ComputerSystem cs, string note = "")
{
string name = "System Scanned";
string description = "The specifications of the system have been scanned and recorded in the database.";
return new Event(employee, name, description, date, db, cs, note);
}
public static Event NewMarkedAsOrderEvent(string employee, DateTime date, ComputerSystemContext db, ComputerSystem cs, string note = "")
{
string name = "Marked As Order";
string description = "";
foreach (Window window in Application.Current.Windows)
{
if (window.GetType() == typeof(MainWindow))
{
description = (window as MainWindow).orderNr.Text;
}
}
return new Event(employee, name, description, date, db, cs, note);
}
}
}