public List <Order> GetAll() { List <Order> orderList = new List <Order>(); try { string sql = "SELECT o.OrderID, o.Datum, o.OntvangerId, o.WerknemerID, o.Ontvangen, o.Aantal, o.ProductID, o.VerzenderID, o.Verzonden FROM [Order] AS o where Ontvangen = 0"; 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++) { Order o = DataSetParser.DataSetToOrder(results, x); orderList.Add(o); } return(orderList); } catch (Exception e) { throw e; } }
public Order GetById(long id) { try { string sql = "SELECT o.OrderID, o.Datum, o.OntvangerId, o.WerknemerID, o.Ontvangen, o.Aantal, o.ProductID, o.VerzenderID, o.Verzonden FROM [Order] AS o WHERE OrderID = @OrderID"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("OrderID", id.ToString()) }; DataSet results = ExecuteSql(sql, parameters); Order O = DataSetParser.DataSetToOrder(results, 0); return(O); } catch (Exception e) { throw e; } }