示例#1
0
        private static User GetUserByQuery(string argSqlQuery)
        {
            DataTable dtUser = SQLAdapter.Create(argSqlQuery);
            User      user   = null;

            if (dtUser != null && dtUser.Rows.Count > 0)
            {
                user = new User(dtUser.Rows[0]);
            }
            return(user);
        }
        public static Stock GetStock(string argStockCode, string argUserId)
        {
            string lcQuery = "EXEC spGetStock @argCode = '" + argStockCode + "'" +
                             ", @argUserId = '" + argUserId + "'";
            DataTable dtUserStocks = SQLAdapter.Create(lcQuery);
            Stock     stock        = null;

            if (dtUserStocks != null && dtUserStocks.Rows.Count > 0)
            {
                stock = new Stock(dtUserStocks.Rows[0]);
            }
            return(stock);
        }
        public static List <Stock> GetStocksByUserId(string argUserId)
        {
            string       lcQuery      = "EXEC spGetStocksByUserId @argUserId = '" + argUserId + "'";
            DataTable    dtUserStocks = SQLAdapter.Create(lcQuery);
            List <Stock> stocks       = null;

            if (dtUserStocks != null && dtUserStocks.Rows.Count > 0)
            {
                stocks = new List <Stock>();
                foreach (DataRow row in dtUserStocks.Rows)
                {
                    stocks.Add(new Stock(row));
                }
            }
            return(stocks);
        }