public void load(string curveID, DateTime d) { this.Tenor_ = new List <string>(); this.Data_ = new List <string>(); CURVETENOR_INFO_Table_DAO tenor_dao = new CURVETENOR_INFO_Table_DAO(); tenor_dao.CURVE_CODE_ = curveID; tenor_dao.select(DataBaseConnectManager.ConnectionFactory("myDB")); string[] tenor_info = tenor_dao.TENORLIST_.Split(';'); CURVE_DATA_Table_DAO dao = new CURVE_DATA_Table_DAO(); dao.CURVE_CODE_ = curveID; dao.CURVE_DATE_ = d.ToString(StringFormat.DbDateFormat_); dao.select(DataBaseConnectManager.ConnectionFactory("myDB")); int maxLenth = Math.Min(15, tenor_info.Length); for (int i = 0; i < maxLenth; i++) { this.Tenor_.Add(tenor_info[i]); //this.Data_.Add(dao.DataList_[i]); } }
public void load(string curveID,DateTime d) { this.Tenor_ = new List<string>(); this.Data_ = new List<string>(); CURVETENOR_INFO_Table_DAO tenor_dao = new CURVETENOR_INFO_Table_DAO(); tenor_dao.CURVE_CODE_ = curveID; tenor_dao.select(DataBaseConnectManager.ConnectionFactory("myDB")); string[] tenor_info = tenor_dao.TENORLIST_.Split(';'); CURVE_DATA_Table_DAO dao = new CURVE_DATA_Table_DAO(); dao.CURVE_CODE_ = curveID; dao.CURVE_DATE_ = d.ToString(StringFormat.DbDateFormat_); dao.select(DataBaseConnectManager.ConnectionFactory("myDB")); int maxLenth = Math.Min(15,tenor_info.Length); for (int i = 0; i < maxLenth; i++) { this.Tenor_.Add(tenor_info[i]); //this.Data_.Add(dao.DataList_[i]); } }
public void select(DbConnection conn) { if (conn.State != ConnectionState.Open) conn.Open(); DataTable tb = new DataTable(); this.DAOList_ = new List<CURVETENOR_INFO_Table_DAO>(); DbCommand dbCommand = conn.CreateCommand(); string selectQuery = CURVETENOR_INFO_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) { CURVETENOR_INFO_Table_DAO dao = new CURVETENOR_INFO_Table_DAO(); dao.CURVE_CODE_ = item[0].ToString(); dao.CURVE_NAME_ = item[1].ToString(); dao.TENORLIST_ = item[2].ToString(); dao.UPDATE_DATE_ = item[3].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 <CURVETENOR_INFO_Table_DAO>(); DbCommand dbCommand = conn.CreateCommand(); string selectQuery = CURVETENOR_INFO_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) { CURVETENOR_INFO_Table_DAO dao = new CURVETENOR_INFO_Table_DAO(); dao.CURVE_CODE_ = item[0].ToString(); dao.CURVE_NAME_ = item[1].ToString(); dao.TENORLIST_ = item[2].ToString(); dao.UPDATE_DATE_ = item[3].ToString(); this.DAOList_.Add(dao); } }