public static AccountInfo AuthenticateUser(AccountInfo account) { if (account == null) return null; return AuthenticateDal.AuthenticateUser(account); }
public static int RegisterAccount(AccountInfo account) { int retValue = -1; ProjManagementAdmin.RegisterAccount(account, out retValue); //Initialize and retrieve code for Datareader goes here return retValue; }
//public HttpResponseMessage Post(AccountInfo account) //{ // try // { // AuthenticateBL.RegisterAccount(account); // return new HttpResponseMessage(HttpStatusCode.OK); // } // catch (Exception ex) // { // return new HttpResponseMessage(HttpStatusCode.BadRequest); // } //} public int Post(AccountInfo account) { try { int retValue = AuthenticateBL.RegisterAccount(account); return retValue; } catch (Exception ex) { return 2; } }
public HttpResponseMessage Post(AccountInfo account) { try { AccountInfo accountInfo = AuthenticateBL.AuthenticateUser(account); if (accountInfo != null) { if (accountInfo.UserName == account.UserName && accountInfo.Password == account.Password) { return new HttpResponseMessage(HttpStatusCode.OK); } } return new HttpResponseMessage(HttpStatusCode.BadRequest); } catch (Exception ex) { return new HttpResponseMessage(HttpStatusCode.BadRequest); } }
public static AccountInfo AuthenticateUser(AccountInfo account) { int retValue = -1; AccountInfo accountInfo = new AccountInfo(); using (SqlDataReader dr = ProjManagementAdmin.AuthenticateUser(account.UserName, account.Password, out retValue)) //Initialize and retrieve code for Datareader goes here { if (dr != null && dr.HasRows) { while (dr.Read()) { accountInfo.AccountId = Convert.ToInt32(dr["account_id"]); accountInfo.UserName = dr["user_name"].ToString(); accountInfo.Password = dr["password"].ToString(); accountInfo.FirstName = dr["first_name"].ToString(); accountInfo.LastName = dr["last_name"].ToString(); } } } return accountInfo; }
public static int RegisterAccount(AccountInfo account, out int retValue) { retValue = -1; SqlParameter[] sqlParms = SQLHelper.GetCachedParameters(PROC_REGISTERUSER); if (sqlParms == null) { sqlParms = new SqlParameter[] { new SqlParameter(PARAM_USER_NAME, SqlDbType.VarChar), new SqlParameter(PARAM_PASSWORD, SqlDbType.VarChar), new SqlParameter(PARAM_FIRST_NAME, SqlDbType.VarChar), new SqlParameter(PARAM_LAST_NAME, SqlDbType.VarChar), new SqlParameter(PARAM_RETURN, SqlDbType.Int) }; sqlParms[4].Direction = ParameterDirection.ReturnValue; SQLHelper.CacheParameters(PROC_REGISTERUSER, sqlParms); } //Assigning values to parameter sqlParms[0].Value = account.UserName; sqlParms[1].Value = account.Password; sqlParms[2].Value = account.FirstName; sqlParms[3].Value = account.LastName; sqlParms[4].Value = -1; return ExecuteNonQuery(PROC_REGISTERUSER, sqlParms, out retValue); }
public static int RegisterAccount(AccountInfo registerAccount) { return AuthenticateDal.RegisterAccount(registerAccount); }