-
Notifications
You must be signed in to change notification settings - Fork 3
/
Login.cs
116 lines (104 loc) · 3.85 KB
/
Login.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
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 Login : Form
{
public Login()
{
InitializeComponent();
}
SqlConnection Connection = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\HP\OneDrive\University Management System 2\UniversityDataBase.mdf;Integrated Security=True");
private void LoginBtn_Click(object sender, EventArgs e)
{
try
{
if (UserNameTb.Text == "" || PasswordTb.Text =="")
{
MessageBox.Show("Please Enter Credentials...!!", "University Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
Connection.Open();
SqlCommand cmd = new SqlCommand("Select * from LoginTbl where Username=@user and Password=@pass", Connection);
cmd.Parameters.AddWithValue("@user", UserNameTb.Text);
cmd.Parameters.AddWithValue("@pass", PasswordTb.Text);
SqlDataAdapter adpt = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
adpt.Fill(dt);
Connection.Close();
if (dt.Rows.Count == 1)
{
Home home = new Home();
DialogBox Db = new DialogBox("Success");
Db.ShowDialog();
this.Hide();
home.Show();
}
else
{
MessageBox.Show("Wrong Username Or Password...!!", "University Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "University Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://rizankhan.me");
}
private void MinimizeBtn_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void CloseBtn_Click_1(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void ShowPass_CheckedChanged_1(object sender, EventArgs e)
{
if (ShowPass.Checked)
{
PasswordTb.UseSystemPasswordChar = false;
}
else
{
PasswordTb.UseSystemPasswordChar = true;
}
}
private void PasswordTb_TextChanged(object sender, EventArgs e)
{
PasswordTb.UseSystemPasswordChar = true;
}
private void guna2CirclePictureBox1_Click(object sender, EventArgs e)
{
Process.Start(@"https://www.facebook.com/rizankhan837");
}
private void guna2CirclePictureBox2_Click(object sender, EventArgs e)
{
Process.Start(@"https://www.linkedin.com/in/rizwanakram837/");
}
private void guna2CirclePictureBox3_Click(object sender, EventArgs e)
{
Process.Start(@"https://github.com/RizanKhan837");
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Signup Sign = new Signup();
this.Hide();
Sign.Show();
}
}
}