Пример #1
0
    //Handles final login process with validation
    private void ProcessLoginCheck(string Username, string UserPwd)
    {
        //Instantiate validation
        Utility Util = new Utility();

        //Instantiate stored procedure logic
        Blogic myBL = new Blogic();

        //Check whether admin username and password exist in the admin user database.
        if (!myBL.AdminUserNameExist(Username))
        {
            lblerror.Text  = "Username does not exist";
            JSLiteral.Text = Util.JSAlert("Username does not exist");
            return;
        }
        else if (!myBL.AdminPasswordExist(UserPwd))
        {
            lblerror.Text  = "Invalid Password";
            JSLiteral.Text = Util.JSAlert("Invalid Password");
            return;
        }
        else
        {
            //Assign variable for username and password to use for the session.
            string Getadminusername;
            string Getadminpassword;
            Getadminusername = myBL.GetAdminUserNameSession(Username);
            Getadminpassword = myBL.GetAdminPasswordSession(UserPwd);

            myBL = null;

            //Store admin username and password construct in session state
            Session.Add("adminuserid", Getadminusername);
            Session.Add("adminpassword", Getadminpassword);

            //If everything is okay, then redirect to the Admin Recipe Manager page.
            //5 = recipemanager
            Util.PageRedirect(5);
        }
    }