コード例 #1
0
ファイル: portfolioDAL.cs プロジェクト: karthikxx/USAdvisory
        public static List<portfoliolisting> GetAllPortfolio()
        {
            //DB Connection goes here

               List<portfoliolisting> _article = new List<portfoliolisting>();

               // Create the Database object, using the default database service. The
               // default database service is determined through configuration.
               Database db = DatabaseFactory.CreateDatabase();

               string sqlCommand = "GetAllPortfolio";
               DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

               // DataSet that will hold the returned results
               DataSet commentaryDataSet = null;

               commentaryDataSet = db.ExecuteDataSet(dbCommand);

               // Note: connection was closed by ExecuteDataSet method call

               foreach (DataRow dr in commentaryDataSet.Tables[0].Rows)
               {
                    portfoliolisting _portfoliolisting = new portfoliolisting();
                   _portfoliolisting.StockTransactionId = Int32.Parse(dr["StockTransactionId"].ToString());
                   _portfoliolisting.Ticker = dr["StockTicker"].ToString();
                   _portfoliolisting.CallStatus = char.Parse(dr["CallStatus"].ToString());
                   _portfoliolisting.IsPartiallyExited = Boolean.Parse(dr["IsPartiallyExited"].ToString());
                   _portfoliolisting.PortfolioEntryDate = DateTime.Parse(dr["PortfolioEntryDate"].ToString());
                   _portfoliolisting.PortfolioExitDate = DateTime.Parse(dr["PortfolioExitDate"].ToString());
                   _portfoliolisting.PortfolioId = Int32.Parse(dr["PortfolioId"].ToString());
                   _article.Add(_portfoliolisting);
               }

               return _article;
        }
コード例 #2
0
ファイル: portfolioDAL.cs プロジェクト: karthikxx/USAdvisory
        /// <summary>
        /// 
        /// </summary>
        /// <param name="filterData"></param>
        /// <returns></returns>
        public static List<portfoliolisting> GetPortfolioFilterData(string filterData)
        {
            //DB Connection goes here

               List<portfoliolisting> _article = new List<portfoliolisting>();

               // Create the Database object, using the default database service. The
               // default database service is determined through configuration.
               Database db = DatabaseFactory.CreateDatabase();

               string sqlCommand = "GetAllPortfolio";
               DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

               // Retrieve products from the specified category.
               //db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, Category);

               // DataSet that will hold the returned results
               DataSet commentaryDataSet = null;

               commentaryDataSet = db.ExecuteDataSet(dbCommand);

               DataRow[] dataRow;

               dataRow = commentaryDataSet.Tables[0].Select("StockTicker LIKE '%" + filterData + "%'");

               // Note: connection was closed by ExecuteDataSet method call

               foreach (DataRow dr in dataRow)
               {
                   portfoliolisting _portfoliolisting = new portfoliolisting();
                   _portfoliolisting.StockTransactionId = Int32.Parse(dr["StockTransactionId"].ToString());
                   _portfoliolisting.Ticker = dr["StockTicker"].ToString();
                   _portfoliolisting.CallStatus = char.Parse(dr["CallStatus"].ToString());
                   _portfoliolisting.IsPartiallyExited = Boolean.Parse(dr["IsPartiallyExited"].ToString());
                   _portfoliolisting.PortfolioEntryDate = DateTime.Parse(dr["PortfolioEntryDate"].ToString());
                   _portfoliolisting.PortfolioExitDate = DateTime.Parse(dr["PortfolioExitDate"].ToString());
                   _portfoliolisting.PortfolioId = Int32.Parse(dr["PortfolioId"].ToString());
                   _article.Add(_portfoliolisting);
               }

               return _article;
        }