-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAddTask.cs
33 lines (29 loc) · 1.04 KB
/
AddTask.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
using System.Data;
namespace EmployeeManagementSystem
{
public partial class AddTask : Form
{
public AddTask()
{
var employeeList = Program.userList.GetAllEmployees().Select(e => e.Username);
InitializeComponent();
taskAssignedEmployee.DataSource = employeeList.ToList();
}
private void addBtn_Click(object sender, EventArgs e)
{
string desc = taskDesc.Text;
DateTime date = taskDueDate.Value;
string assignedEmp = taskAssignedEmployee.SelectedItem.ToString();
User emp = Program.userList.GetByUsername(assignedEmp);
MessageBox.Show($"{desc} {date} {assignedEmp}");
Tasks tsk = new(desc, date, emp.Name);
Program.tasksList.AddTask(tsk);
emp.AssignedTasks.Add(tsk);
emp.UncompletedTasks++;
AdminForm admin = new();
admin.tasks.DataSource = Program.tasksList.GetAllTasks();
this.Hide();
admin.Show();
}
}
}