-
Notifications
You must be signed in to change notification settings - Fork 2
/
Menu.cs
148 lines (137 loc) · 4.54 KB
/
Menu.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace University_Management_System_2
{
public partial class Home : Form
{
public Home()
{
InitializeComponent();
Count_Students();
Count_Department();
Count_Faculty();
Count_Campus();
SumFinances();
SumSalary();
}
SqlConnection Connection = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\HP\OneDrive\University Management System 2\UniversityDataBase.mdf;Integrated Security=True");
private void Count_Students()
{
Connection.Open();
SqlDataAdapter adaptor = new SqlDataAdapter("Select Count(*) from StudentTbl",Connection);
DataTable data = new DataTable();
adaptor.Fill(data);
Student_Num.Text = data.Rows[0][0].ToString();
Connection.Close();
}
private void Count_Faculty()
{
Connection.Open();
SqlDataAdapter adaptor = new SqlDataAdapter("Select Count(*) from FacultyTbl", Connection);
DataTable data = new DataTable();
adaptor.Fill(data);
Faculty_Lbl.Text = data.Rows[0][0].ToString();
Connection.Close();
}
private void Count_Department()
{
Connection.Open();
SqlDataAdapter adaptor = new SqlDataAdapter("Select Count(*) from DepartmentTbl", Connection);
DataTable data = new DataTable();
adaptor.Fill(data);
Dept_Num.Text = data.Rows[0][0].ToString();
Connection.Close();
}
private void Count_Campus()
{
Connection.Open();
SqlDataAdapter adaptor = new SqlDataAdapter("Select Count(*) from CampusTbl", Connection);
DataTable data = new DataTable();
adaptor.Fill(data);
Camp_Num.Text = data.Rows[0][0].ToString();
Connection.Close();
}
private void SumFinances()
{
Connection.Open();
SqlDataAdapter adaptor = new SqlDataAdapter("Select Sum(Amount) from FeesTbl", Connection);
DataTable data = new DataTable();
adaptor.Fill(data);
FinancesLbl.Text = "Rs. " + data.Rows[0][0].ToString();
Connection.Close();
}
private void SumSalary()
{
Connection.Open();
SqlDataAdapter adaptor = new SqlDataAdapter("Select Sum(Salary) from SalaryTbl", Connection);
DataTable data = new DataTable();
adaptor.Fill(data);
Salary_Lbl.Text = "Rs. " + data.Rows[0][0].ToString();
Connection.Close();
}
private void Student_Lbl_Click(object sender, EventArgs e)
{
Student Std = new Student();
this.Hide();
Std.Show();
}
private void Dept_Lbl_Click(object sender, EventArgs e)
{
Department Dept = new Department();
this.Hide();
Dept.Show();
}
private void Fac_Lbl_Click(object sender, EventArgs e)
{
Faculty Fac = new Faculty();
this.Hide();
Fac.Show();
}
private void Course_Lbl_Click(object sender, EventArgs e)
{
Courses Course = new Courses();
this.Hide();
Course.Show();
}
private void Camp_Lbl_Click(object sender, EventArgs e)
{
Campus Camp = new Campus();
this.Hide();
Camp.Show();
}
private void FeeLbl_Click(object sender, EventArgs e)
{
Fees Fee = new Fees();
this.Hide();
Fee.Show();
}
private void CloseBtn_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void MinimizeBtn_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void LogOut_Lbl_Click(object sender, EventArgs e)
{
Login log = new Login();
this.Hide();
log.Show();
}
private void Sal_Lbl_Click(object sender, EventArgs e)
{
Salaries Sal = new Salaries();
this.Hide();
Sal.Show();
}
}
}