-
Notifications
You must be signed in to change notification settings - Fork 1
/
Login.cs
103 lines (86 loc) · 2.98 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
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 System.Diagnostics;
using System.Data.SqlClient;
namespace PayrollSystem
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
SqlConnection Con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\Trials\PayrollSystem\PayRollDB.mdf;Integrated Security=True;Connect Timeout=30");
public static string Users;
private void Login_Load(object sender, EventArgs e)
{
}
private void pictureBox9_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Btn_Click(object sender, EventArgs e)
{
/*if (User.Text == "" || Pass.Text == "")
MessageBox.Show("Missing Information!!");
else if (User.Text == "Admin" || Pass.Text == "123")
{
Home Obj = new Home();
Obj.Show();
this.Hide();
}
else
MessageBox.Show("Wrong UserName or Password!");*/
}
private void gunaLinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("http://localhost:54435/home.aspx");
}
private void LoginBtnn_Click(object sender, EventArgs e)
{
if (User.Text == "" || Pass.Text == "")
MessageBox.Show("Missing Information!!");
else if (User.Text == "Admin" && Pass.Text == "123")
{
Users = User.Text;
Home Obj = new Home();
Obj.Show();
this.Hide();
}
else
{
Con.Open();
string Query = "select count(*) from EmployeeTbl where EmpName='" + User.Text+ "' and EmpPass='" + Pass.Text + "' ";
SqlDataAdapter sda = new SqlDataAdapter(Query, Con);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows[0][0].ToString() == "1")
{
Users = User.Text;
UserHome Obj = new UserHome();
Obj.Show();
this.Hide();
}
else
MessageBox.Show("Wrong UserName or Password!");
Con.Close();
}
}
private void User_KeyDown(object sender, KeyEventArgs e)
{
}
private void Pass_KeyDown(object sender, KeyEventArgs e)
{
}
private void TextBox_KeyDown(object sender, KeyEventArgs e)
{
}
}
}