-
Notifications
You must be signed in to change notification settings - Fork 0
/
SalesRecord.xaml.cs
96 lines (88 loc) · 2.94 KB
/
SalesRecord.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
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.Navigation;
using System.Windows.Shapes;
namespace JBWally
{
/// <summary>
/// Interaction logic for SalesRecord.xaml
/// </summary>
public partial class SalesRecord : Page
{
/// <summary>
/// constructor for sales record if the recently created order is requested to be shown, then it calls the ShowSalesRecord method.
/// Otherwise, for any previous records, it calls the ShowPreviousSalesRecord() method
/// </summary>
public SalesRecord()
{
InitializeComponent();
if (Orders.previousOrder == false)
{
ShowSalesRecord();
}
else
{
ShowPreviousSalesRecord();
}
}
/// <summary>
/// Show the details for the order just created.
/// </summary>
public void ShowSalesRecord()
{
paid.Visibility = Visibility.Visible;
string lines = "";
foreach (string s in Orders.OrderDetails)
{
lines = lines + s;
Sales.Text = lines;
}
Orders.OrderDetails.Clear();
string date = DateTime.Now.ToString("dd/MM/yyyy");
thank.Text = "Thank you for Shopping at\nWallys World\nCustomer Name: " + Database.firstName + " " + Database.lastName + "\nDate: " + date;
}
/// <summary>
/// show the details for any previous sales record
/// </summary>
public void ShowPreviousSalesRecord()
{
Sales.Text = Orders.OrderDesc;
paid.Visibility = Visibility.Hidden;
}
/// <summary>
/// On click go to the Order page if a new order is created, other wise go to employee page
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void HomeButton_Click(object sender, RoutedEventArgs e)
{
if(Orders.orderPage == true)
{
NavigationService.Navigate(new Uri("Order.xaml", UriKind.RelativeOrAbsolute));
}
else
{
NavigationService.Navigate(new Uri("Employee.xaml", UriKind.RelativeOrAbsolute));
}
}
/// <summary>
/// Go to the employee page
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("Employee.xaml", UriKind.RelativeOrAbsolute));
}
}
}