/
CheckEmployees.aspx.cs
52 lines (45 loc) · 1.51 KB
/
CheckEmployees.aspx.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
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class CheckEmployees : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void submit_Click(object sender, EventArgs e)
{
Auth auth = new Auth();
SQLDB db = new SQLDB();
string netname_user = "";
string user = User.Identity.Name.ToUpper();
if (user.Contains("\\"))
netname_user = user.Substring(user.IndexOf('\\') + 1, user.Length - user.IndexOf('\\') - 1);
if (db.isAccessAllowed(netname_user))
{
string netname = Netname.Text.ToUpper();
string login = Login.Text.ToUpper();
string password = Password.Text;
if (netname.Length < 3)
{
MessageBox.Show("Ñîòðóäíèê íå íàéäåí!");
return;
}
Employee employee = auth.Authentication(netname, login, password);
if (employee != null)
Response.Redirect("Default.aspx?netname=" + employee.Netname);
else
MessageBox.Show("Ñîòðóäíèê íå íàéäåí!");
}
else
{
MessageBox.Show("Ó âàñ íåäîñòàòî÷íî ïðàâ äîñòóïà äëÿ âõîäà!");
}
}
}