protected void btnLogin_Click(object sender, EventArgs e)
    {
        lblLogoutMsg.Text    = "";
        lblmsg.Text          = "";
        lblLogoutMsg.Visible = false;
        string str1 = null;

        string[] UserName = null;
        try
        {
            if (txtUname.Text.Contains("@"))
            {
                string str = txtUname.Text;
                UserName          = str.Split('@');
                objLogin.UserName = UserName[0].ToString();
                str1 = UserName[0].ToString();
            }
            else
            {
                objLogin.UserName = txtUname.Text.Trim();
                str1 = txtUname.Text.Trim();
            }
            objLogin.Password = txtPassword.Text.Trim();
            string Role = objLogin.GetUserLogin();
            if (Role.ToUpper() == "NOUSER")
            {
                lblmsg.Text = "Incorrect LoginId and Password. Try again.";
            }
            else
            {
                Session["EmpId"] = objLogin.GetUserIdByLoginDetails(str1, txtPassword.Text.Trim());
                if (Role.ToUpper() == "ADMIN")
                {
                    Session["UserName"] = str1;
                    Session["pwd"]      = txtPassword.Text.Trim();
                    FormsAuthentication.RedirectFromLoginPage("Admin", false);
                }
                else if (Role.ToUpper() == "EMP")
                {
                    Session["UserName"] = str1;
                    FormsAuthentication.RedirectFromLoginPage("Emp", false);
                }
                else if (Role.ToUpper() == "SECURITY")
                {
                    Session["UserName"] = str1;
                    FormsAuthentication.RedirectFromLoginPage("Security", false);
                }
            }
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
    }