public bool LoginUser(MyAppStateModel appState) { //var aaa = _dataAccess.GetPK("UST"); //var (ok, ad) = DataLibrary.DbAccess.Login(appState.UsrID, appState.UsrPwd); var(ok, ad) = _dataAccess.Login(appState.UsrID, appState.UsrPwd); if (ok) { _usrID = appState.UsrID; _usrName = ad; StateHasChanged(); return(true); } else if (appState == null) { _usrID = 0; _usrName = ""; StateHasChanged(); return(false); } /* * // Authorize user * if (appState.UsrPwd == appState.UsrID.ToString()) * { * _usrID = appState.UsrID; * _usrName = $"{appState.UsrID}Authorized"; * * return true; * }*/ return(false); }
public (bool ok, string ad) Login(MyAppStateModel appState) { string ok = "F", ad = ""; string sql = "select OK, UsrAd from LOGIN(@UsrID, @Pwd)"; LoginResultModel res = new LoginResultModel(); using (IDbConnection connection = new FbConnection(connectionString)) { res = connection.QueryFirst <LoginResultModel>(sql, new { UsrID = appState.UsrID, UsrPwd = appState.UsrPwd }); } ok = res.OK; ad = res.USRAD; return(ok == "T", ad); }