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<CURVE_DATA_Table_DAO>();

            DbCommand dbCommand = conn.CreateCommand();

            string selectQuery = CURVE_DATA_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)
            {
                CURVE_DATA_Table_DAO dao = new CURVE_DATA_Table_DAO();

                dao.CURVE_DATE_ = item[0].ToString();
                dao.CURVE_CODE_ = item[1].ToString();
                dao.TENOR_ = item[2].ToString();
                dao.VALUE_ = item[3].ToString();
                dao.CURVE_TYPE_ = item[4].ToString();

                this.DAOList_.Add(dao);
            }



        }
示例#4
0
        public void select(DbConnection conn)
        {
            if (conn.State != ConnectionState.Open)
            {
                conn.Open();
            }

            DataTable tb = new DataTable();

            this.DAOList_ = new List <CURVE_DATA_Table_DAO>();

            DbCommand dbCommand = conn.CreateCommand();

            string selectQuery = CURVE_DATA_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)
            {
                CURVE_DATA_Table_DAO dao = new CURVE_DATA_Table_DAO();

                dao.CURVE_DATE_ = item[0].ToString();
                dao.CURVE_CODE_ = item[1].ToString();
                dao.TENOR_      = item[2].ToString();
                dao.VALUE_      = item[3].ToString();
                dao.CURVE_TYPE_ = item[4].ToString();

                this.DAOList_.Add(dao);
            }
        }
        public string save(string curveCode, DateTime refDate, string venderName = "local")
        {
            try
            {

                //Excel_irCurveLoaderViewModel e_irCurveLoader = new Excel_irCurveLoaderViewModel();

                //e_irCurveLoader.loadDefinedSymbolFromDB();

                //e_irCurveLoader.

                CURVE_DATA_Table_DAO dao = new CURVE_DATA_Table_DAO();

                dao.CURVE_DATE_= StringConverter.dbDateTimeToDateString(refDate);
                dao.CURVE_CODE_ = curveCode;
                
                foreach (var item in this.Excel_yieldCurveViewModel_.Excel_rateDataViewModel_)
                {
                    dao.TENOR_ = item.Tenor_;
                    dao.VALUE_ = item.Value_;
                    dao.CURVE_TYPE_ = item.RateType_;

                    dao.insert(DataBaseConnectManager.ConnectionFactory("myDB"));
                }

                return "save complete";
            }
            catch (Exception e)
            {
                return "save fail : " + e.Message + " , " + e.Source;
            }
        }
        public string remove_Curve(string curveCode, string venderName = "local")
        {
            try
            {
                CURVE_DATA_Table_DAO dao = new CURVE_DATA_Table_DAO();

                dao.CURVE_CODE_ = curveCode;

                dao.deleteCode(DataBaseConnectManager.ConnectionFactory("myDB"));

                return "delete complete";
            }
            catch (Exception e)
            {
                return "delete fail : " + e.Message + " , " + e.Source;
            }
        }