private List <OrderDetail> GetAllDataFromOrderDetail() { IEnumerable <OrderDetail> listdetaildata = null; try { using (var conn = new SqlConnection(stringconnection)) { listdetaildata = conn.Query <OrderDetail>("SELECT OrderDetail.Nomor, OrderDetail.KodeBarang, Barang.NamaBarang, OrderDetail.Quantity, Barang.Satuan FROM OrderDetail INNER JOIN Barang ON OrderDetail.KodeBarang = Barang.KodeBarang"); } } catch (Exception) { throw; } return(listdetaildata?.ToList() ?? null); }
private List <Order> GetAllDataFromOrder() { IEnumerable <Order> listdata = null; try { using (var conn = new SqlConnection(stringconnection)) { listdata = conn.Query <Order>("SELECT Orderr.Nomor, convert(varchar, Orderr.Tanggal, 101) AS Tanggal, Orderr.Supplier, COUNT(OrderDetail.NomorUrut) AS TotalItem, Orderr.Keterangan FROM Orderr INNER JOIN OrderDetail ON Orderr.Nomor = OrderDetail.Nomor GROUP BY Orderr.Nomor, Orderr.Tanggal, Orderr.Supplier, Orderr.Keterangan"); } //SqlCommand cmd = new SqlCommand("SELECT Orderr.Nomor, convert(varchar, Orderr.Tanggal, 101) AS Tanggal, Orderr.Supplier, COUNT(OrderDetail.NomorUrut) AS TotalItem, Orderr.Keterangan FROM Orderr INNER JOIN OrderDetail ON Orderr.Nomor = OrderDetail.Nomor GROUP BY Orderr.Nomor, Orderr.Tanggal, Orderr.Supplier, Orderr.Keterangan", conn); } catch (Exception) { throw; } return(listdata?.ToList() ?? null); }