-
Notifications
You must be signed in to change notification settings - Fork 3
/
StaffNotificationDisplay.cs
66 lines (57 loc) · 1.87 KB
/
StaffNotificationDisplay.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
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.Windows.Forms;
namespace Login
{
public partial class StaffNotificationDisplay : Form
{
SqlConnection sqlConn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\AsokaCollegeDB\School_DataBase.mdf;Integrated Security=True;Connect Timeout=30");
public StaffNotificationDisplay()
{
InitializeComponent();
fillDataGridView();
}
private void button2_Click(object sender, EventArgs e)
{
this.Hide();
StaffEventDashboard Sed1 = new StaffEventDashboard();
Sed1.ShowDialog();
}
void fillDataGridView()
{
if (sqlConn.State == ConnectionState.Closed)
sqlConn.Open();
SqlDataAdapter sqlDa = new SqlDataAdapter("NotificationSearch_Procedure", sqlConn);
sqlDa.SelectCommand.CommandType = CommandType.StoredProcedure;
sqlDa.SelectCommand.Parameters.AddWithValue("@NotiTag", txtSearch.Text.Trim());
DataTable dtbl = new DataTable();
sqlDa.Fill(dtbl);
dataGridView1.DataSource = dtbl;
dataGridView1.Columns[0].Visible = false;
sqlConn.Close();
}
private void Search_Click(object sender, EventArgs e)
{
try
{
fillDataGridView();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error Message.");
}
}
private void button3_Click(object sender, EventArgs e)
{
this.Hide();
StaffLog1 Ed1 = new StaffLog1();
Ed1.ShowDialog();
}
}
}