private void setLabelText(int transactionId)
        {
            HeaderTransactions htr = TransactionController.getHeaderTransactionById(transactionId);

            trIdLabel.Text      += transactionId;
            trDateLabel.Text    += htr.Date.ToString("dd/MM/yyyy");
            trPaymentLabel.Text += htr.PaymentTypes.Type;
        }
        public static HeaderTransactions InsertHeaderTransaction(HeaderTransactions headerTransaction)
        {
            using (DatabaseEnt db = new DatabaseEnt())
            {
                db.HeaderTransactions.Add(headerTransaction);
                db.SaveChanges();

                return(headerTransaction);
            }
        }
Exemplo n.º 3
0
        public static void Checkout(int userId, int paymentTypeID, List <Carts> carts)
        {
            HeaderTransactions headerTransaction = TransactionFactory.CreateHeader(userId, paymentTypeID);
            int headerTransactionId = TransactionRepository.InsertHeaderTransaction(headerTransaction).ID;

            foreach (var item in carts)
            {
                DetailTransactions detailTransaction = TransactionFactory.CreateDetail(headerTransactionId, item);
                TransactionRepository.InsertDetailTransaction(detailTransaction);
            }
        }