-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHomeWindow.xaml.cs
195 lines (155 loc) · 5.73 KB
/
HomeWindow.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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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;
using System.Security.Principal;
using System.Data.Common;
//using System.Web.ClientServices.Providers;
using Invoice365.util;
using System.IO;
using Microsoft.Win32;
using System.Globalization;
using System.Threading;
namespace Invoice365
{
/// <summary>
/// Interaction logic for HomeWindow.xaml
/// </summary>
public partial class HomeWindow : Window
{
public static string user = "";
public static Boolean isAdmin = false;
public HomeWindow()
{
DB.getInstance(DB.MSSQL);
/*WindowsIdentity w = WindowsIdentity.GetCurrent();
string name = w.Name;
int idx = name.IndexOf("\\");
if(idx > 0)
name = name.Substring(idx+1);
user = name;*/
//LicenserIdentification.Form1 f = new LicenserIdentification.Form1();
InitializeComponent();
}
public void Window_Initialized(object sender, EventArgs e)
{
LicenserAPI.Logic l = new LicenserAPI.Logic();
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\license.xml";
string npath = LicenseUtil.licenseCheck(path);
if (string.IsNullOrEmpty(npath) || !l.IsValid(npath, "Invoice365", "inv365", false))
{
LicenseMessage lm = new LicenseMessage(LicenseMessage.MSG);
bool res = (bool)lm.ShowDialog();
if (!res)
{
if (!File.Exists(path))
Environment.Exit(0);
else if(l.IsValid(path, "Invoice365", "inv365", false))
{
MessageBox.Show("License File Inserted Successfully");
}
}
}
else if (!string.IsNullOrEmpty(npath))
{
//MessageBox.Show("License file Inserted Successfully");
}
}
private void DashboardClick(object sender, RoutedEventArgs e)
{
navigate(new NewInvoice());
}
private void InvClick(object sender, RoutedEventArgs e)
{
navigate(new Inventory());
}
private void InvoicesClick(object sender, RoutedEventArgs e)
{
navigate(new Invoices());
}
private void customer_Click(object sender, RoutedEventArgs e)
{
navigate(new CustomerFrame());
}
private void navigate(object _fr)
{
//this.ContentFrame.RemoveBackEntry();
this.ContentFrame.Navigate(_fr);
this.ContentFrame.RemoveBackEntry();
}
private void reports_Click(object sender, RoutedEventArgs e)
{
navigate(new SalesReport(SalesReport.SALES));
}
private void customerDue_Click(object sender, RoutedEventArgs e)
{
navigate(new SalesReport(SalesReport.CUSTOMER_DUE));
}
private void wcustomerreports_Click(object sender, RoutedEventArgs e)
{
navigate(new SalesReport(SalesReport.WEEKLY,SalesReport.CUSTOMER));
}
private void wbillerreports_Click(object sender, RoutedEventArgs e)
{
navigate(new SalesReport(SalesReport.WEEKLY, SalesReport.BILLER));
}
private void wreports_Click(object sender, RoutedEventArgs e)
{
navigate(new SalesReport(SalesReport.WEEKLY, SalesReport.SALES));
}
private void wcustomerDue_Click(object sender, RoutedEventArgs e)
{
navigate(new SalesReport(SalesReport.WEEKLY, SalesReport.CUSTOMER_DUE));
}
private void customerreports_Click(object sender, RoutedEventArgs e)
{
navigate(new SalesReport(SalesReport.CUSTOMER));
}
private void billerreports_Click(object sender, RoutedEventArgs e)
{
navigate(new SalesReport(SalesReport.BILLER));
}
private void billers_Click(object sender, RoutedEventArgs e)
{
navigate(new Biller(true));
}
private void about_Click(object sender, RoutedEventArgs e)
{
AboutEWeb ae = new AboutEWeb();
ae.Show();
}
private void expBillers_Click(object sender, RoutedEventArgs e)
{
navigate(new Export(Export.BILLER));
}
private void expCustomers_Click(object sender, RoutedEventArgs e)
{
navigate(new Export(Export.CUSTOMER));
}
private void expInventory_Click(object sender, RoutedEventArgs e)
{
navigate(new Export(Export.INVENTORY));
}
private void expInvoices_Click(object sender, RoutedEventArgs e)
{
navigate(new Export(Export.INVOICE));
}
private void help_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+"\\Invoice365.chm");
}
private void update_Click(object sender, RoutedEventArgs e)
{
LicenseMessage dlg = new LicenseMessage(LicenseMessage.REGISTER, "Update License");
dlg.Show();
}
}
}