-
Notifications
You must be signed in to change notification settings - Fork 1
/
FindCandidate.xaml.cs
98 lines (75 loc) · 3.3 KB
/
FindCandidate.xaml.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
using BLL;
using DAL.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.PortableExecutable;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace UI
{
/// <summary>
/// Interaction logic for FindCandidate.xaml
/// </summary>
public partial class FindCandidate : Window
{
public EmployeeManagerBLL EmployeeManagerBLL { get; set; }
public List<Candidate> ListOfCandidate { get; set; }
public Dictionary<int, List<InformationInterviewer>> DicIdCandidateToAllIntreview { get; set; }
public List<Interview> ListOfInterview { get; set; }
public List<Employee> ListOfEmployee { get; set; }
public FindCandidate()
{
EmployeeManagerBLL = new EmployeeManagerBLL();
InitializeComponent();
DataContext = this;
ListOfCandidate = EmployeeManagerBLL.GetAllCandidates();
ListOfInterview = EmployeeManagerBLL.GetAllInterview();
ListOfEmployee = EmployeeManagerBLL.GetAllEmployees();
DicIdCandidateToAllIntreview = new Dictionary<int, List<InformationInterviewer>>();
BuildDicIdCandidateToIntreview();
}
public void BuildDicIdCandidateToIntreview()
{
var lstInterviews = new List<InformationInterviewer>();
Dictionary<int, Employee> DicEmployeeById = new Dictionary<int, Employee>();
foreach (var employee in ListOfEmployee)
{
DicEmployeeById.Add(employee.Id, employee);
}
foreach (Candidate candidate in ListOfCandidate)
{
lstInterviews = ListOfInterview.Where(interview => interview.CandidateId == candidate.Id)
.OrderBy(iterview => iterview.InterviewDate)
.Select(interview => new InformationInterviewer
{
InterviewNumber = interview.InterviewNumber,
InterviewDate = interview.InterviewDate,
RoleInCompany = interview.RoleInCompany,
NameInterviewer = DicEmployeeById.ContainsKey(interview.InterviewerId) ?
DicEmployeeById[interview.InterviewerId].FirstName + " " + DicEmployeeById[interview.InterviewerId].LastName :
"Interviewer Not Found",
PhoneInterviewer = DicEmployeeById.ContainsKey(interview.InterviewerId) ?
DicEmployeeById[interview.InterviewerId].PhoneNumber : "Phone Not Found",
}).ToList();
DicIdCandidateToAllIntreview.Add(candidate.Id, lstInterviews);
}
}
public void FilterByselectedInterviewer(object sender, SelectionChangedEventArgs e)
{
var selectedItem = (sender as ComboBox).SelectedItem;
if (selectedItem != null && DicIdCandidateToAllIntreview.ContainsKey(((Candidate)selectedItem).Id))
{
DataGridInterviews.ItemsSource = DicIdCandidateToAllIntreview[((Candidate)selectedItem).Id];
}
}
}
}