-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.aspx.cs
109 lines (87 loc) · 3.5 KB
/
login.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
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using System.Threading;
using System.Web.Mail;
using System.Net.Mime;
using System.Security.Cryptography;
using System.Text;
using System.Net.Mail;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data.Common;
using System.Globalization;
using System.Net;
using System.Drawing;
using IMDLL;
public partial class Login : System.Web.UI.Page
{
ModulePageAccess objModulePageAccess = new ModulePageAccess();
Users objUsers = new Users();
IMDLL.Profile objProfile = new Profile();
clsEmail objEmail = new clsEmail();
clsVariables objVariables = new clsVariables();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BtnLogin_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtUsername.Text) == true || string.IsNullOrEmpty(txtPassword.Text) == true)
{
errorSummaryLiteral.Text = "Kindly login with your username and password";
errorSummaryBox.Visible = true;
}
else
{
DataTable Dt = objUsers.GetUsers(" where Username ='" + txtUsername.Text + "' and UserPassword ='" + txtPassword.Text + "' AND UserActif=1");
if (Dt.Rows.Count > 0)
{
Session[RunningCache.UserID] = Dt.Rows[0]["UserID"].ToString();
Session[RunningCache.UserFullName] = Dt.Rows[0]["UserFullName"].ToString();
Session[RunningCache.UserLogin] = Dt.Rows[0]["UserName"].ToString();
Session[RunningCache.UserProfile] = Dt.Rows[0]["UserProfile"].ToString();
//Get the profile of the user
DataTable dtProfile = objProfile.GetProfile(" where ProfileID =" + Session[RunningCache.UserProfile].ToString());
if (dtProfile.Rows.Count > 0)
{
Session[RunningCache.ProfileName] = dtProfile.Rows[0]["ProfileName"].ToString();
DataTable DtModulePageAccess = objModulePageAccess.GetModulePageAccess(" where ProfileID=" + Session[RunningCache.UserProfile].ToString());
if (DtModulePageAccess.Rows.Count > 0)
{
Session[RunningCache.DtModulePageAccess] = DtModulePageAccess;
Response.Redirect("default.aspx", false);
}
else
{
errorSummaryLiteral.Text = "You don't have the profile to access this page, please contact your administrator";
errorSummaryBox.Visible = true;
Response.Redirect("Register.aspx", false);
}
}
else
{
errorSummaryLiteral.Text = "You don't have any profile. Please contact your administrator";
errorSummaryBox.Visible = true;
}
}
else
{
errorSummaryLiteral.Text = "Your username or password is not correct";
errorSummaryBox.Visible = true;
}
}
}
protected void BtnSubscribe_Click(object sender, EventArgs e)
{
Response.Redirect("Subscription.aspx", false);
}
protected void BtnForgottenPwd_Click(object sender, EventArgs e)
{
Response.Redirect("Subscription.aspx", false);
}
}