-
Notifications
You must be signed in to change notification settings - Fork 0
/
Companies.cs
133 lines (116 loc) · 4.49 KB
/
Companies.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using Job_Application_Database.Classes;
using Job_Application_Database.Enum;
using System.Collections;
using System.Collections.Generic;
namespace Job_Application_Database.Singleton
{
/// <summary>
/// Companies Singleton Class
/// </summary>
public sealed class Companies : BaseSingleton
{
/// <summary>
/// The Instance Of The Companies Singleton
/// </summary>
public new static Companies Instance
{
get
{
return Singleton<Companies>.Instance;
}
}
/// <summary>
/// Gets All Position Types In A Counted KeyValuePair
/// </summary>
/// <returns>A List\<KeyValuePair\<string,int\>\> Of The Position Types</returns>
public List<KeyValuePair<string, int>> PositionKeyValue()
{
List<KeyValuePair<string, int>> kvp = new List<KeyValuePair<string, int>>();
int na = 0;
int pt = 0;
int ft = 0;
int ct = 0;
foreach (Company c in AllObjects())
{
if (c.Position == PositionType.NA)
na++;
else if (c.Position == PositionType.Part)
pt++;
else if (c.Position == PositionType.Full)
ft++;
else if (c.Position == PositionType.Contract)
ct++;
}
kvp.Add(new KeyValuePair<string, int>("N/A", na));
kvp.Add(new KeyValuePair<string, int>("Part Time", pt));
kvp.Add(new KeyValuePair<string, int>("Full Time", ft));
kvp.Add(new KeyValuePair<string, int>("Contract", ct));
return kvp;
}
/// <summary>
/// Gets All Application Status' In A Counted KeyValuePair
/// </summary>
/// <returns>A List\<KeyValuePair\<string,int\>\> Of Application Status'</returns>
public List<KeyValuePair<string, int>> StatusKeyValue()
{
List<KeyValuePair<string, int>> kvp = new List<KeyValuePair<string, int>>();
int app = 0;
int hun = 0;
int ass = 0;
int intr = 0;
int off = 0;
int acc = 0;
int den = 0;
int rej = 0;
foreach (Company c in AllObjects())
{
if (c.Status.HasFlag(ApplicationStatus.Applied))
app++;
if (c.Status.HasFlag(ApplicationStatus.Hunted))
hun++;
if (c.Status.HasFlag(ApplicationStatus.Assignment))
ass++;
if (c.Status.HasFlag(ApplicationStatus.Interview))
intr++;
if (c.Status.HasFlag(ApplicationStatus.Offered))
off++;
if (c.Status.HasFlag(ApplicationStatus.Accepted))
acc++;
if (c.Status.HasFlag(ApplicationStatus.Denied))
den++;
if (c.Status.HasFlag(ApplicationStatus.Rejected))
rej++;
}
kvp.Add(new KeyValuePair<string, int>("Applied", app));
kvp.Add(new KeyValuePair<string, int>("Hunted", hun));
kvp.Add(new KeyValuePair<string, int>("Assignment", ass));
kvp.Add(new KeyValuePair<string, int>("Interviewed", intr));
kvp.Add(new KeyValuePair<string, int>("Offered", off));
kvp.Add(new KeyValuePair<string, int>("Accepted", acc));
kvp.Add(new KeyValuePair<string, int>("Denied", den));
kvp.Add(new KeyValuePair<string, int>("Rejected", rej));
return kvp;
}
/// <summary>
/// Gets All Job Titles In A Counted KeyValuePair
/// </summary>
/// <returns>A List\<KeyValuePair\<string,int\>\> Of Job Titles</returns>
public List<KeyValuePair<string, int>> JobKeyValue()
{
List<KeyValuePair<string, int>> kvp = new List<KeyValuePair<string, int>>();
Hashtable table = new Hashtable();
foreach (Company c in AllObjects())
{
if (table[c.JobID] == null)
table.Add(c.JobID, 1);
else
table[c.JobID] = (int)table[c.JobID] + 1;
}
foreach(DictionaryEntry de in table)
{
kvp.Add(new KeyValuePair<string, int>(Jobs.Instance.ObjectAt((int)de.Key).Name, (int)de.Value));
}
return kvp;
}
}
}