public CorrelationParaXL(string[] codeList,
                                 string[,] matrix)
        {
            viewModel_ = new CorrelationInfo_paraViewModel();
            viewModel_.Correlation_paraViewModel_ = new System.Collections.ObjectModel.ObservableCollection<Correlation_paraViewModel>();

            int dimension = codeList.Length;

            viewModel_.Dimension_ = dimension.ToString();

            for (int r = 0; r < dimension; r++)
            {
                for (int c = 0; c < dimension; c++)
                {
                    Correlation_paraViewModel corrParaVM = new Correlation_paraViewModel();

                    corrParaVM.First_ = codeList[r];
                    corrParaVM.Second_ = codeList[c];
                    corrParaVM.Value_ = matrix[r,c];

                    viewModel_.Correlation_paraViewModel_.Add(corrParaVM);
                }
            }

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

            //this.viewModel_.PropertyChanged += new PropertyChangedEventHandler(viewModel_PropertyChanged);

            this.correlationTestGrid_.ItemsSource = this.viewModel_.CorrelationDataList_;
        }
        private void ViewModelChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            this.viewModel_ = this.DataContext as CorrelationInfo_paraViewModel;

            //this.viewModel_.PropertyChanged += new PropertyChangedEventHandler(viewModel_PropertyChanged);

            this.correlationTestGrid_.ItemsSource = this.viewModel_.CorrelationDataList_;

        }
        public void initializeParameter(IndexUnderInfoViewModel indexUnderInfoVM)
        {
            foreach (var item in indexUnderInfoVM.IndexUnderList_)
            {
                string typeStr = item.Type_;
                Underlying_paraViewModel vm = Underlying_paraViewModel.CreateUnderlying_para("geometricBM");
                vm.KrCode_    = item.KRCode_;
                vm.UnderName_ = item.Name_;
            }

            this.correlationInfo_paraViewModel_ = new CorrelationInfo_paraViewModel();
            this.correlationInfo_paraViewModel_.initializeParameter(indexUnderInfoVM);
        }
        private CorrelationInfo_paraViewModel makeCorrInfo(List <string> underCodeList)
        {
            QueryStr queryStr = new QueryStr(this.corrQueryInfo_);

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < underCodeList.Count; i++)
            {
                sb.Append(QueryStr.wrapComma(underCodeList[i]));

                if (i != underCodeList.Count - 1)
                {
                    sb.Append(",");
                }
            }

            queryStr.VariableMap_.Add("STD_DATE", this.ReferenceDate_.ToString("yyyyMMdd"));
            queryStr.VariableMap_.Add("UNDER_LIST", sb.ToString());

            conn_.addQuery("underCorrInfo", queryStr.getQuery());

            conn_.excute();

            DataTable tb = conn_.ResultDataSet_.Tables["underCorrInfo"];

            List <string> first  = new List <string>();
            List <string> second = new List <string>();
            List <string> values = new List <string>();

            foreach (DataRow item in tb.Rows)
            {
                first.Add(item["STOCK_ID"].ToString());
                second.Add(item["OTHER_ID"].ToString());
                values.Add(item["CORR"].ToString());
            }

            CorrelationInfo_paraViewModel corrInfoVM = new CorrelationInfo_paraViewModel();

            corrInfoVM.Dimension_ = underCodeList.Count.ToString();

            //Int32 dimensionTrans = underCodeList.Count;
            //Int32 needCorrNum = dimensionTrans * (dimensionTrans + 1) / 2;

            for (int i = 0; i < values.Count; i++)
            {
                corrInfoVM.Correlation_paraViewModel_.Add(this.makeCorr(first[i], second[i], values[i]));
            }

            return(corrInfoVM);
        }
        public UnderlyingInfo_paraViewModel makeParameterInfoVM(FpmlSerializedCSharp.UnderlyingInformation xml_underInfo)
        {
            UnderlyingInfo_paraViewModel underInfoParaVM = new UnderlyingInfo_paraViewModel();

            ObservableCollection <Underlying_paraViewModel> underParaVMList = new ObservableCollection <Underlying_paraViewModel>();

            List <FpmlSerializedCSharp.Index> xml_indexList = xml_underInfo.IndexUnderInfo_.Index_;

            foreach (var item in xml_indexList)
            {
                underParaVMList.Add(this.makeIndexPara(item));
            }

            // correlation
            CorrelationInfo_paraViewModel corr_paraVM = this.makeCorrPara(xml_indexList);

            return(underInfoParaVM);
        }
        public CorrelationInfo_paraViewModel makeCorrPara(List<FpmlSerializedCSharp.Index> xml_indexList)
        {
            CorrelationInfo_paraViewModel vm = new CorrelationInfo_paraViewModel();

            vm.Dimension_ = xml_indexList.Count.ToString();

            for (int i = 0; i < xml_indexList.Count; i++)
            {
                Correlation_paraViewModel corrParaVM = new Correlation_paraViewModel();
                
                corrParaVM.First_ = "KR7012330007";
                corrParaVM.Second_ = "KR7011170008";
                corrParaVM.Value_ = "0.3328";

                vm.Correlation_paraViewModel_.Add(corrParaVM);
            }

            return vm;
        }
        public CorrelationInfo_paraViewModel makeCorrPara(List <FpmlSerializedCSharp.Index> xml_indexList)
        {
            CorrelationInfo_paraViewModel vm = new CorrelationInfo_paraViewModel();

            vm.Dimension_ = xml_indexList.Count.ToString();

            for (int i = 0; i < xml_indexList.Count; i++)
            {
                Correlation_paraViewModel corrParaVM = new Correlation_paraViewModel();

                corrParaVM.First_  = "KR7012330007";
                corrParaVM.Second_ = "KR7011170008";
                corrParaVM.Value_  = "0.3328";

                vm.Correlation_paraViewModel_.Add(corrParaVM);
            }

            return(vm);
        }
        public void setFromSerial(FpmlSerializedCSharp.ISerialized serial_Class)
        {
            FpmlSerializedCSharp.UnderlyingInfo_para serial_UnderlyingInfo_para = serial_Class as FpmlSerializedCSharp.UnderlyingInfo_para;

            List <FpmlSerializedCSharp.Underlying_para> serial_underlying_para = serial_UnderlyingInfo_para.Underlying_para_;

            this.underlying_paraViewModel_ = new ObservableCollection <Underlying_paraViewModel>();
            foreach (var item in serial_underlying_para)
            {
                string type = item.Type_.ValueStr;
                Underlying_paraViewModel viewModel = Underlying_paraViewModel.CreateUnderlying_para(type);
                viewModel.setFromSerial(item);
                this.underlying_paraViewModel_.Add(viewModel);
            }

            FpmlSerializedCSharp.CorrelationInfo_para serial_correlationInfo_para = serial_UnderlyingInfo_para.CorrelationInfo_para_;
            this.correlationInfo_paraViewModel_ = new CorrelationInfo_paraViewModel();
            this.correlationInfo_paraViewModel_.setFromSerial(serial_correlationInfo_para);

            //this.view_ = new UnderlyingInfo_paraView();
            this.view_.DataContext = this;
        }
        private CorrelationInfo_paraViewModel makeCorrInfo(List<string> underCodeList)
        {

            QueryStr queryStr = new QueryStr(this.corrQueryInfo_);

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < underCodeList.Count; i++)
            {
                sb.Append(QueryStr.wrapComma(underCodeList[i]));

                if (i != underCodeList.Count - 1)
                {
                    sb.Append(",");
                }

            }

            queryStr.VariableMap_.Add("STD_DATE",this.ReferenceDate_.ToString("yyyyMMdd"));
            queryStr.VariableMap_.Add("UNDER_LIST", sb.ToString());

            conn_.addQuery("underCorrInfo", queryStr.getQuery());

            conn_.excute();

            DataTable tb = conn_.ResultDataSet_.Tables["underCorrInfo"];

            List<string> first = new List<string>();
            List<string> second = new List<string>();
            List<string> values = new List<string>();

            foreach (DataRow item in tb.Rows)
            {
                first.Add(item["STOCK_ID"].ToString());
                second.Add(item["OTHER_ID"].ToString());
                values.Add(item["CORR"].ToString());
            }

            CorrelationInfo_paraViewModel corrInfoVM = new CorrelationInfo_paraViewModel();
            corrInfoVM.Dimension_ = underCodeList.Count.ToString();

            //Int32 dimensionTrans = underCodeList.Count;
            //Int32 needCorrNum = dimensionTrans * (dimensionTrans + 1) / 2;

            for (int i = 0; i < values.Count; i++)
            {
                corrInfoVM.Correlation_paraViewModel_.Add(this.makeCorr(first[i], second[i], values[i]));
            }

            return corrInfoVM;

        }
 public void setFromSerial(FpmlSerializedCSharp.ISerialized serial_Class)
 {
     FpmlSerializedCSharp.UnderlyingInfo_para serial_UnderlyingInfo_para = serial_Class as FpmlSerializedCSharp.UnderlyingInfo_para;
 
     List<FpmlSerializedCSharp.Underlying_para> serial_underlying_para = serial_UnderlyingInfo_para.Underlying_para_;
     this.underlying_paraViewModel_ = new ObservableCollection<Underlying_paraViewModel>();
     foreach (var item in serial_underlying_para)
     {
         string type = item.Type_.ValueStr;
         Underlying_paraViewModel viewModel = Underlying_paraViewModel.CreateUnderlying_para(type);
         viewModel.setFromSerial(item);
         this.underlying_paraViewModel_.Add(viewModel);
     }
     
     FpmlSerializedCSharp.CorrelationInfo_para serial_correlationInfo_para = serial_UnderlyingInfo_para.CorrelationInfo_para_;
     this.correlationInfo_paraViewModel_ = new CorrelationInfo_paraViewModel();
     this.correlationInfo_paraViewModel_.setFromSerial(serial_correlationInfo_para);
     
    //this.view_ = new UnderlyingInfo_paraView();
     this.view_.DataContext = this;
 }
        public void initializeParameter(IndexUnderInfoViewModel indexUnderInfoVM)
        {
            foreach (var item in indexUnderInfoVM.IndexUnderList_)
            {
                string typeStr = item.Type_;
                Underlying_paraViewModel vm = Underlying_paraViewModel.CreateUnderlying_para("geometricBM");
                vm.KrCode_ = item.KRCode_;
                vm.UnderName_ = item.Name_;

            }

            this.correlationInfo_paraViewModel_ = new CorrelationInfo_paraViewModel();
            this.correlationInfo_paraViewModel_.initializeParameter(indexUnderInfoVM);
        }