Esempio n. 1
0
        public List <Klant> GetAll()
        {
            List <Klant> klantList = new List <Klant>();

            try
            {
                string sql = "SELECT Naam, Achternaam, Email, Postcode, Huisnummer, Geboortedatum, Punten, AccountID FROM Klant INNER JOIN Account ON klant.klantID = account.AccountID";

                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++)
                {
                    Klant k = DataSetParser.DataSetToKlant(results, x);
                    klantList.Add(k);
                }
                return(klantList);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 2
0
        public Klant GetById(long id)
        {
            try
            {
                string sql = "SELECT KlantID, Postcode, Huisnummer, Geboortedatum, Punten, Account.AccountID, Email, Naam, Achternaam FROM Klant INNER JOIN Account ON klant.AccountID = Account.AccountID WHERE Account.AccountID = @AccountID;";

                List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("AccountID", id.ToString()),
                };

                DataSet results = ExecuteSql(sql, parameters);
                Klant   k       = DataSetParser.DataSetToKlant(results, 0);
                return(k);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 3
0
        public Klant GetById(long id)
        {
            try
            {
                string sql = "SELECT A.Id, A.UserName, A.Email, K.Id, K.Postcode, K.Huisnummer FROM Account as A INNER JOIN Klant as K ON A.Id = K.AccountId WHERE A.Id = @Id";

                List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("Id", id.ToString()),
                };

                DataSet results = ExecuteSql(sql, parameters);
                Klant   k       = DataSetParser.DataSetToKlant(results, 0);
                return(k);
            }
            catch (Exception e)
            {
                throw e;
            }
        }