public void createSellTransaction(int user_id, int numberSellStock, string stockName) { using (var db = new StockExchangeEntities()) { db.pCreateSellTransaction(user_id, numberSellStock, stockName); } }
public void createStockEmission(int id_stock, int setNumberOfStock, decimal setStockPrice) { using (var db = new StockExchangeEntities()) { db.pStockEmission(id_stock, setNumberOfStock, setStockPrice); } }
public void pBuySellStock(string stockName, int user_id, int countAction, int marketSquare_id) { using (var db = new StockExchangeEntities()) { int result = db.pBuyStock(stockName, user_id, countAction, marketSquare_id); } }
public IEnumerable <MarketSquareDataSource> viewAllStockInMarketSquare() { using (var db = new StockExchangeEntities()) { var result = db.MarketSquare.Join(db.BuyingSelling, MS => MS.bs_id, BS => BS.bs_id, (MS, BS) => new { transactionStatus = BS.bs_action, marketS_id = MS.mark_id, stockPriceBuy = MS.mark_sharePriceBuy, stockPriceSell = MS.mark_sharePriceSell, stock_id = MS.stock_id, stockNumber = MS.mark_numberOfShares, transactionActive = MS.mark_aktywny, walId = MS.wal_id, statusId = MS.bs_id }).Join(db.Stock, MS => MS.stock_id, St => St.stock_id, (MS, St) => new { transactionStatus = MS.transactionStatus, marketS_id = MS.marketS_id, stockPriceBuy = MS.stockPriceBuy, stockPriceSell = MS.stockPriceSell, stock_id = MS.stock_id, stockNumber = MS.stockNumber, transactionActive = MS.transactionActive, stockN_id = St.stockN_id, stockSeria = St.stock_seria, walId = MS.walId, statusId = MS.statusId }).Join(db.StockName, MS => MS.stock_id, SN => SN.stockN_id, (MS, SN) => new MarketSquareDataSource { transactionStatus = MS.transactionStatus, marketS_id = MS.marketS_id, stockPriceBuy = MS.stockPriceBuy, stockPriceSell = MS.stockPriceSell, stockNumber = MS.stockNumber == null ? 0 : (int)MS.stockNumber, transactionActive = MS.transactionActive == null ? false : (bool)MS.transactionActive, stockName = SN.stockN_name, stockSeria = MS.stockSeria, stockId = MS.stock_id == null ? 0 : (int)MS.stock_id, walId = MS.walId == null ? 0 : (int)MS.walId, statusId = MS.statusId == null ? 0 : (int)MS.statusId }).AsEnumerable(); return(result); } }
public IEnumerable <WalletDataSource> getAllStockOfWallet() { var stockInMarketSquare = _imarket.viewAllStockInMarketSquare().Where(x => x.statusId == 1); using (var db = new StockExchangeEntities()) { var result = db.Wallet.Join(db.UserTable, W => W.wal_id, UT => UT.wal_id, (W, UT) => new { userLogin = UT.usr_login, walletStock = W.wal_numberOfShares, walletMoney = W.wal_MoneyLimit, walId = W.wal_id }).Join(stockInMarketSquare, WUT => WUT.walId, SIMS => SIMS.walId, (WUT, SIMS) => new { userLogin = WUT.userLogin, walletStock = WUT.walletStock, walletMoney = WUT.walletMoney, walId = WUT.walId, stockName = SIMS.stockName, stockNumber = SIMS.stockNumber, stockId = SIMS.stockId, wallId = SIMS.walId }).AsEnumerable(); var result2 = result.Select(x => new WalletDataSource() { userLogin = x.userLogin, walletStock = x.walletStock == null ? 0 : (int)x.walletStock, walletMoney = x.walletMoney == null ? 0 : (decimal)x.walletMoney, wallId = x.walId, stockName = x.stockName, stockNumber = x.stockNumber, stockId = x.stockId }); return(result2); } }