i have write all type to table and code but unable to login, please help me sir.
.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Employee_Rank.Login" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
body {
background: #4298f4;
color: white;
font-family: 'Ubuntu Mono', sans-serif;
text-transform: uppercase;
}
.box {
width: 100%;
max-width: 450px;
height: auto;
margin: 0 auto;
margin-top: 100px;
background: white;
border-radius: 7px;
box-shadow: 0px 3px 10px 1px rgba(0, 0, 0, 0.9);
}
.content {
width: 75%;
height: auto;
position:;
margin: 0 auto;
padding: 30px 0px;
background:;
text-align: center;
}
.content h1 {
font-size: 24px;
font-weight: 400;
color: #4298f4;
letter-spacing: 0.125em;
text-align: center;
}
.field {
width: 100%;
margin: 10px auto;
padding: 10px;
background: #4298f4;
border: none;
box-shadow: 0px 1px 0px 0px #111;
border-radius: 3px;
outline: none;
color: white;
font-weight: 700;
letter-spacing: 0.125em;
text-align: center;
}
::-webkit-input-placeholder { /* WebKit browsers */
color: whitesmoke;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: whitesmoke;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: whitesmoke;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color: whitesmoke;
}
.btn {
width: 100%;
margin: 10px auto;
padding: 10px;
background: #4298f4;
border: none;
box-shadow: 0px 1px 0px 0px #111;
border-radius: 3px;
outline: none;
color: white;
font-weight: 700;
letter-spacing: 0.125em;
text-align: center;
text-transform: uppercase;
}
.btn:hover {
background: #ff0c0c;
color: white;
}
.btn:active {
background: #048202;
color: white;
}
.newStyle4 {
font-family: CALIbri;
font-size: larger;
text-align: right;
}
.auto-style1 {
width: 75%;
height: auto;
position: ;
margin: 0 auto;
padding: 30px 0px;
background: ;
text-align: left;
}
.auto-style2 {
text-align: left;
}
p.MsoNormal
{mso-style-parent:"";
margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<br />
<br />
<h1 style="color:white;text-align:center">FEEDBACK CAPTURING SYSTEM</h1>
<hr />
<div class="box">
<div class="auto-style1">
<div class="auto-style2">
<asp:TextBox class="field" placeholder="Employee ID" ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
<br>
<asp:TextBox class="field" placeholder="Enter your Password" ID="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
<br>
<asp:Button class="btn" ID="LoginButton" runat="server" Text="Log In" OnClick="LoginButton_Click"></asp:Button>
<br>
<asp:Label ID="Label1" runat="server" Style="font-weight: 700; color: #FF0000"></asp:Label>
<br>
<br>
</div>
</div>
</div>
</form>
<p class="MsoNormal"><font size="3">Feedback System is open for all HODs (HODs
including GMs): </font></p>
<p class="MsoNormal"><font size="3">1)All HODs are requested to provide
honest and professional feedback on the scale of 1 to 10.</font></p>
<p class="MsoNormal"><font size="3">2) Your identity will not be disclosed.
The feedbacks shall be used as additional information for
team building and excellence.</font></p>
<p class="MsoNormal"><font size="3">3) Your feedback should be majorly based
on the performance of the individual on the assigned roles.</font></p>
<p class="MsoNormal"><font size="3">3) You may be asked to provide the
reasons if the score given is full 10 or very low(less than 5).</font></p>
<p class="MsoNormal"><font size="3">4) E1 to E6 will be evaluated by HODs of
respective divisions like for O&M executives by O&M HODs, Project executives by
Project HODs AND For Services department executives by CUSTOMER department HODs(aLL HODS).</font></p>
<p class="MsoNormal"><font size="3">5) E7 and E8(AGM) feedback shall be
taken from all HODs.</font></p>
<p class="MsoNormal"><font size="3">6) In case you don’t know someone, you
may skip the feedback of that person instead of giving random feedback.</font></p>
<p class="MsoNormal"><font size="3">7) All HODs and GMs are requested to
provide the feedback by TOmorrow 09:00hrs.</font></p>
<p class="MsoNormal"><font size="3">7) You may provide your feedback in
multiple sessions also, your feedback is being saved and is available in
“already done” tab once you press the submit button.</font></p>
<p class="MsoNormal"><font size="3">8) In case of any IT related support,
please call 4052 or 4043.</font></p>
<p class="MsoNormal"><font size="3">9) In the scale of 1-10, '10' is the
best rated, and '1' is the least rated. select 'Not Known'', if the executive
is not known. </font></p>
<p class="MsoNormal"> </p>
</body>
</html>
.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Employee_Rank
{
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LoginButton_Click(object sender, EventArgs e)
{
int itest = 0;
if (UserName.Text.Trim() != "")
{
if (Password.Text.Trim() != "")
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["hrConnectionString"].ConnectionString);
try
{
string _respassword = encrpass(Password.Text.Trim());
con.Open();
using (SqlCommand command = new SqlCommand("SELECT EMP_NUM,grade_code+grade_level as Grade,i.dept_cd FROM intranet_users i,estt_emp_mast e inner join OCMS.dbo.hod_dept b on e.empno=b.hod_no,dept_codes d where i.emp_num=e.empno and i.dept_cd=d.dept_code and emp_num = '" + UserName.Text.Trim() + "' and pwd = '" + _respassword.ToString().Trim() + "' group by EMP_NUM,grade_code+grade_level,i.dept_cd", con))
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
itest = 1;
Session["emp_num"] = reader["emp_num"].ToString().Trim();
Session["emp_name"] = reader["emp_name"].ToString().Trim();
Session["dept_cd"] = reader["dept_cd"].ToString().Trim();
Session["Grade"] = reader["Grade"].ToString().Trim();
}
}
}
finally
{
con.Close();
}
if (itest == 0)
{
Label1.Text = "Wrong Password / User Id";
return;
}
else
{
if (Session["emp_num"].ToString() == "035001" || Session["emp_num"].ToString() == "101768" || Session["emp_num"].ToString() == "090777")
//if (Session["emp_num"].ToString() == "035001" || Session["emp_num"].ToString() == "101768" )
{
Response.Redirect("Home.aspx");
}
else
{
Label1.Text = " Form Closed. Not taking any inputs";
return;
}
}
}
else
{
UserName.Focus();
Label1.Text = "Enter Password";
}
}
else
{
UserName.Focus();
Label1.Text = "Enter User Name";
}
Label1.Text = "You Are Not Authorized User.";
}
protected string encrpass(string passerwd)
{
string asd;
//int k = 0;
string pas = ""; ;
long newstr = 0;
string newpass = "";
//int inter = 0;
//int teger = 0;
for (int i = 10 - passerwd.Length; i > 0; i--)
{
passerwd = passerwd + " ";
}
passerwd = passerwd.ToUpper();
passerwd = passerwd.Substring(0, 10);
for (int i = 0; i < 10; i++)
{
asd = passerwd.Substring(i, 1);
newstr = Convert.ToInt16(Convert.ToChar(asd));
pas = pas + String.Format("{0:X2}", (uint)System.Convert.ToUInt32(newstr.ToString()));
}
int index = 0;
while (index < pas.Length)
{
if (char.IsNumber(Convert.ToChar(pas.Substring(index, 1))))
{
newpass = newpass.Trim() + pas.Substring(index, 1);
}
index += 1;
}
newpass = newpass.Trim();
for (int k1 = newpass.Length + 1; k1 <= 20; k1++)
{
newpass = newpass + " ";
}
//MessageBox.Show(newpass);
// inter = 0;
//teger = 0;
long d = (Convert.ToInt32(newpass.Substring(0, 8)) * 3) / 13;
long d1 = (Convert.ToInt32(newpass.Substring(newpass.Length - 8, 8)) * 7) / 17;
long res = d + d1;
//MessageBox.Show(res.ToString());
return res.ToString();
}
}
}
sql
CREATE TABLE [dbo].[dept_codes] (
[dept_code] NVARCHAR (3) NOT NULL,
[dept_desc] NVARCHAR (30) NULL,
[DEPT] NVARCHAR (4) NULL,
[grp] CHAR (1) NULL,
CONSTRAINT [PK_dept_codes_1] PRIMARY KEY CLUSTERED ([dept_code] ASC)
);
CREATE TABLE [dbo].[emp_rank] (
[emp_no] CHAR (6) NOT NULL,
[dept_cd] VARCHAR (3) NOT NULL,
[grade] VARCHAR (3) NOT NULL,
[name] VARCHAR (30) NOT NULL,
[hod_no] CHAR (6) NOT NULL,
[rating] FLOAT (53) NOT NULL,
[ay] CHAR (4) NOT NULL,
[remarks] NVARCHAR (500) NULL,
[valid_flag] CHAR (1) NULL,
[time_stamp] DATETIME NOT NULL,
CONSTRAINT [PK_emp_rank] PRIMARY KEY CLUSTERED ([emp_no] ASC, [hod_no] ASC, [ay] ASC)
);
CREATE TABLE [dbo].[estt_emp_mast] (
[empno] NVARCHAR (10) NULL,
[pwd] NVARCHAR (50) NULL,
[PROJECT_ID] NVARCHAR (10) NULL,
[EMP_NAME] NVARCHAR (50) NULL,
[EMP_DSG] NVARCHAR (35) NULL,
[dept_codes] NVARCHAR (15) NULL,
[EMP_ADD] NVARCHAR (50) NULL,
[LOCATION_ID] NVARCHAR (50) NULL,
[EMP_DOB] NVARCHAR (15) NULL,
[DOJNTPC] NVARCHAR (50) NULL,
[PHONE_RESI] NVARCHAR (50) NULL,
[PHONE_OFF] NVARCHAR (50) NULL,
[VSAT_PHONE] NVARCHAR (50) NULL,
[EMAIL_ID] NCHAR (40) NULL,
[INTERCOM] NVARCHAR (50) NULL,
[S_GUID] UNIQUEIDENTIFIER NULL,
[PHONE_MOB] NCHAR (12) NULL,
[photo] IMAGE NULL,
[IsActive] BIT NULL,
[PhotoPath] NVARCHAR (200) NULL
);
CREATE TABLE [dbo].[hod_dept] (
[hod_no] CHAR (6) NOT NULL,
[dept_cd] VARCHAR (3) NOT NULL,
[valid_flag] CHAR (1) NOT NULL,
[Porj_code] NCHAR (4) NOT NULL,
CONSTRAINT [PK_hod_dept_1] PRIMARY KEY CLUSTERED ([hod_no] ASC, [dept_cd] ASC, [Porj_code] ASC)
);
CREATE TABLE [dbo].[intranet_users] (
[EMP_NUM] CHAR (6) NOT NULL,
[emp_name] VARCHAR (50) NOT NULL,
[grade_code] CHAR (10) NOT NULL,
[grade_level] CHAR (10) NOT NULL,
[dept_cd] NCHAR (6) NOT NULL
);