private void ViewModelChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            this.viewModel_ = this.DataContext as Standard_paraViewModel;

            this.notionalGrid_.Children.Add(this.viewModel_.CalculationAmountViewModel_.View_);
            this.underlyingGrid_.Children.Add(this.viewModel_.UnderlyingInfo_paraViewModel_.View_);
            this.discountCurveGrid_.Children.Add(this.viewModel_.DiscountCurve_paraViewModel_.View_);
        }
        private void ViewModelChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            this.viewModel_ = this.DataContext as Standard_paraViewModel;

            this.notionalGrid_.Children.Add(this.viewModel_.CalculationAmountViewModel_.View_);
            this.underlyingGrid_.Children.Add(this.viewModel_.UnderlyingInfo_paraViewModel_.View_);
            this.discountCurveGrid_.Children.Add(this.viewModel_.DiscountCurve_paraViewModel_.View_);

        }
        public void makeParameter()
        {
            this.positionLoad();

            this.loadedParameter_ = new Dictionary<string, string>();

            // monte
            foreach (var item in this.PositionList_)
            {
                string itemCode = item;

                StandardInstBaseViewModel standInstBaseVM = new StandardInstBaseViewModel(new InstUriInfo());

                standInstBaseVM.ReferenceDate_ = this.ReferenceDate_;
                standInstBaseVM.ItemCode_ = itemCode;
                standInstBaseVM.ItemType_ = "stepDownKI";

                Standard_paraViewModel stand_paraVM = new Standard_paraViewModel();

                MonteViewModel methodVM = new MonteViewModel();
                methodVM.SimulationNum_ = Convert.ToString(30000);

                stand_paraVM.MethodViewModel_ = methodVM;

                stand_paraVM.CalculationAmountViewModel_ = this.calculationVM(itemCode);
                stand_paraVM.UnderlyingInfo_paraViewModel_ = this.underInfo_paraVM(itemCode);
                stand_paraVM.DiscountCurve_paraViewModel_ = this.discount_paraVM(itemCode);

                standInstBaseVM.PricingParameterViewModel_ = stand_paraVM;

                standInstBaseVM.buildPara();

                string kk = standInstBaseVM.ParaResultXml_.InnerXml;
                this.loadedParameter_.Add(itemCode, kk);

                //StringBuilder sb = new StringBuilder();
                //XmlWriterSettings setting = new XmlWriterSettings();

                //setting.Indent = true;
                //setting.Encoding = Encoding.UTF8;
                //XmlWriter xmlWriter = XmlWriter.Create(sb, setting);

                //standInstBaseVM.ParaResultXml_.Save(xmlWriter);
                
                //this.loadedParameter_.Add(itemCode, sb.ToString());

                //this.loadedParameter_.Add(itemCode, standInstBaseVM.ParaResultXml_.InnerXml);
                //loadedParameter_.Add(itemCode,
            }
            
        }
        public void makeParameter()
        {
            this.positionLoad();

            this.loadedParameter_ = new Dictionary <string, string>();

            // monte
            foreach (var item in this.PositionList_)
            {
                string itemCode = item;

                StandardInstBaseViewModel standInstBaseVM = new StandardInstBaseViewModel(new InstUriInfo());

                standInstBaseVM.ReferenceDate_ = this.ReferenceDate_;
                standInstBaseVM.ItemCode_      = itemCode;
                standInstBaseVM.ItemType_      = "stepDownKI";

                Standard_paraViewModel stand_paraVM = new Standard_paraViewModel();

                MonteViewModel methodVM = new MonteViewModel();
                methodVM.SimulationNum_ = Convert.ToString(30000);

                stand_paraVM.MethodViewModel_ = methodVM;

                stand_paraVM.CalculationAmountViewModel_   = this.calculationVM(itemCode);
                stand_paraVM.UnderlyingInfo_paraViewModel_ = this.underInfo_paraVM(itemCode);
                stand_paraVM.DiscountCurve_paraViewModel_  = this.discount_paraVM(itemCode);

                standInstBaseVM.PricingParameterViewModel_ = stand_paraVM;

                standInstBaseVM.buildPara();

                string kk = standInstBaseVM.ParaResultXml_.InnerXml;
                this.loadedParameter_.Add(itemCode, kk);

                //StringBuilder sb = new StringBuilder();
                //XmlWriterSettings setting = new XmlWriterSettings();

                //setting.Indent = true;
                //setting.Encoding = Encoding.UTF8;
                //XmlWriter xmlWriter = XmlWriter.Create(sb, setting);

                //standInstBaseVM.ParaResultXml_.Save(xmlWriter);

                //this.loadedParameter_.Add(itemCode, sb.ToString());

                //this.loadedParameter_.Add(itemCode, standInstBaseVM.ParaResultXml_.InnerXml);
                //loadedParameter_.Add(itemCode,
            }
        }
        public string buildXml()
        {
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings setting = new XmlWriterSettings();

            setting.Indent = true;
            //setting.Encoding = Encoding.UTF8;

            XmlWriter xmlWriter = XmlWriter.Create(sb, setting);

            xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");

            try
            {
                //pricing
                xmlWriter.WriteStartElement("pricing");
                {
                    xmlWriter.WriteElementString("evaluationTime", this.evaluationTime_);
                    xmlWriter.WriteElementString("itemCode", this.itemCode_);
                    xmlWriter.WriteElementString("itemType", "stepDownKI");

                    //pricingParameter
                    xmlWriter.WriteStartElement("pricingParameter");
                    {
                        Standard_paraViewModel standparaVM = new Standard_paraViewModel();

                        MonteViewModel mvm = new MonteViewModel();
                        mvm.SimulationNum_ = this.simulationNum_.ToString();

                        standparaVM.MethodViewModel_ = mvm;

                        standparaVM.CalculationAmountViewModel_ = new CalculationAmountViewModel();
                        standparaVM.CalculationAmountViewModel_.Amount_ = "10000";
                        standparaVM.CalculationAmountViewModel_.Currency_ = "KRW";

                        standparaVM.UnderlyingInfo_paraViewModel_ = new UnderlyingInfo_paraViewModel();
                        standparaVM.UnderlyingInfo_paraViewModel_.Underlying_paraViewModel_ = new ObservableCollection<Underlying_paraViewModel>();
                        standparaVM.UnderlyingInfo_paraViewModel_.CorrelationInfo_paraViewModel_ = this.correlationParaXL_.ViewModel_;

                        foreach (var item in this.indexParaListXL_)
                        {
                            item.buildXml();
                            standparaVM.UnderlyingInfo_paraViewModel_.Underlying_paraViewModel_.Add(item.ViewModel_);
                        }

                        foreach (var item in this.curveParaListXL_)
                        {
                            item.buildXml();
                            if (item.UsingType_ == "discount")
                            {
                                standparaVM.DiscountCurve_paraViewModel_.
                                    YieldTermstructureViewModel_.Add(((YieldTermstructureXL)item).YieldCurveVM_);
                            }
                        }
                        standparaVM.buildXml(xmlWriter);
                    }
                    xmlWriter.WriteEndElement();
                }
                xmlWriter.WriteEndElement();
                xmlWriter.Close();

                this.resultStr_ = sb.ToString();
            }
            catch (Exception e)
            {
                string buildXmlErrStr = "err while xml building process , " + e.Message;
                ErrorManager.setError(new Error(buildXmlErrStr));

                errStr_ += buildXmlErrStr + "\n";
                //errStr_ += e.Message + "\n";
            }

            this.buildXmlFlag_ = true;

            return errStr_;

        }