Ejemplo n.º 1
0
        private ReportDataset GetData()
        {
            ReportDataset dataset = new ReportDataset();

            ReportDataset.HeaderTransactionDataTable headerTable = dataset.HeaderTransaction;
            ReportDataset.DetailTransactionDataTable detailTable = dataset.DetailTransaction;

            TokoBeDiaEntities db = new TokoBeDiaEntities();

            foreach (HeaderTransaction ht in db.HeaderTransactions)
            {
                DataRow headerRow = headerTable.NewRow();

                headerRow["Id"]          = ht.Id;
                headerRow["Email"]       = ht.User.Email;
                headerRow["Date"]        = ht.Date;
                headerRow["PaymentType"] = ht.PaymentType.Type;

                headerTable.Rows.Add(headerRow);

                foreach (DetailTransaction dt in ht.DetailTransactions)
                {
                    DataRow detailRow = detailTable.NewRow();

                    detailRow["TransactionId"] = dt.TransactionId;
                    detailRow["ProductName"]   = dt.Product.Name;
                    detailRow["ProductPrice"]  = dt.Product.Price;
                    detailRow["Quantity"]      = dt.Quantity;

                    detailTable.Rows.Add(detailRow);
                }
            }

            return(dataset);
        }
Ejemplo n.º 2
0
 public static TokoBeDiaEntities GetInstance()
 {
     if (db == null)
     {
         db = new TokoBeDiaEntities();
     }
     return(db);
 }