예제 #1
0
        public StockDefinition GetStockDefinition(string stockName)
        {
            StockDefinition res = new StockDefinition();

            string qry = $"select * from at_spolki2 where stock_fullname='{stockName}' or stock_name='{stockName.ToUpper()}'";

            ProcessSelectQuery(qry, (reader) =>
            {
                if (!reader.HasRows)
                {
                    throw new Exception($"No data for stock name = {stockName}");
                }
                reader.Read();
                PgDataToStockDefinitionConverter.ToStockDefinition(reader, res);
            });
            return(res);
        }
예제 #2
0
        public StockDefinition GetStockDefinition(int stockID)
        {
            StockDefinition res = new StockDefinition();

            string qry = $"select * from at_spolki2 where id={stockID}";

            ProcessSelectQuery(qry, (reader) =>
            {
                if (!reader.HasRows)
                {
                    throw new Exception($"No data for stock id={stockID}");
                }
                reader.Read();
                PgDataToStockDefinitionConverter.ToStockDefinition(reader, res);
            });
            return(res);
        }
예제 #3
0
        public List <StockDefinition> GetAllStockDefinitions()
        {
            List <StockDefinition> res = new List <StockDefinition>();

            string qry = $"select * from at_spolki2";

            ProcessSelectQuery(qry, (reader) =>
            {
                if (!reader.HasRows)
                {
                    return;
                }
                while (reader.Read())
                {
                    StockDefinition def = new StockDefinition();
                    PgDataToStockDefinitionConverter.ToStockDefinition(reader, def);
                    res.Add(def);
                }
            });
            return(res);
        }