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

            ReportDataset.HeaderTransactionDataTable headerTable = dataset.HeaderTransaction;
            ReportDataset.DetailTransactionDataTable detailTable = dataset.DetailTransaction;
            List <Header_Transaction> headerTransactions         = TransactionController.GetHeaderTransactions();

            foreach (Header_Transaction ht in headerTransactions)
            {
                DataRow headerRow = headerTable.NewRow();
                headerRow["TransactionID"] = ht.ID;
                headerRow["Username"]      = ht.User.Name;
                headerRow["PaymentType"]   = ht.PaymentType.Type;
                headerRow["Date"]          = ht.Date;
                headerTable.Rows.Add(headerRow);

                foreach (Detail_Transaction dt in ht.Detail_Transactions)
                {
                    DataRow detailRow = detailTable.NewRow();
                    detailRow["ProductName"]   = dt.Product.Name;
                    detailRow["ProductPrice"]  = dt.Product.Price;
                    detailRow["Quantity"]      = dt.Quantity;
                    detailRow["TransactionID"] = dt.TransactionID;
                    detailTable.Rows.Add(detailRow);
                }
            }

            return(dataset);
        }
Ejemplo n.º 2
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);
        }