-
Notifications
You must be signed in to change notification settings - Fork 0
/
JobsList.cs
77 lines (71 loc) · 2.39 KB
/
JobsList.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
72
73
74
75
76
77
using Job_Application_Database.IO;
using Job_Application_Database.Singleton;
using System.Windows;
namespace Job_Application_Database.Classes
{
/// <summary>
/// Class For Displaying Jobs Lists
/// </summary>
public class JobsList : BaseList
{
/// <summary>
/// Default Constructor
/// </summary>
public JobsList() : base("Job", Jobs.Instance.AllObjects()) { }
/// <summary>
/// Add Job To Jobs List
/// </summary>
protected override void Add()
{
JobCreation jcw = new JobCreation();
jcw.ShowDialog();
if (jcw.Exit == Enum.ExitStatus.Ok)
{
Jobs.Instance.AddObject(jcw.Info);
Files.Instance.SaveJobFile();
RefreshListView(Jobs.Instance);
}
}
/// <summary>
/// Edit Job From Jobs List
/// </summary>
protected override void Edit()
{
Job j = BaseListWindow.listviewCurrent.SelectedItem as Job;
if (j != null)
{
JobCreation jcw = new JobCreation(j);
jcw.ShowDialog();
Files.Instance.SaveJobFile();
RefreshListView(Jobs.Instance);
}
}
/// <summary>
/// Delete Job From Jobs List
/// </summary>
protected override void Delete()
{
if (BaseListWindow.listviewCurrent.SelectedItem != null)
{
string msg;
if (BaseListWindow.listviewCurrent.SelectedItems.Count > 1)
{
msg = "these " + BaseListWindow.listviewCurrent.SelectedItems.Count + " Jobs?";
}
else
{
msg = (BaseListWindow.listviewCurrent.SelectedItems[0] as IBaseInfo).Name + "?";
}
if (MessageBox.Show("Are you sure you want to delete " + msg, "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
{
foreach (BaseInfo info in BaseListWindow.listviewCurrent.SelectedItems)
{
Jobs.Instance.RemoveObject(info);
}
Files.Instance.SaveJobFile();
RefreshListView(Jobs.Instance);
}
}
}
}
}