public override void scheduleDataGenerateFromProductStr(TradeString ts)
        {
            this.subScheduleDataList_.Clear();

            StepDownKI_TradeString tsm = ts as StepDownKI_TradeString;

            this.CouponTenor_ = tsm.ObTenor_;
            this.Maturity_    = tsm.MaturiryYear_;
            this.Ki_          = tsm.KI_;
            this.Coupon_      = tsm.Coupon_;

            if (tsm.EffectiveDate_ != "")
            {
                this.EffectiveDate_ = StringConverter.xmlDateToDateTime(tsm.EffectiveDate_);
            }

            int stepMonth = Convert.ToInt32(this.CouponTenor_.Substring(0, this.CouponTenor_.Length - 1));

            int legCount = (12 / stepMonth) * Convert.ToInt32(this.Maturity_.Substring(0, this.Maturity_.Length - 1));

            double couponPerStep = (Convert.ToDouble(this.Coupon_) / 12) * Convert.ToDouble(stepMonth);

            for (int i = 0; i < legCount; i++)
            {
                Excel_stepDownKI_subScheduleViewModel data = new Excel_stepDownKI_subScheduleViewModel();

                data.Type_ = "AutoCall";
                //data.EventDate_ = this.scheduleGeneratorVM_.Dates_[i + 1];
                data.EventDate_ = this.effectiveDate_.AddMonths(stepMonth * (i + 1));

                data.UnderCalcType_ = "Minimum";
                data.AverageDays_   = "1";
                data.Coupon_        = (couponPerStep * (i + 1)).ToString();
                data.Trigger_       = tsm.TriggerList_[i];

                //try { data.Trigger_ = tsm.TriggerList_[i - 1]; }
                //catch (Exception) { }

                //double count_i = Convert.ToDouble(i);
                ////data.Coupon_ = (Convert.ToDouble(this.coupon_) * (count_i * couponMultiplier)).ToString();
                //double couponMultiplier = Convert.ToDouble(scheduleGeneratorVM_.FrequencyEnum_);
                //data.Coupon_ = (count_i * Convert.ToDouble(this.coupon_) / couponMultiplier).ToString();

                this.subScheduleDataList_.Add(data);
            }

            this.KiObStartDate_ = this.effectiveDate_;
            //this.KiObStartDate_ = this.subScheduleDataList_[0].EventDate_;
            this.KiObEndDate_ = this.subScheduleDataList_[this.subScheduleDataList_.Count - 1].EventDate_;
        }
        public static Excel_underlyingCalcIDViewModel CreateExcel_underlyingCalcID(Excel_stepDownKI_subScheduleViewModel e_s_svm)
        {
            string typeStr = e_s_svm.UnderCalcType_;

            if (typeStr.ToUpper() == "MAXIMUM" || typeStr.ToUpper() == "MAX")
            {
                Excel_maximumUnderlyingCalcIDViewModel e_mucidvm = new Excel_maximumUnderlyingCalcIDViewModel();

                e_mucidvm.EventDate_   = e_s_svm.EventDate_;
                e_mucidvm.AverageDays_ = e_s_svm.AverageDays_;

                return(e_mucidvm);
            }
            else if (typeStr.ToUpper() == "MINIMUM" || typeStr.ToUpper() == "MIN")
            {
                Excel_minimumUnderlyingCalcIDViewModel e_mucidvm = new Excel_minimumUnderlyingCalcIDViewModel();

                e_mucidvm.EventDate_   = e_s_svm.EventDate_;
                e_mucidvm.AverageDays_ = e_s_svm.AverageDays_;

                return(e_mucidvm);
            }
            else if (typeStr.ToUpper() == "AVERAGE" || typeStr.ToUpper() == "AVER")
            {
                Excel_averageUnderlyingCalcIDViewModel e_mucidvm = new Excel_averageUnderlyingCalcIDViewModel();

                e_mucidvm.EventDate_ = e_s_svm.EventDate_;
                //e_mucidvm.AverageDays_ = e_s_svm.AverageDays_;

                return(e_mucidvm);
            }
            //else if (typeStr == "excel_orderUnderlyingCalcID")
            //{
            //    return new Excel_orderUnderlyingCalcIDViewModel();
            //}
            else
            {
                throw new NotImplementedException();
            }
        }
        public override void setFromSerial(FpmlSerializedCSharp.ISerialized serial_Class)
        {
            FpmlSerializedCSharp.Excel_hifive_subtype     serial_Excel_hifive_subtype     = serial_Class as FpmlSerializedCSharp.Excel_hifive_subtype;
            FpmlSerializedCSharp.Excel_hifive_stepDown_ki serial_Excel_hifive_stepDown_ki = serial_Excel_hifive_subtype.Excel_hifive_stepDown_ki_;

            this.underlyingCalcType_ = serial_Excel_hifive_stepDown_ki.UnderlyingCalcType_.ValueStr;

            this.maturity_ = serial_Excel_hifive_stepDown_ki.Maturity_.ValueStr;

            this.maturityPeriod_ = serial_Excel_hifive_stepDown_ki.MaturityPeriod_.ValueStr;

            this.couponTenor_ = serial_Excel_hifive_stepDown_ki.CouponTenor_.ValueStr;

            this.couponTenorPeriod_ = serial_Excel_hifive_stepDown_ki.CouponTenorPeriod_.ValueStr;

            List <FpmlSerializedCSharp.Excel_stepDownKI_subSchedule> serial_excel_stepDownKI_subSchedule = serial_Excel_hifive_stepDown_ki.Excel_stepDownKI_subSchedule_;

            this.subScheduleDataList_ = new ObservableCollection <Excel_stepDownKI_subScheduleViewModel>();
            foreach (var item in serial_excel_stepDownKI_subSchedule)
            {
                //string type = item.Type_.ValueStr;
                Excel_stepDownKI_subScheduleViewModel viewModel = new Excel_stepDownKI_subScheduleViewModel();
                viewModel.setFromSerial(item);
                this.subScheduleDataList_.Add(viewModel);
            }

            this.coupon_ = serial_Excel_hifive_stepDown_ki.Coupon_.ValueStr;
            this.ki_     = serial_Excel_hifive_stepDown_ki.Ki_.ValueStr;

            this.kiObStartDate_ = StringConverter.xmlDateToDateTime(serial_Excel_hifive_stepDown_ki.KiObStartDate_.ValueStr);
            this.kiObEndDate_   = StringConverter.xmlDateToDateTime(serial_Excel_hifive_stepDown_ki.KiObEndDate_.ValueStr);

            this.settlementDays_ = serial_Excel_hifive_stepDown_ki.SettlementDays_.IntValue();

            //this.view_ = new Excel_hifive_StepDownKI_View();
            //this.view_.DataContext = this;
        }
        private Excel_simpleCalculationViewModel excel_simpleCalculationVMBuild(Excel_stepDownKI_subScheduleViewModel scheduleData)
        {
            Excel_simpleCalculationViewModel e_cvm = new Excel_simpleCalculationViewModel();

            e_cvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

            e_cvm.EventDate_ = scheduleData.EventDate_;

            e_cvm.PayoffDate_ = this.scheduleGeneratorVM_.addDays(scheduleData.EventDate_,this.settlementDays_);
            
            #region EventCal
            //---------------------------------------------------------------
            {
                //Excel_eventCalcInfoViewModel e_ecivm = new Excel_eventCalcInfoViewModel();

                Excel_singleRangeEventCalViewModel e_srecvm = new Excel_singleRangeEventCalViewModel();

                e_srecvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_srecvm.LowerRng_ = (Convert.ToDouble(scheduleData.Trigger_) /100.0).ToString();
                e_srecvm.UpperRng_ = "1000";

                // 우선 max를 사용함
                Excel_underlyingCalcIDViewModel e_mucidvm = Excel_stepDownKI_subScheduleViewModel.CreateExcel_underlyingCalcID(scheduleData);

                e_mucidvm.setUnderlying(this.Excel_underlyingCalcInfoViewModel_);

                e_srecvm.Excel_underlyingCalcIDViewModel_ = e_mucidvm;

                //e_ecivm.Excel_eventCalcViewModel_.Add(e_srecvm);

                e_cvm.Excel_eventCalcInfoViewModel_ = e_srecvm;

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함

            }

            #endregion

            #region ReturnCal
            //---------------------------------------------------------------
            {
                //Excel_returnCalcInfoViewModel e_rcivm = new Excel_returnCalcInfoViewModel();

                Excel_constReturnCalViewModel e_crcvm = new Excel_constReturnCalViewModel();

                e_crcvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_crcvm.ConstReturn_ = (Convert.ToDouble(scheduleData.Coupon_) / 100).ToString();

                //e_rcivm.Excel_returnCalcViewModel_.Add(e_crcvm);

                e_cvm.Excel_returnCalcInfoViewModel_ = e_crcvm;

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함

            }
            #endregion

            #region ComplementReturnCal
            {
                Excel_complementReturnCalcViewModel e_comp_rcvm = new Excel_complementReturnCalcViewModel();

                Excel_constReturnCalViewModel e_crcvm = new Excel_constReturnCalViewModel();

                e_crcvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_crcvm.ConstReturn_ = "0.0";

                e_comp_rcvm.Excel_returnCalcInfoViewModel_ = e_crcvm;

                e_cvm.Excel_complementReturnCalcViewModel_ = e_comp_rcvm;
            }
            #endregion

            #region AutoCall_Event

            //---------------------------------------------------------------
            {
                Excel_eventCalcInfo_CallViewModel e_ecicvm = new Excel_eventCalcInfo_CallViewModel();

                Excel_singleRangeEventCalViewModel e_srecvm = new Excel_singleRangeEventCalViewModel();
                
                e_srecvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_srecvm.LowerRng_ = (Convert.ToDouble(scheduleData.Trigger_) / 100.0).ToString();
                e_srecvm.UpperRng_ = "1000";

                //처음꺼만 사용함
                Excel_underlyingCalcIDViewModel e_mucidvm = Excel_stepDownKI_subScheduleViewModel.CreateExcel_underlyingCalcID(scheduleData);

                e_mucidvm.setUnderlying(this.Excel_underlyingCalcInfoViewModel_);

                e_srecvm.Excel_underlyingCalcIDViewModel_ = e_mucidvm;

                e_ecicvm.Excel_eventCalcInfoViewModel_ = e_srecvm;

                e_cvm.Excel_eventCalcInfo_CallViewModel_ = e_ecicvm;

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함

            }

            #endregion

            #region AutoCall_ReturnCal

            //---------------------------------------------------------------
            {
                Excel_returnCalcInfo_CallViewModel e_rcicvm = new Excel_returnCalcInfo_CallViewModel();

                Excel_constReturnCalViewModel e_crcvm = new Excel_constReturnCalViewModel();

                e_crcvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_crcvm.ConstReturn_ = "1.0"; // 원금

                e_rcicvm.Excel_returnCalcInfoViewModel_ = e_crcvm;

                e_cvm.Excel_returnCalcInfo_CallViewModel_ = e_rcicvm;

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함

            }

            #endregion

            return e_cvm;
        }
        ////underlying 이 바뀌면
        //public void underCalcBuild()
        //{
        //    this.excel_underlyingCalcIDVMList_ = new ObservableCollection<Excel_underlyingCalcIDViewModel>();

        //    ObservableCollection<string> selectedUnderName = new ObservableCollection<string>();

        //    foreach (var item in this.excel_underlyingCalcInfoViewModel_.Excel_underlyingInfoViewModel_)
        //    {
        //        selectedUnderName.Add(item.Name_);
        //    }

        //    Excel_underlyingCalcIDViewModel e_ucidvm
        //        = Excel_underlyingCalcIDViewModel.CreateExcel_underlyingCalcID(this.underlyingCalcType_.ToUpper());

        //    //if (this.underlyingCalcType_.ToUpper() == "MAXIMUM")
        //    //{

        //    //    e_ucidvm.CalcID_ = "max0001";
        //    //    e_ucidvm.ReferenceType_ = "Maximum";
        //    //    e_ucidvm.SelectedUnderlyingName_ = selectedUnderName;
        //    //    e_ucidvm.Nth_ = "1";
        //    //}
        //    //else if (this.underlyingCalcType_.ToUpper() == "MINIMUM")
        //    //{

        //    //    e_ucidvm.CalcID_ = "min0001";
        //    //    e_ucidvm.ReferenceType_ = "Minimum";
        //    //    e_ucidvm.SelectedUnderlyingName_ = selectedUnderName;
        //    //    e_ucidvm.Nth_ = "1";
        //    //}
        //    //else
        //    //{
        //    //    throw new NotImplementedException();
        //    //}

        //    this.excel_underlyingCalcIDVMList_.Add(e_ucidvm);
            
        //}

        //이제 좀 정교하게 짜야함.

        private void scheduleBuild()
        {
            this.subScheduleDataList_.Clear();
            
            int stepMonth = Convert.ToInt32(this.CouponTenor_.Substring(0, this.CouponTenor_.Length - 1));

            int legCount = (12 / stepMonth) * Convert.ToInt32(this.Maturity_.Substring(0, this.Maturity_.Length - 1));

            double couponPerStep = ( Convert.ToDouble(this.Coupon_) / 12 ) * Convert.ToDouble(stepMonth) ;
            
            #region comment
            
            //this.subScheduleDataList_.Clear();

            //this.scheduleGeneratorVM_.InitialDate_ = this.effectiveDate_;

            ////QLNet.Period maturityPeriod = new Period(maturityTenor, tu);
            //QLNet.Period maturityPeriod = new Period(this.maturity_);

            //// Y 말고 M도 처리해야함 // 우선은 int로 하자 1.5Y이런거는 잠시 대기
            //int maturityTenor = maturityPeriod.length();

            //TimeUnit tu = maturityPeriod.units(); //TimeUnit.Years;

            //this.scheduleGeneratorVM_.EndDate_ = this.effectiveDate_.AddYears(maturityTenor);

            //QLNet.Period couponPeriod = new Period(this.couponTenor_); //new Period(couponTenor, tu);

            //// coupon
            //int couponTenor = couponPeriod.length();
            //double couponMultiplier = Convert.ToDouble(couponPeriod.frequency());//1.0;

            //this.scheduleGeneratorVM_.Tenor_ = couponPeriod.ToShortString();

            //int addingDays = 0;

            //this.scheduleGeneratorVM_.genDates(addingDays);

            //ObservableCollection<DateTime> eventDates = this.scheduleGeneratorVM_.Dates_;

            //int scheduleLength = eventDates.Count;

            //this.SettlementDays_ = Convert.ToInt32(tsm.SettlementDays_);

            #endregion

            for (int i = 0; i < legCount ; i++)
            {
                Excel_stepDownKI_subScheduleViewModel data = new Excel_stepDownKI_subScheduleViewModel();

                data.Type_ = "AutoCall";
                data.EventDate_ = this.effectiveDate_.AddMonths(stepMonth*(i+1));
                
                data.UnderCalcType_ = "Minimum";
                data.AverageDays_ = "1";
                data.Coupon_ = ( couponPerStep * (i+1)).ToString();
                data.Trigger_ = "100.0";

                this.subScheduleDataList_.Add(data);
            }

            this.KiObStartDate_ = this.effectiveDate_;
            this.KiObEndDate_ = this.subScheduleDataList_[this.subScheduleDataList_.Count - 1].EventDate_;
        }
        public override void scheduleDataGenerateFromProductStr(TradeString ts)
        {
            this.subScheduleDataList_.Clear();

            StepDownKI_TradeString tsm = ts as StepDownKI_TradeString;

            this.CouponTenor_ = tsm.ObTenor_;
            this.Maturity_ = tsm.MaturiryYear_;
            this.Ki_ = tsm.KI_;
            this.Coupon_ = tsm.Coupon_;

            if (tsm.EffectiveDate_ != "")
            {
                this.EffectiveDate_ = StringConverter.xmlDateToDateTime(tsm.EffectiveDate_);
            }

            int stepMonth = Convert.ToInt32(this.CouponTenor_.Substring(0, this.CouponTenor_.Length - 1));

            int legCount = (12 / stepMonth) * Convert.ToInt32(this.Maturity_.Substring(0, this.Maturity_.Length - 1));

            double couponPerStep = (Convert.ToDouble(this.Coupon_) / 12) * Convert.ToDouble(stepMonth);

            for (int i = 0; i < legCount; i++)
            {
                Excel_stepDownKI_subScheduleViewModel data = new Excel_stepDownKI_subScheduleViewModel();

                data.Type_ = "AutoCall";
                //data.EventDate_ = this.scheduleGeneratorVM_.Dates_[i + 1];
                data.EventDate_ = this.effectiveDate_.AddMonths(stepMonth * (i + 1));

                data.UnderCalcType_ = "Minimum";
                data.AverageDays_ = "1";
                data.Coupon_ = (couponPerStep * (i + 1)).ToString();
                data.Trigger_ = tsm.TriggerList_[i];

                //try { data.Trigger_ = tsm.TriggerList_[i - 1]; }
                //catch (Exception) { }

                //double count_i = Convert.ToDouble(i);
                ////data.Coupon_ = (Convert.ToDouble(this.coupon_) * (count_i * couponMultiplier)).ToString();
                //double couponMultiplier = Convert.ToDouble(scheduleGeneratorVM_.FrequencyEnum_);
                //data.Coupon_ = (count_i * Convert.ToDouble(this.coupon_) / couponMultiplier).ToString();

                this.subScheduleDataList_.Add(data);
            }

            this.KiObStartDate_ = this.effectiveDate_;
            //this.KiObStartDate_ = this.subScheduleDataList_[0].EventDate_;
            this.KiObEndDate_ = this.subScheduleDataList_[this.subScheduleDataList_.Count - 1].EventDate_;
        }
        public override void setFromSerial(FpmlSerializedCSharp.ISerialized serial_Class)
        {
            FpmlSerializedCSharp.Excel_hifive_subtype serial_Excel_hifive_subtype = serial_Class as FpmlSerializedCSharp.Excel_hifive_subtype;
            FpmlSerializedCSharp.Excel_hifive_stepDown_ki serial_Excel_hifive_stepDown_ki = serial_Excel_hifive_subtype.Excel_hifive_stepDown_ki_;

            this.underlyingCalcType_ = serial_Excel_hifive_stepDown_ki.UnderlyingCalcType_.ValueStr;

            this.maturity_ = serial_Excel_hifive_stepDown_ki.Maturity_.ValueStr;

            this.maturityPeriod_ = serial_Excel_hifive_stepDown_ki.MaturityPeriod_.ValueStr;

            this.couponTenor_ = serial_Excel_hifive_stepDown_ki.CouponTenor_.ValueStr;

            this.couponTenorPeriod_ = serial_Excel_hifive_stepDown_ki.CouponTenorPeriod_.ValueStr;

            List<FpmlSerializedCSharp.Excel_stepDownKI_subSchedule> serial_excel_stepDownKI_subSchedule = serial_Excel_hifive_stepDown_ki.Excel_stepDownKI_subSchedule_;
            this.subScheduleDataList_ = new ObservableCollection<Excel_stepDownKI_subScheduleViewModel>();
            foreach (var item in serial_excel_stepDownKI_subSchedule)
            {
                //string type = item.Type_.ValueStr;
                Excel_stepDownKI_subScheduleViewModel viewModel = new Excel_stepDownKI_subScheduleViewModel();
                viewModel.setFromSerial(item);
                this.subScheduleDataList_.Add(viewModel);
            }

            this.coupon_ = serial_Excel_hifive_stepDown_ki.Coupon_.ValueStr;
            this.ki_ = serial_Excel_hifive_stepDown_ki.Ki_.ValueStr;

            this.kiObStartDate_ = StringConverter.xmlDateToDateTime(serial_Excel_hifive_stepDown_ki.KiObStartDate_.ValueStr);
            this.kiObEndDate_ = StringConverter.xmlDateToDateTime(serial_Excel_hifive_stepDown_ki.KiObEndDate_.ValueStr);

            this.settlementDays_ =serial_Excel_hifive_stepDown_ki.SettlementDays_.IntValue();

            //this.view_ = new Excel_hifive_StepDownKI_View();
            //this.view_.DataContext = this;

        }
        private Excel_simpleCalculationViewModel excel_simpleCalculationVMBuild(Excel_stepDownKI_subScheduleViewModel scheduleData)
        {
            Excel_simpleCalculationViewModel e_cvm = new Excel_simpleCalculationViewModel();

            e_cvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

            e_cvm.EventDate_ = scheduleData.EventDate_;

            e_cvm.PayoffDate_ = this.scheduleGeneratorVM_.addDays(scheduleData.EventDate_, this.settlementDays_);

            #region EventCal
            //---------------------------------------------------------------
            {
                //Excel_eventCalcInfoViewModel e_ecivm = new Excel_eventCalcInfoViewModel();

                Excel_singleRangeEventCalViewModel e_srecvm = new Excel_singleRangeEventCalViewModel();

                e_srecvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_srecvm.LowerRng_ = (Convert.ToDouble(scheduleData.Trigger_) / 100.0).ToString();
                e_srecvm.UpperRng_ = "1000";

                // 우선 max를 사용함
                Excel_underlyingCalcIDViewModel e_mucidvm = Excel_stepDownKI_subScheduleViewModel.CreateExcel_underlyingCalcID(scheduleData);

                e_mucidvm.setUnderlying(this.Excel_underlyingCalcInfoViewModel_);

                e_srecvm.Excel_underlyingCalcIDViewModel_ = e_mucidvm;

                //e_ecivm.Excel_eventCalcViewModel_.Add(e_srecvm);

                e_cvm.Excel_eventCalcInfoViewModel_ = e_srecvm;

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함
            }

            #endregion

            #region ReturnCal
            //---------------------------------------------------------------
            {
                //Excel_returnCalcInfoViewModel e_rcivm = new Excel_returnCalcInfoViewModel();

                Excel_constReturnCalViewModel e_crcvm = new Excel_constReturnCalViewModel();

                e_crcvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_crcvm.ConstReturn_ = (Convert.ToDouble(scheduleData.Coupon_) / 100).ToString();

                //e_rcivm.Excel_returnCalcViewModel_.Add(e_crcvm);

                e_cvm.Excel_returnCalcInfoViewModel_ = e_crcvm;

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함
            }
            #endregion

            #region ComplementReturnCal
            {
                Excel_complementReturnCalcViewModel e_comp_rcvm = new Excel_complementReturnCalcViewModel();

                Excel_constReturnCalViewModel e_crcvm = new Excel_constReturnCalViewModel();

                e_crcvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_crcvm.ConstReturn_ = "0.0";

                e_comp_rcvm.Excel_returnCalcInfoViewModel_ = e_crcvm;

                e_cvm.Excel_complementReturnCalcViewModel_ = e_comp_rcvm;
            }
            #endregion

            #region AutoCall_Event

            //---------------------------------------------------------------
            {
                Excel_eventCalcInfo_CallViewModel e_ecicvm = new Excel_eventCalcInfo_CallViewModel();

                Excel_singleRangeEventCalViewModel e_srecvm = new Excel_singleRangeEventCalViewModel();

                e_srecvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_srecvm.LowerRng_ = (Convert.ToDouble(scheduleData.Trigger_) / 100.0).ToString();
                e_srecvm.UpperRng_ = "1000";

                //처음꺼만 사용함
                Excel_underlyingCalcIDViewModel e_mucidvm = Excel_stepDownKI_subScheduleViewModel.CreateExcel_underlyingCalcID(scheduleData);

                e_mucidvm.setUnderlying(this.Excel_underlyingCalcInfoViewModel_);

                e_srecvm.Excel_underlyingCalcIDViewModel_ = e_mucidvm;

                e_ecicvm.Excel_eventCalcInfoViewModel_ = e_srecvm;

                e_cvm.Excel_eventCalcInfo_CallViewModel_ = e_ecicvm;

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함
            }

            #endregion

            #region AutoCall_ReturnCal

            //---------------------------------------------------------------
            {
                Excel_returnCalcInfo_CallViewModel e_rcicvm = new Excel_returnCalcInfo_CallViewModel();

                Excel_constReturnCalViewModel e_crcvm = new Excel_constReturnCalViewModel();

                e_crcvm.Excel_underlyingCalcInfoViewModel_ = this.Excel_underlyingCalcInfoViewModel_;

                e_crcvm.ConstReturn_ = "1.0"; // 원금

                e_rcicvm.Excel_returnCalcInfoViewModel_ = e_crcvm;

                e_cvm.Excel_returnCalcInfo_CallViewModel_ = e_rcicvm;

                //info 에 드가는 곱하기라던지 floor라던지 postCalculation 같은게 붙어야함
            }

            #endregion

            return(e_cvm);
        }
        ////underlying 이 바뀌면
        //public void underCalcBuild()
        //{
        //    this.excel_underlyingCalcIDVMList_ = new ObservableCollection<Excel_underlyingCalcIDViewModel>();

        //    ObservableCollection<string> selectedUnderName = new ObservableCollection<string>();

        //    foreach (var item in this.excel_underlyingCalcInfoViewModel_.Excel_underlyingInfoViewModel_)
        //    {
        //        selectedUnderName.Add(item.Name_);
        //    }

        //    Excel_underlyingCalcIDViewModel e_ucidvm
        //        = Excel_underlyingCalcIDViewModel.CreateExcel_underlyingCalcID(this.underlyingCalcType_.ToUpper());

        //    //if (this.underlyingCalcType_.ToUpper() == "MAXIMUM")
        //    //{

        //    //    e_ucidvm.CalcID_ = "max0001";
        //    //    e_ucidvm.ReferenceType_ = "Maximum";
        //    //    e_ucidvm.SelectedUnderlyingName_ = selectedUnderName;
        //    //    e_ucidvm.Nth_ = "1";
        //    //}
        //    //else if (this.underlyingCalcType_.ToUpper() == "MINIMUM")
        //    //{

        //    //    e_ucidvm.CalcID_ = "min0001";
        //    //    e_ucidvm.ReferenceType_ = "Minimum";
        //    //    e_ucidvm.SelectedUnderlyingName_ = selectedUnderName;
        //    //    e_ucidvm.Nth_ = "1";
        //    //}
        //    //else
        //    //{
        //    //    throw new NotImplementedException();
        //    //}

        //    this.excel_underlyingCalcIDVMList_.Add(e_ucidvm);

        //}

        //이제 좀 정교하게 짜야함.

        private void scheduleBuild()
        {
            this.subScheduleDataList_.Clear();

            int stepMonth = Convert.ToInt32(this.CouponTenor_.Substring(0, this.CouponTenor_.Length - 1));

            int legCount = (12 / stepMonth) * Convert.ToInt32(this.Maturity_.Substring(0, this.Maturity_.Length - 1));

            double couponPerStep = (Convert.ToDouble(this.Coupon_) / 12) * Convert.ToDouble(stepMonth);

            #region comment

            //this.subScheduleDataList_.Clear();

            //this.scheduleGeneratorVM_.InitialDate_ = this.effectiveDate_;

            ////QLNet.Period maturityPeriod = new Period(maturityTenor, tu);
            //QLNet.Period maturityPeriod = new Period(this.maturity_);

            //// Y 말고 M도 처리해야함 // 우선은 int로 하자 1.5Y이런거는 잠시 대기
            //int maturityTenor = maturityPeriod.length();

            //TimeUnit tu = maturityPeriod.units(); //TimeUnit.Years;

            //this.scheduleGeneratorVM_.EndDate_ = this.effectiveDate_.AddYears(maturityTenor);

            //QLNet.Period couponPeriod = new Period(this.couponTenor_); //new Period(couponTenor, tu);

            //// coupon
            //int couponTenor = couponPeriod.length();
            //double couponMultiplier = Convert.ToDouble(couponPeriod.frequency());//1.0;

            //this.scheduleGeneratorVM_.Tenor_ = couponPeriod.ToShortString();

            //int addingDays = 0;

            //this.scheduleGeneratorVM_.genDates(addingDays);

            //ObservableCollection<DateTime> eventDates = this.scheduleGeneratorVM_.Dates_;

            //int scheduleLength = eventDates.Count;

            //this.SettlementDays_ = Convert.ToInt32(tsm.SettlementDays_);

            #endregion

            for (int i = 0; i < legCount; i++)
            {
                Excel_stepDownKI_subScheduleViewModel data = new Excel_stepDownKI_subScheduleViewModel();

                data.Type_      = "AutoCall";
                data.EventDate_ = this.effectiveDate_.AddMonths(stepMonth * (i + 1));

                data.UnderCalcType_ = "Minimum";
                data.AverageDays_   = "1";
                data.Coupon_        = (couponPerStep * (i + 1)).ToString();
                data.Trigger_       = "100.0";

                this.subScheduleDataList_.Add(data);
            }

            this.KiObStartDate_ = this.effectiveDate_;
            this.KiObEndDate_   = this.subScheduleDataList_[this.subScheduleDataList_.Count - 1].EventDate_;
        }
        public static Excel_underlyingCalcIDViewModel CreateExcel_underlyingCalcID(Excel_stepDownKI_subScheduleViewModel e_s_svm)
        {
            string typeStr = e_s_svm.UnderCalcType_;

            if (typeStr.ToUpper() == "MAXIMUM" || typeStr.ToUpper() == "MAX")
            {
                Excel_maximumUnderlyingCalcIDViewModel e_mucidvm = new Excel_maximumUnderlyingCalcIDViewModel();

                e_mucidvm.EventDate_ = e_s_svm.EventDate_;
                e_mucidvm.AverageDays_ = e_s_svm.AverageDays_;

                return e_mucidvm;
            }
            else if (typeStr.ToUpper() == "MINIMUM" || typeStr.ToUpper() == "MIN")
            {
                Excel_minimumUnderlyingCalcIDViewModel e_mucidvm = new Excel_minimumUnderlyingCalcIDViewModel();

                e_mucidvm.EventDate_ = e_s_svm.EventDate_;
                e_mucidvm.AverageDays_ = e_s_svm.AverageDays_;

                return e_mucidvm;

            }
            else if (typeStr.ToUpper() == "AVERAGE" || typeStr.ToUpper() == "AVER")
            {
                Excel_averageUnderlyingCalcIDViewModel e_mucidvm = new Excel_averageUnderlyingCalcIDViewModel();

                e_mucidvm.EventDate_ = e_s_svm.EventDate_;
                //e_mucidvm.AverageDays_ = e_s_svm.AverageDays_;

                return e_mucidvm;
            }
            //else if (typeStr == "excel_orderUnderlyingCalcID")
            //{
            //    return new Excel_orderUnderlyingCalcIDViewModel();
            //}
            else
            {
                throw new NotImplementedException();
            }
        }