public IHttpActionResult addStocks(Stock c)
        {
            // Stock c1 = new Stock { Isin = 1, Name = "ztt", Symbol = "ztt", LastSale = 0, MarketCap = 0, IPOyear = Convert.ToDateTime("1975-06-04 00:00:00.000"), Sector = "sad", industry = "djh", SummaryQuote = "dasd", Address = "sad" };
            int changeLine = StockDao.setStock(c);

            return(Ok(changeLine));
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetStockByIndustry(Industry c)
        {
            Industry c1 = new Industry {
                IndustryId = 0, Name = "ztt"
            };

            return(Ok(StockDao.getStockListByIndustry(c1)));
        }
Ejemplo n.º 3
0
        //载入库存
        private void Storage_Click(object sender, RoutedEventArgs e)
        {
            StockDao stockDao = new StockDao();

            stockDao.CheckFlag(purchaseOrder, machineTypeStock, this);
            func.QueryLoad(LoadSQL, DataGrid_StockStorage);
            StartTimer();
        }
Ejemplo n.º 4
0
        public IHttpActionResult GetStockBySector(Sector c)
        {
            Sector c1 = new Sector {
                SectorId = 0, Name = "sdf"
            };

            return(Ok(StockDao.getStockListBySector(c1)));
        }
Ejemplo n.º 5
0
        public static string getSecurityname(string isin, string type)
        {
            if (type == "Stock")
            {
                return(StockDao.getStocksByIsin(isin).Name);
            }


            return(isin);
        }
        private Stock EnsureStockexists(string stockSymbol)
        {
            Stock stock = StockDao.FindBySymbol(stockSymbol);

            if (stock == null)
            {
                throw new FaultException <StockNotFoundFault>(new StockNotFoundFault()
                {
                    FaultyStockSymbol = $"Stock does not exist with smybol '{stockSymbol}'"
                });
            }
            return(stock);
        }
Ejemplo n.º 7
0
 public static List <Stock> GetINDEXHNX(string listTicker)
 {
     try
     {
         stockDao = new StockDao();
         return(stockDao.GetStockPriceHNX(listTicker));
         //return aGNews_ArticlesDAO.
     }
     catch (Exception)
     {
         throw;
     }
 }
        public IHttpActionResult Get(int id)
        {
            Stock p = StockDao.getStocksById(id);

            if (p != null)
            {
                return(Ok(p));
            }
            else
            {
                return(NotFound());
            }
        }
        public IHttpActionResult Get(string isin)
        {
            Stock p = StockDao.getStocksByIsin(isin);

            if (p != null)
            {
                return(Ok(p));
            }
            else
            {
                return(NotFound());
            }
        }
        public IHttpActionResult GetPositionsbyPortID(int portfolioid)
        {
            List <Position>     positionlist = PositionDao.getPositionsByPortfolioId(portfolioid);
            List <Positionlist> returnlist   = new List <Positionlist>();

            foreach (Position p in positionlist)
            {
                double porfit = 0;
                porfit = Convert.ToDouble((PriceHistoryDao.getLastPriceHistorysByisin(p.Isin).Price - p.Price) / p.Price);
                returnlist.Add(new Positionlist(p.PositionId, StockDao.getStocksById(p.Isin).Name, p.Quantity, porfit));
            }


            return(Ok(returnlist));
        }
Ejemplo n.º 11
0
 public IHttpActionResult GetSecurity(dynamic security)
 {
     if (security.type == "Stock")
     {
         string isin = security.isin;
         return(Ok(StockDao.getStocksByIsin(isin)));
     }
     else if (security.type == "Bond")
     {
         string isin = security.isin;
         return(Ok(BondsDao.getBondsByIsin(isin)));
     }
     else
     {
         string isin = security.isin;
         return(Ok(FutureDao.getFutureByIsin(isin)));
     }
 }
Ejemplo n.º 12
0
        public static List <Stock> GetAllStock(string listTicker)
        {
            try
            {
                stockDao = new StockDao();
                List <Stock> list = new List <Stock>();
                list = GetINDEXHSX(listTicker);
                foreach (var item in GetINDEXHNX(listTicker))
                {
                    list.Add(item);
                }

                return(list);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Adds the product and quantity to the cart. If the product already exists, it is removed and added to the updated value.
        /// </summary>
        /// <param name="product"> Parameter product requires a 'Product' argument</param>
        /// /// <param name="quantity"> Parameter quantity requires an 'int' argument</param>
        public void ReceiveProduct(Product product, int quantity)
        {
            int quantityInStock = StockDao.GetQuantityOfAProduct(product.ProductId);

            KeyValuePair <Product, int> productOld = ListCart.Where(d => d.Key.Name.Equals(product.Name)).FirstOrDefault();
            int quantityTotal = productOld.Value + quantity;

            if (quantityInStock >= quantityTotal)
            {
                if (ListCart.ContainsKey(product))
                {
                    ListCart.Remove(productOld);
                    ListCart.Add(productOld.Key, quantityTotal);
                }
                else
                {
                    ListCart.Add(product, quantity);
                }
            }
            else
            {
                MessageBox.Show("Quantidade superior a do produto presente no estoque - Quantidade : " + quantityInStock);
            }
        }
Ejemplo n.º 14
0
 StockService()
 {
     oStockDao = new StockDao();
 }
Ejemplo n.º 15
0
 public IHttpActionResult Get()
 {
     return(Ok(StockDao.getStocks().Take(100)));
 }
Ejemplo n.º 16
0
        public IHttpActionResult deleteStocks(Stock c)
        {
            int changeLine = StockDao.deleteStocks(c);

            return(Ok(changeLine));
        }
Ejemplo n.º 17
0
        public IHttpActionResult updateStockById(Stock c)
        {
            int changeLine = StockDao.updateStocks(c);

            return(Ok(changeLine));
        }
Ejemplo n.º 18
0
 public DAO(StockDao stockDao)
 {
     this.Stock = stockDao;
 }
 public IEnumerable <string> FindAllStockSymbols()
 {
     return(StockDao.FindAllSymbols());
 }