Login Page - Payroll Management System Project in Asp.Net


Login Page - Payroll Management System

In this article we see Payroll Management System Login page. It is common login page for Administrator, Manager and Employee's.

Payroll Management System Project in Asp.Net - Login Page

Note :

Username and Password for Admin : admin
Username and Password for Manager : manager

HTML Markup Language : Login Page

you can copy and paste this below html code or download source code of this project.

 <asp:Panel ID="TitlePanel" runat="server" BackColor="#27ae60" Height="29px" 
        style="top: 117px; left: 282px; position: absolute; width: 266px;">
        <asp:Label ID="lblTitle" runat="server" Text="Login" 
            Style="position:absolute;left:107px; top:6px;" CssClass="mylabel" 
            Font-Bold="True" Font-Size="15px" ForeColor="White"></asp:Label>
    </asp:Panel>
    <asp:Label ID="lblError" runat="server" CssClass="mylabel" 
        Style="position:absolute;top:274px; left:284px;" Font-Bold="True" 
        ForeColor="Red"></asp:Label>
    <asp:Panel ID="LoginPanel" runat="server" BackColor="#bdc3c7" 
                style="top: 147px; left: 282px; position: absolute; height: 116px; z-index: -1; width: 264px;">
        <asp:Label ID="lblPassword" runat="server" Text="Password:" 
            Style="position:absolute;left:22px; top:50px; z-index: 1;" CssClass="mylabel" 
            Font-Bold="True"></asp:Label>
        <asp:TextBox ID="txtPassword" runat="server" 
            Style="position:absolute;left:98px; top:47px; width: 139px;" 
            CssClass="mytextbox" TextMode="Password" TabIndex="30"></asp:TextBox>
        <asp:Label ID="lblUserName" runat="server" Text="User Name:" 
            Style="position:absolute;left:22px; top:21px; z-index: 1;" CssClass="mylabel" 
            Font-Bold="True"></asp:Label>
        <asp:TextBox ID="txtUserName" runat="server" 
            Style="position:absolute;left:98px; top:17px; width: 138px;" 
            CssClass="mytextbox" TabIndex="20"></asp:TextBox>
        <asp:Button ID="btnSubmit" runat="server" Text="Submit" 
            Style="position:absolute;left:176px; top:83px; padding:3px;" BorderStyle="Ridge" 
            BorderWidth="0px" CssClass="mytextbox" Font-Bold="True" TabIndex="50" 
            BackColor="#c0392b" ForeColor="#ffffff" onclick="btnSubmit_Click"/>
    </asp:Panel>

C# Coding : Submit Button Click

By default admin and manager Username and Password : admin and manager. Employee Username and Password are not default its depends on admin at the time of creating employee account.

protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            lblError.Text = "";
            string username = txtUserName.Text;
            string password = txtPassword.Text;
            if (username == "admin" && password == "admin")
            {
                Session["currentusertype"] = "Administrator";
                Response.Redirect("welcome.aspx", false);
            }
            else if (username == "manager" && password == "manager")
            {
                Session["currentusertype"] = "Manager";
                Response.Redirect("welcome.aspx", false);
            }
            else
            {
                DataTable dt = BusinessAccessLayer.Query("select * from employees where username='" + username + "' and password='" + password + "'");
                if (dt.Rows.Count >= 1)
                {
                    Session["currentusertype"] = "Employee";
                    Session["currentusername"] = username;
                    Session["currentuserpassword"] = password;
                    Session["currentemployeeid"] = Convert.ToInt32(dt.Rows[0]["employeeid"]);
                    Session["currentemployeename"] = Convert.ToString(dt.Rows[0]["name"]);
                    Response.Redirect("welcome.aspx", false);
                }
            }
        }
        catch (Exception ex)
        {
            lblError.Text = "Error: " + ex.Message;
        }
    }

Download Project Source Code

To Download Source Code of this Project, Please goto NEXT Page.


1 2 3 4 5
0 Komentar untuk "Login Page - Payroll Management System Project in Asp.Net"

Back To Top