Ejemplo n.º 1
0
        public List <Bestelling> GetAllFromUser(long Id)
        {
            try
            {
                string            sql          = "SELECT Besteldatum, Leverdatum, TotaalPrijs From Bestelling WHERE Accountid = @id";
                List <Bestelling> bestellingen = new List <Bestelling>();

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

                ExecuteSql(sql, parameters);

                DataSet result = ExecuteSql(sql, parameters);

                if (result != null && result.Tables[0].Rows.Count > 0)
                {
                    for (int x = 0; x < result.Tables[0].Rows.Count; x++)
                    {
                        Bestelling b = DataSetParser.DataSetToBestelling(result, x);
                        bestellingen.Add(b);
                    }
                }

                return(bestellingen);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 2
0
        public List <Bestelling> GetAll()
        {
            List <Bestelling> bestellingList = new List <Bestelling>();

            try
            {
                string sql = "SELECT Datum, KlantID FROM Bestelling";

                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++)
                {
                    Bestelling b = DataSetParser.DataSetToBestelling(results, x);
                    bestellingList.Add(b);
                }
                return(bestellingList);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 3
0
        public Bestelling GetById(long id)
        {
            try
            {
                string sql = "SELECT Datum, KlantID FROM Bestelling WHERE bestellingID = @bestellingID";

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

                DataSet    results = ExecuteSql(sql, parameters);
                Bestelling b       = DataSetParser.DataSetToBestelling(results, 0);
                return(b);
            }
            catch (Exception e)
            {
                throw e;
            }
        }