-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdateTask.xaml.cs
More file actions
71 lines (64 loc) · 2.66 KB
/
UpdateTask.xaml.cs
File metadata and controls
71 lines (64 loc) · 2.66 KB
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
using KanbanProjectManager.Classes;
using System;
using System.Collections.Generic;
using System.Linq;
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 KanbanProjectManager
{
/// <summary>
/// Interaction logic for UpdateTask.xaml
/// </summary>
public partial class UpdateTask : Window
{
KanbanTask selectedKanbanTask;
public UpdateTask(KanbanTask selectedKanbanTask)
{
InitializeComponent();
Owner = Application.Current.MainWindow;
WindowStartupLocation = WindowStartupLocation.CenterOwner;
TextRange textRange = new TextRange(rtbRemarks.Document.ContentStart, rtbRemarks.Document.ContentEnd);
this.selectedKanbanTask = selectedKanbanTask;
projectNameTextBox.Text = this.selectedKanbanTask.ProjectName;
projectDescriptionTextBox.Text = this.selectedKanbanTask.ProjectDescription;
startDatePicker.SelectedDate = this.selectedKanbanTask.Start;
endDatePicker.SelectedDate =this.selectedKanbanTask.Stop;
textRange.Text = this.selectedKanbanTask.Remarks;
}
private void Update_Button_Click(object sender, RoutedEventArgs e)
{
TextRange textRange = new TextRange(rtbRemarks.Document.ContentStart, rtbRemarks.Document.ContentEnd);
selectedKanbanTask.ProjectName = projectNameTextBox.Text;
selectedKanbanTask.ProjectDescription = projectDescriptionTextBox.Text;
selectedKanbanTask.Start = (DateTime)startDatePicker.SelectedDate;
selectedKanbanTask.Stop = (DateTime)endDatePicker.SelectedDate;
selectedKanbanTask.Remarks = textRange.Text;
SQLDatabaseHandler.Update(selectedKanbanTask);
this.Close();
}
private void Delete_Button_Click(object sender, RoutedEventArgs e)
{
SQLDatabaseHandler.Delete(selectedKanbanTask);
this.Close();
}
private void Calculate_Button_Click(object sender, RoutedEventArgs e)
{
DateTime startTime = (DateTime)startDatePicker.SelectedDate;
DateTime stopTime = (DateTime)endDatePicker.SelectedDate;
TimeUsed timeUsed = new TimeUsed();
timeUsed.CalculateTimeUsed(startTime, stopTime);
}
private void Cancel_Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}