IsUserAuthenticated() public method

public IsUserAuthenticated ( string userName, string password, int &UsersId, int &compnayId ) : bool
userName string
password string
UsersId int
compnayId int
return bool
コード例 #1
0
        protected void AuthenticateUser()
        {
            try
            {
                UserMan.Users users = new UserMan.Users();

                string userName = txtUserName.Text;
                string password = txtPassword.Text;
                int userID = 0;
                int companyId = 0;

                if (users.IsUserAuthenticated(userName, password, out userID, out companyId))
                {

                    if (userID > 0)
                    {
                        users.UsersId = userID;
                        users.CompanyId = companyId;
                        Session[Constants.SESSION_LOGGEDUSER] = users.Select();

                        Company company=new Company();
                        company.CompanyId=users.CompanyId;
                        Session[Constants.SESSION_CURRENTCOMPANY] = company.Select();
                        Response.Redirect(HBM.Common.Constants.URL_DEFAULTBACKPAGE, false);
                    }
                }
                else
                {
                    //trMsg.Visible = true;
                    lblError.Text = HBM.Common.Messages.Invalid_Credentials;
                    lblError.Visible = true;
                }
            }
            catch (System.Exception )
            {

            }
        }
コード例 #2
0
        protected void AuthenticateUser()
        {
            try
            {
                UserMan.Users users = new UserMan.Users();

                string userName  = txtUserName.Text;
                string password  = txtPassword.Text;
                int    userID    = 0;
                int    companyId = 0;


                if (users.IsUserAuthenticated(userName, password, out userID, out companyId))
                {
                    if (userID > 0)
                    {
                        users.UsersId   = userID;
                        users.CompanyId = companyId;
                        Session[Constants.SESSION_LOGGEDUSER] = users.Select();

                        Company company = new Company();
                        company.CompanyId = users.CompanyId;
                        Session[Constants.SESSION_CURRENTCOMPANY] = company.Select();
                        Response.Redirect(HBM.Common.Constants.URL_DEFAULTBACKPAGE, false);
                    }
                }
                else
                {
                    //trMsg.Visible = true;
                    lblError.Text    = HBM.Common.Messages.Invalid_Credentials;
                    lblError.Visible = true;
                }
            }
            catch (System.Exception)
            {
            }
        }