public List <Account> GetAll() { List <Account> accountList = new List <Account>(); try { string sql = "SELECT Naam, Achternaam, Email FROM Account"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> > { }; DataSet results = ExecuteSql(sql, parameters); for (int x = 0; x < results.Tables[0].Rows.Count; x++) { Account a = DataSetParser.DataSetToAccount(results, x); accountList.Add(a); } return(accountList); } catch (Exception e) { throw e; } }
public Account GetById(long id) { try { string sql = "SELECT Email, Naam, Achternaam FROM Account WHERE AccountID = @AccountID"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("accountID", id.ToString()) }; DataSet results = ExecuteSql(sql, parameters); Account a = DataSetParser.DataSetToAccount(results, 0); return(a); } catch (Exception e) { throw e; } }
public AccountDTO GetById(int id) { try { string sql = "SELECT ID, FirstName, LastName, Email, Password, Username, Administrator FROM Account WHERE ID = @ID"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("ID", id.ToString()) }; DataSet results = ExecuteSql(sql, parameters); AccountDTO a = DataSetParser.DataSetToAccount(results, 0); return(a); } catch { return(null); } }
public AccountDTO GetByName(AccountDTO dto) { try { string sql = "SELECT * FROM Account WHERE Username = @Username AND Password = @Password"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("Username", dto.Username), new KeyValuePair <string, string>("Password", dto.Password), }; DataSet results = ExecuteSql(sql, parameters); AccountDTO a = DataSetParser.DataSetToAccount(results, 0); return(a); } catch (Exception e) { throw e; } }
public List <AccountDTO> GetAll() { List <AccountDTO> accountList = new List <AccountDTO>(); try { string sql = "SELECT ID, FirstName, LastName, Email, Password, Username, Administrator FROM [Account]"; DataSet results = ExecuteSql(sql, new List <KeyValuePair <string, string> >()); for (int x = 0; x < results.Tables[0].Rows.Count; x++) { AccountDTO a = DataSetParser.DataSetToAccount(results, x); accountList.Add(a); } return(accountList); } catch (Exception e) { throw; } }