-
Notifications
You must be signed in to change notification settings - Fork 0
/
RepsList.cs
77 lines (71 loc) · 2.39 KB
/
RepsList.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 Reps Lists
/// </summary>
public class RepsList : BaseList
{
/// <summary>
/// Base Constructor
/// </summary>
public RepsList() : base("Rep", Reps.Instance.AllObjects()) { }
/// <summary>
/// Add Rep To Reps List
/// </summary>
protected override void Add()
{
RepCreation jcw = new RepCreation();
jcw.ShowDialog();
if (jcw.Exit == Enum.ExitStatus.Ok)
{
Reps.Instance.AddObject(jcw.Info);
Files.Instance.SaveRepFile();
RefreshListView(Reps.Instance);
}
}
/// <summary>
/// Edit Rep From Reps List
/// </summary>
protected override void Edit()
{
Rep r = BaseListWindow.listviewCurrent.SelectedItem as Rep;
if (r != null)
{
RepCreation jcw = new RepCreation(r);
jcw.ShowDialog();
Files.Instance.SaveRepFile();
RefreshListView(Reps.Instance);
}
}
/// <summary>
/// Delete Rep From Reps 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 + " Reps?";
}
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)
{
Reps.Instance.RemoveObject(info);
}
Files.Instance.SaveRepFile();
RefreshListView(Reps.Instance);
}
}
}
}
}