public void select(DbConnection conn)
        {
            if (conn.State != ConnectionState.Open)
            {
                conn.Open();
            }

            DataTable tb = new DataTable();

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

            DbCommand dbCommand = conn.CreateCommand();

            string selectQuery = TD_MRCURVE_Table_DAOManager.SelectQuery_;

            selectQuery = selectQuery.Replace("@KeyColumn_RefDateValue@", this.KeyColumn_RefDate_);
            selectQuery = selectQuery.Replace("@KeyColumn_CurveCodeValue@", this.KeyColumn_CurveCode_);

            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)
            {
                TD_MRCURVE_Table_DAO dao = new TD_MRCURVE_Table_DAO();

                dao.STD_DATE_      = item[0].ToString();
                dao.CURVE_CODE_    = item[1].ToString();
                dao.BOND_CLASS_ID_ = item[2].ToString();
                dao.D001_          = item[3].ToString();
                dao.M003_          = item[4].ToString();
                dao.M006_          = item[5].ToString();
                dao.M009_          = item[6].ToString();
                dao.M012_          = item[7].ToString();
                dao.M018_          = item[8].ToString();
                dao.M024_          = item[9].ToString();
                dao.M030_          = item[10].ToString();
                dao.M036_          = item[11].ToString();
                dao.M048_          = item[12].ToString();
                dao.M060_          = item[13].ToString();
                dao.M084_          = item[14].ToString();
                dao.M120_          = item[15].ToString();
                dao.M180_          = item[16].ToString();
                dao.M240_          = item[17].ToString();
                dao.M360_          = item[18].ToString();

                this.DAOList_.Add(dao);
            }
        }
Ejemplo n.º 2
0
        public override void load(DateTime refDate, string curveCode, ObservableCollection <Excel_irCurveDataViewModel> e_ircdvmList)
        {
            TD_MRCURVE_Table_DAO dao = new TD_MRCURVE_Table_DAO();

            e_ircdvmList.Clear();

            dao.KeyColumn_RefDate_       = refDate.ToString(StringFormat.DbDateFormat_);
            dao.KeyColumn_BOND_CLASS_ID_ = curveCode;
            dao.KeyColumn_CURVE_CODE_    = "S";

            dao.select(this.conn_);

            Excel_irCurveDataViewModel e_ircdvm = new Excel_irCurveDataViewModel();

            e_ircdvm.Curve_code_    = curveCode;
            e_ircdvm.ReferenceDate_ = refDate;

            List <string> tenorList = new List <string>()
            {
                "1D",
                "3M",
                "6M",
                "9M",
                "12M",
                "18M",
                "24M",
                "30M",
                "36M",
                "48M",
                "60M",
                "84M",
                "120M",
                "180M",
                "240M",
                "360M"
            };

            List <string> valueList = new List <string>()
            {
                dao.D001_,
                dao.M003_,
                dao.M006_,
                dao.M009_,
                dao.M012_,
                dao.M018_,
                dao.M024_,
                dao.M030_,
                dao.M036_,
                dao.M048_,
                dao.M060_,
                dao.M084_,
                dao.M120_,
                dao.M180_,
                dao.M240_,
                dao.M360_
            };

            for (int i = 0; i < tenorList.Count; i++)
            {
                Excel_rateDataViewModel e_rdvm = new Excel_rateDataViewModel();

                e_rdvm.Tenor_ = tenorList[i];

                double value = Convert.ToDouble(valueList[i]) / 100.0;
                e_rdvm.Value_ = value.ToString();

                e_rdvm.RateType_ = "spot";

                if (value > 0.0)
                {
                    e_ircdvm.Excel_rateDataViewModelList_.Add(e_rdvm);
                }
            }

            e_ircdvm.tenorList_ = tenorList;

            if (e_ircdvm.Excel_rateDataViewModelList_.Count > 0)
            {
                e_ircdvmList.Add(e_ircdvm);
            }
            else
            {
                throw new Exception("curve load error , STD_DATE : " + dao.KeyColumn_RefDate_ +
                                    " BOND_CLASS_ID : " + dao.KeyColumn_BOND_CLASS_ID_);
            }
        }
        public override void load(DateTime refDate, string curveCode, ObservableCollection<Excel_irCurveDataViewModel> e_ircdvmList)
        {
            TD_MRCURVE_Table_DAO dao = new TD_MRCURVE_Table_DAO();

            e_ircdvmList.Clear();

            dao.KeyColumn_RefDate_ = refDate.ToString(StringFormat.DbDateFormat_);
            dao.KeyColumn_BOND_CLASS_ID_ = curveCode;
            dao.KeyColumn_CURVE_CODE_ = "S";

            dao.select(this.conn_);

            Excel_irCurveDataViewModel e_ircdvm = new Excel_irCurveDataViewModel();

            e_ircdvm.Curve_code_ = curveCode;
            e_ircdvm.ReferenceDate_ = refDate;

            List<string> tenorList = new List<string>()
            {
                "1D",
                "3M",
                "6M",
                "9M",
                "12M",
                "18M",
                "24M",
                "30M",
                "36M",
                "48M",
                "60M",
                "84M",
                "120M",
                "180M",
                "240M",
                "360M"
            };

            List<string> valueList = new List<string>()
            {
                dao.D001_,
                dao.M003_,
                dao.M006_,
                dao.M009_,
                dao.M012_,
                dao.M018_,
                dao.M024_,
                dao.M030_,
                dao.M036_,
                dao.M048_,
                dao.M060_,
                dao.M084_,
                dao.M120_,
                dao.M180_,
                dao.M240_,
                dao.M360_

            };

            for (int i = 0; i < tenorList.Count; i++)
            {
                Excel_rateDataViewModel e_rdvm = new Excel_rateDataViewModel();

                e_rdvm.Tenor_ = tenorList[i];

                double value = Convert.ToDouble(valueList[i]) / 100.0;
                e_rdvm.Value_ = value.ToString();

                e_rdvm.RateType_ = "spot";

                if (value > 0.0)
                {
                    e_ircdvm.Excel_rateDataViewModelList_.Add(e_rdvm);
                }

            }

            e_ircdvm.tenorList_ = tenorList;

            if (e_ircdvm.Excel_rateDataViewModelList_.Count > 0)
            {
                e_ircdvmList.Add(e_ircdvm);
            }
            else
            {
                throw new Exception("curve load error , STD_DATE : " + dao.KeyColumn_RefDate_ + 
                                                      " BOND_CLASS_ID : " + dao.KeyColumn_BOND_CLASS_ID_);
            }

        }
