-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewTicketfrm.cs
61 lines (56 loc) · 1.77 KB
/
newTicketfrm.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Ticktr
{
public partial class newTicketfrm : Form
{
public newTicketfrm()
{
InitializeComponent();
this.AcceptButton = createBtn;
}
private void createBtn_Click(object sender, EventArgs e)
{
if (subjecttxt.TextLength !=0 && bodytxt.TextLength !=0)
{
ticket t = new ticket();
t.subject = subjecttxt.Text;
t.body = bodytxt.Text;
t.subjectHash = cryptography.hash(subjecttxt.Text);
t.bodyHash = cryptography.hash(bodytxt.Text);
//
ticket.createTicket(t);
}
else
{
MessageBox.Show("Both title and content must have a length greater than 0.", "Length error.", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void newTicket_FormClosing(object sender, FormClosingEventArgs e)
{
if (subjecttxt.Text != "" || bodytxt.Text !="")
{
if (MessageBox.Show("You have a unsaved ticket, are you sure you would like to exit ticktr?","Are you sure?", MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
{
publicItems.newOpen = false;
GC.Collect();
}
else
{
e.Cancel = true;
}
}
else
{
publicItems.newOpen = false;
GC.Collect();
}
}
}
}