public static DataTable SetOrderDetails(List <Reports> orderlist) { DataSet1.ReportsDataTable dt = new DataSet1.ReportsDataTable(); try { foreach (var cust in orderlist) { DataRow newRow = dt.NewRow(); foreach (PropertyInfo property in cust.GetType().GetProperties()) { if (property.Name != "discount") { newRow[property.Name] = cust.GetType().GetProperty(property.Name).GetValue(cust, null); } } dt.Rows.Add(newRow); } return(dt); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(null); } }
public DataTable GetReportFromDS(int reportType) { DataSet1.ReportsDataTable dt = new DataSet1.ReportsDataTable(); switch (reportType) { case 1: // aging < 30 listReport = OrderLAO.GetOrderByDate(1); break; case 2: //outstanding listReport = OrderLAO.GetOutStandingReport(1); break; case 3: //top customers listReport = OrderLAO.GetTopCustomers(10); break; case 4: // aging > 30 < 60 listReport = OrderLAO.GetOrderByDate(2); break; case 5: // aging > 90 listReport = OrderLAO.GetOrderByDate(3); break; default: break; } dt = (DataSet1.ReportsDataTable)SetReprots(listReport); return(dt); }
private void butGPA_Click(object sender, EventArgs e) { DataSet1.ReportsDataTable dt = new DataSet1.ReportsDataTable(); dt = (DataSet1.ReportsDataTable)SetOrderDetails(listReports); ReportForm rf = new ReportForm(dt); rf.Show(); }