private bool f_UpdateLogin(AccountUser datLogin) { int result; string sqlQuery = @"select * from tblAccount_update( :_username, :_password, :_employee_id)"; cmd = new NpgsqlCommand(sqlQuery, conn); datLogin.Password = LoginSet.ComputeSha256Hash(datLogin.Password); cmd.Parameters.AddWithValue("_username", NpgsqlTypes.NpgsqlDbType.Varchar, datLogin.Username); cmd.Parameters.AddWithValue("_password", NpgsqlTypes.NpgsqlDbType.Varchar, datLogin.Password); cmd.Parameters.AddWithValue("_employee_id", NpgsqlTypes.NpgsqlDbType.Varchar, datLogin.EmployeeID); result = (int)cmd.ExecuteScalar(); conn.Close(); if (result == 1) { return(true); } else { return(false); } }
/// Private Function/ Method Area /// Just in case you need some code, write here. /// private bool f_CreateLogin(AccountUser lgn) { int result; string sqlQuery = @"select * from tblaccount_insert(:_Username,:_Password,:_employee_id)"; cmd = new NpgsqlCommand(sqlQuery, conn); lgn.Password = LoginSet.ComputeSha256Hash(lgn.Password); cmd.Parameters.AddWithValue("_Username", lgn.Username.ToLower()); cmd.Parameters.AddWithValue("_Password", lgn.Password); cmd.Parameters.AddWithValue("_employee_id", lgn.EmployeeID); result = (int)cmd.ExecuteScalar(); conn.Close(); if (result == 1) { return(true); } else { return(false); } }