-
Notifications
You must be signed in to change notification settings - Fork 0
/
ManageForm.cs
100 lines (87 loc) · 2.96 KB
/
ManageForm.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TicketSelling.Manager;
namespace TicketSelling
{
public partial class ManagerForm : Form
{
private SQL sql;
private string ID;
private List<Form> tempForm;
public ManagerForm(string ID)
{
InitializeComponent();
sql = new SQL("DESKTOP-IV065AL", "sa", "123456", "TicketSelling");
this.ID = ID;
tempForm = new List<Form>();
ShowChildForm(new ControlForm(this.sql, this.ID));
}
private void ControlBt_Click(object sender, EventArgs e)
{
//RightPanel.Controls.Clear();
ShowChildForm(new ControlForm(this.sql, this.ID));
}
private void ShowChildForm(Form child)
{
if (tempForm.Count != 0)
{
foreach (var x in tempForm)
{
if (x.GetType() == child.GetType())
{
tempForm[tempForm.Count - 1].Hide();
x.BringToFront();
x.Show();
return;
}
}
}
child.TopLevel = false;
child.FormBorderStyle = FormBorderStyle.None;
child.Dock = DockStyle.Top;
RightPanel.Controls.Add(child);
tempForm.Add(child);
child.BringToFront();
child.Show();
}
private void button1_Click(object sender, EventArgs e)
{
//RightPanel.Controls.Clear();
ShowChildForm(new fBill(this.sql));
}
private void btnSearchTicket_Click(object sender, EventArgs e)
{
//RightPanel.Controls.Clear();
ShowChildForm(new fSearchTicket());
}
private void button1_Click_1(object sender, EventArgs e)
{
//RightPanel.Controls.Clear();
ShowChildForm(new fDriverMana(this.sql, this.ID));
}
private void btnManaUser_Click(object sender, EventArgs e)
{
//RightPanel.Controls.Clear();
ShowChildForm(new UserMana(this.sql, this.ID));
}
private void btnExit_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are you sure to exit the application?", "Annoucement", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
{
Environment.Exit(0);
//Application.Exit();
}
}
private void button2_Click(object sender, EventArgs e)
{
ShowChildForm(new fQuerry());
}
}
}