Ejemplo n.º 4
0
        public override void loadInterval(DateTime startDate, DateTime endDate, string curveCode, ObservableCollection <Excel_irCurveDataViewModel> e_ircdvmList)
        {
            TD_MRCURVE_Table_DAOManager daoM = new TD_MRCURVE_Table_DAOManager();

            e_ircdvmList.Clear();

            daoM.KeyColumn_InitialDate_ = startDate.ToString(StringFormat.DbDateFormat_);
            daoM.KeyColumn_EndDate_     = endDate.ToString(StringFormat.DbDateFormat_);

            daoM.KeyColumn_BOND_CLASS_ID_ = curveCode;
            daoM.KeyColumn_CURVE_CODE_    = "S";

            daoM.selectInterval(this.conn_);

            List <string> tenorList = new List <string>()
            {
                "1D",
                "3M",
                "6M",
                "9M",
                "12M",
                "18M",
                "24M",
                "30M",
                "36M",
                "48M",
                "60M",
                "84M",
                "120M",
                "180M",
                "240M",
                "360M"
            };


            for (int i = 0; i < daoM.DAOList_.Count; i++)
            {
                Excel_irCurveDataViewModel e_ircdvm = new Excel_irCurveDataViewModel();

                TD_MRCURVE_Table_DAO dao = daoM.DAOList_[i];

                e_ircdvm.Curve_code_    = dao.CURVE_CODE_;
                e_ircdvm.ReferenceDate_ = StringConverter.dbDateToDateTime(dao.STD_DATE_);

                List <string> valueList = new List <string>()
                {
                    dao.D001_,
                    dao.M003_,
                    dao.M006_,
                    dao.M009_,
                    dao.M012_,
                    dao.M018_,
                    dao.M024_,
                    dao.M030_,
                    dao.M036_,
                    dao.M048_,
                    dao.M060_,
                    dao.M084_,
                    dao.M120_,
                    dao.M180_,
                    dao.M240_,
                    dao.M360_
                };

                for (int j = 0; j < tenorList.Count; j++)
                {
                    Excel_rateDataViewModel e_rdvm = new Excel_rateDataViewModel();

                    e_rdvm.Tenor_ = tenorList[j];
                    double value = Convert.ToDouble(valueList[j]) / 100.0;

                    e_rdvm.Value_ = value.ToString();

                    e_rdvm.RateType_ = "spot";

                    if (value > 0.0)
                    {
                        e_ircdvm.Excel_rateDataViewModelList_.Add(e_rdvm);
                    }
                }

                e_ircdvmList.Add(e_ircdvm);
            }

            e_ircdvmList[0].tenorList_ = tenorList;
        }
        public void select(DbConnection conn)
        {
            if (conn.State != ConnectionState.Open)
                conn.Open();

            DataTable tb = new DataTable();

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

            DbCommand dbCommand = conn.CreateCommand();

            string selectQuery = TD_MRCURVE_Table_DAOManager.SelectQuery_;

            selectQuery = selectQuery.Replace("@KeyColumn_RefDateValue@", this.KeyColumn_RefDate_);
            selectQuery = selectQuery.Replace("@KeyColumn_CurveCodeValue@", this.KeyColumn_CurveCode_);

            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)
            {
                TD_MRCURVE_Table_DAO dao = new TD_MRCURVE_Table_DAO();

                dao.STD_DATE_ = item[0].ToString();
                dao.CURVE_CODE_ = item[1].ToString();
                dao.BOND_CLASS_ID_ = item[2].ToString();
                dao.D001_ = item[3].ToString();
                dao.M003_ = item[4].ToString();
                dao.M006_ = item[5].ToString();
                dao.M009_ = item[6].ToString();
                dao.M012_ = item[7].ToString();
                dao.M018_ = item[8].ToString();
                dao.M024_ = item[9].ToString();
                dao.M030_ = item[10].ToString();
                dao.M036_ = item[11].ToString();
                dao.M048_ = item[12].ToString();
                dao.M060_ = item[13].ToString();
                dao.M084_ = item[14].ToString();
                dao.M120_ = item[15].ToString();
                dao.M180_ = item[16].ToString();
                dao.M240_ = item[17].ToString();
                dao.M360_ = item[18].ToString();

                this.DAOList_.Add(dao);
            }
        }