public void select(DbConnection conn) { if (conn.State != ConnectionState.Open) { conn.Open(); } DataTable tb = new DataTable(); this.DAOList_ = new List <OPTION_POSITION_Table_DAO>(); DbCommand dbCommand = conn.CreateCommand(); string selectQuery = OPTION_POSITION_Table_DAOManager.SelectQuery_; //selectQuery = selectQuery.Replace("@KeyColumnValue@", this.KeyColumn_); dbCommand.CommandText = selectQuery; //DbDataAdapter dataAdapter = new DbDataAdapter(dbCommand, conn); DbDataAdapter dataAdapter = DataBaseConnectManager.CreateDataAdapter(dbCommand, conn); dataAdapter.Fill(tb); DataRow[] dr = tb.Select(); int rowCount = dr.Length; foreach (DataRow item in dr) { OPTION_POSITION_Table_DAO dao = new OPTION_POSITION_Table_DAO(); dao.POSITIONNAME_ = item[0].ToString(); dao.CURRPRICE_ = item[1].ToString(); dao.PREDIFF_ = item[2].ToString(); dao.PREDIFFRATE_ = item[3].ToString(); dao.CURRPRICE2_ = item[4].ToString(); dao.PREDIFF2_ = item[5].ToString(); dao.PREDIFFRATE2_ = item[6].ToString(); dao.TRADINGAMT_ = item[7].ToString(); dao.IMVOL_ = item[8].ToString(); dao.GREEK_DELTA_ = item[9].ToString(); dao.GREEK_GAMMA_ = item[10].ToString(); dao.GREEK_VEGA_ = item[11].ToString(); dao.GREEK_THETA_ = item[12].ToString(); dao.GREEK_RHO_ = item[13].ToString(); dao.TRADINGVALUE_ = item[14].ToString(); dao.REMAINAMT_ = item[15].ToString(); dao.REMAINAMTPREDIFF_ = item[16].ToString(); this.DAOList_.Add(dao); } }
public void select(DbConnection conn) { if (conn.State != ConnectionState.Open) { conn.Open(); } DataTable tb = new DataTable(); this.DAOList_ = new List <OPTION_POSITION_1928_Table_DAO>(); DbCommand dbCommand = conn.CreateCommand(); string selectQuery = OPTION_POSITION_1928_Table_DAOManager.SelectQuery_; //selectQuery = selectQuery.Replace("@KeyColumnValue@", this.KeyColumn_); dbCommand.CommandText = selectQuery; //DbDataAdapter dataAdapter = new DbDataAdapter(dbCommand, conn); DbDataAdapter dataAdapter = DataBaseConnectManager.CreateDataAdapter(dbCommand, conn); dataAdapter.Fill(tb); DataRow[] dr = tb.Select(); int rowCount = dr.Length; foreach (DataRow item in dr) { OPTION_POSITION_1928_Table_DAO dao = new OPTION_POSITION_1928_Table_DAO(); dao.POSITIONNAME_ = item[0].ToString(); dao.SELLBUY_ = item[1].ToString(); dao.UNIT_ = item[2].ToString(); dao.EVALAMT_ = item[3].ToString(); dao.DELTA_ = item[4].ToString(); dao.GAMMA_ = item[5].ToString(); dao.VEGA_ = item[6].ToString(); dao.IMVOL_ = item[7].ToString(); dao.DELTAPOSITION_ = item[8].ToString(); dao.TOTALRISK_ = item[9].ToString(); dao.DELTARISK_ = item[10].ToString(); dao.GAMMARISK_ = item[11].ToString(); dao.VEGARISK_ = item[12].ToString(); dao.DEEPOTM_ = item[13].ToString(); dao.REMAINDAYS_ = item[14].ToString(); this.DAOList_.Add(dao); } }