Ejemplo n.º 1
0
        public List <UserAndSharesEntity> SelectStocksForUserObjectParameters(UserEntity userEntity, SharesEntity sharesEntity)
        {
            TransactionRepositories transactionRepositories = new TransactionRepositories(dbContext);
            var usersAndShare = transactionRepositories.GetUserAndShareParameters(userEntity, sharesEntity);

            return(usersAndShare);
        }
Ejemplo n.º 2
0
        public List <SharesEntity> FindOutTheValueOfShares(UserAndSharesEntity userAndSharesEntity)
        {
            TransactionRepositories transactionRepositories = new TransactionRepositories(dbContext);
            var shares = transactionRepositories.GetShares(userAndSharesEntity);

            return(shares);
        }
Ejemplo n.º 3
0
        public List <UserAndSharesEntity> SelectSharesToThUserEntity(UserEntity userEntity)
        {
            TransactionRepositories transactionRepositories = new TransactionRepositories(dbContext);
            var usersAndShare = transactionRepositories.GetUserAndShareList(userEntity);

            return(usersAndShare);
        }
Ejemplo n.º 4
0
        public List <UserEntity> SelectUser()
        {
            TransactionRepositories transactionRepositories = new TransactionRepositories(dbContext);
            var users = transactionRepositories.GetUserList();

            return(users);
        }
Ejemplo n.º 5
0
        public void StockPurchaseTransaction(UserEntity seller, UserEntity customer, int sharePrice, int numberOfSharesToSell, UserAndSharesEntity sellerSharesToThUserEntity, UserAndSharesEntity customerSharesToThUserEntity)
        {
            TransactionRepositories transactionRepositories = new TransactionRepositories(dbContext);

            transactionRepositories.UpdateUserTable(seller);
            transactionRepositories.UpdateUserTable(customer);
            transactionRepositories.UpdateUserTable(sellerSharesToThUserEntity);
            transactionRepositories.UpdateUserTable(customerSharesToThUserEntity);
            transactionRepositories.SaveChanges();
        }
Ejemplo n.º 6
0
        public void RegisterNewTransactionHistory(TransactionHistoryEntity transactionHistoryEntity)
        {
            var entityToAdd = new TransactionHistoryEntity()
            {
                DateTimeBay = transactionHistoryEntity.DateTimeBay,
                SellerId    = transactionHistoryEntity.SellerId,
                CustomerId  = transactionHistoryEntity.CustomerId,
                AmountShare = transactionHistoryEntity.AmountShare,
                Cost        = transactionHistoryEntity.Cost
            };
            TransactionRepositories transactionRepositories = new TransactionRepositories(dbContext);

            transactionRepositories.Add(entityToAdd);

            transactionRepositories.SaveChanges();
        }
Ejemplo n.º 7
0
        public static Response doCheckout(List <Cart> carts, int UserID, int PaymentTypeID, DateTime date)
        {
            Header_Transaction headerTran = TransactionsFactories.InsertHeaderTransaction(UserID, PaymentTypeID, date);

            TransactionRepositories.InsertHeaderTransaction(headerTran);

            Detail_Transaction detailTran = new Detail_Transaction();

            for (int i = 0; i < carts.Count; i++)
            {
                detailTran = TransactionsFactories.InsertDetailTransaction(headerTran.ID, carts[i].ProductID, carts[i].Quantity);
                TransactionRepositories.InsertDetailTransaction(detailTran);
                CartRepositories.DeleteCart(carts[i].ProductID, UserID);
            }

            return(new Response(true));
        }
Ejemplo n.º 8
0
        public static Response DeletePayment(int ID)
        {
            if (TransactionRepositories.GetHeaderTransactionByPaymentID(ID) != null)
            {
                return(new Response(false, "Cant delete this payment type because its referenced on another table in the database"));
            }

            PaymentType payment = PaymentRepositories.GetPaymentType(ID);

            if (payment != null)
            {
                PaymentRepositories.DeletePaymentType(payment);
                return(new Response(true));
            }

            return(new Response(false, "Theres no selected payment type."));
        }
Ejemplo n.º 9
0
        public static Response DeleteProduct(int ProductID)
        {
            Cart cart = CartRepositories.GetCartByProduct(ProductID);
            Detail_Transaction detailTran = TransactionRepositories.GetDetailTransactionByProductID(ProductID);

            if (cart != null || detailTran != null)
            {
                return(new Response(false, "Cant delete this product because its referenced in another table in database"));
            }

            Product pro = ProductRepositories.GetProduct(ProductID);

            if (pro != null)
            {
                ProductRepositories.DeleteProduct(ProductID);
                return(new Response(true));
            }

            return(new Response(false, "cant find the product"));
        }
 public static void insert(TransactionHistory trans)
 {
     TransactionRepositories.insertTransaction(trans);
 }
 public static List <TransactionHistory> getTransactionByEmail(String email)
 {
     return(TransactionRepositories.getTransactionByEmail(email));
 }
 public static List <TransactionHistory> getAllTransaction()
 {
     return(TransactionRepositories.getAllTransaction());
 }
Ejemplo n.º 13
0
 public static List <Detail_Transaction> GetDetailTransactions()
 {
     return(TransactionRepositories.GetDetailTransactions());
 }
Ejemplo n.º 14
0
 public static List <Header_Transaction> GetHeaderTransactions()
 {
     return(TransactionRepositories.GetHeaderTransactions());
 }
Ejemplo n.º 15
0
 public static List <Detail_Transaction> GetDetailTransactionsByTransactionID(int TransactionID)
 {
     return(TransactionRepositories.GetDetailTransactionsByTransactionID(TransactionID));
 }
Ejemplo n.º 16
0
 public static List <Header_Transaction> GetHeaderTransactionsByUser(int UserID)
 {
     return(TransactionRepositories.GetHeaderTransactionsByUser(UserID));
 }