public ActionResult GetObjectArticles(int ObjectNaam) { OfferteGenerator.Library.DBConnect newSqlConnection = new Library.DBConnect("OfferteGenerator" + DBlocation); List <AxArticle> ConfigArticles = new List <AxArticle>(); int[] Ids = null; switch (ObjectNaam) { } foreach (dynamic item in newSqlConnection.Select("ImportArtikelen", 0, 0, Ids)) { AxArticle newObject = new AxArticle(); newObject.Id = item.Id; newObject.WSP_Code = item.WSP_Code; newObject.Art_code_Lev = item.Art_code_Lev; newObject.Art_nr_Merk = item.Art_nr_Merk; newObject.Omschrijving = item.Omschrijving; newObject.Veel_Gebruikt = item.Veel_Gebruikt; newObject.Bruto_Prijs = item.Bruto_Prijs; newObject.Netto_Prijs = item.Netto_Prijs; newObject.Korting = item.Korting; newObject.Leverancier = item.Leverancier; ConfigArticles.Add(newObject); } ViewBag.pageshowNrArt = 18; ViewBag.startRow = 0; return(View("Articles", ConfigArticles)); }
public ActionResult Articles(int startRow, int showNr) { OfferteGenerator.Library.DBConnect newSqlConnection = new Library.DBConnect("OfferteGenerator" + DBlocation); string countRows = newSqlConnection.CountRows("ImportArtikelen"); int countRowsInt = Convert.ToInt32(countRows); if (startRow < 0) { startRow = 0; } if (startRow + showNr > countRowsInt) { ViewBag.pageshowNrArt = showNr; showNr = countRowsInt - startRow; } else { ViewBag.pageshowNrArt = showNr; } ViewBag.SqlCount = countRows; ViewBag.startRow = startRow; List <AxArticle> axArticles = new List <AxArticle>(); foreach (dynamic item in newSqlConnection.Select("ImportArtikelen", startRow, showNr, null)) { AxArticle newObject = new AxArticle(); newObject.Id = item.Id; newObject.WSP_Code = item.WSP_Code; newObject.Art_code_Lev = item.Art_code_Lev; newObject.Art_nr_Merk = item.Art_nr_Merk; newObject.Omschrijving = item.Omschrijving; newObject.Veel_Gebruikt = item.Veel_Gebruikt; newObject.Bruto_Prijs = item.Bruto_Prijs; newObject.Netto_Prijs = item.Netto_Prijs; newObject.Korting = item.Korting; newObject.Leverancier = item.Leverancier; axArticles.Add(newObject); } return(View(axArticles)); }