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));
        }
Пример #2
0
        public IHttpActionResult GetStockByIndustry(Industry c)
        {
            Industry c1 = new Industry {
                IndustryId = 0, Name = "ztt"
            };

            return(Ok(StockDao.getStockListByIndustry(c1)));
        }
Пример #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();
        }
Пример #4
0
        public IHttpActionResult GetStockBySector(Sector c)
        {
            Sector c1 = new Sector {
                SectorId = 0, Name = "sdf"
            };

            return(Ok(StockDao.getStockListBySector(c1)));
        }
Пример #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);
        }
Пример #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));
        }
 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)));
     }
 }
Пример #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;
            }
        }
Пример #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);
            }
        }
Пример #14
0
 StockService()
 {
     oStockDao = new StockDao();
 }
 public IHttpActionResult Get()
 {
     return(Ok(StockDao.getStocks().Take(100)));
 }
        public IHttpActionResult deleteStocks(Stock c)
        {
            int changeLine = StockDao.deleteStocks(c);

            return(Ok(changeLine));
        }
        public IHttpActionResult updateStockById(Stock c)
        {
            int changeLine = StockDao.updateStocks(c);

            return(Ok(changeLine));
        }
Пример #18
0
 public DAO(StockDao stockDao)
 {
     this.Stock = stockDao;
 }
 public IEnumerable <string> FindAllStockSymbols()
 {
     return(StockDao.FindAllSymbols());
 }