Ejemplo n.º 1
0
        public virtual void calculateSavedXml(DateTime refDate)
        {
            this.loadInterfaceVMFromXml(this.inst_xmlDoc_);

            this.excel_parameterViewModel_.ReferenceDate_ = refDate;

            this.loadParameterFromXml(this.para_xmlDoc_);

            string productXmlStr   = this.inst_xmlDoc_.InnerXml;
            string parameterXmlStr = this.para_xmlDoc_.InnerXml;

            //DateTime tradeDate = this.MasterInformationViewModel_.Trade_date_;
            DateTime effectiveDate = this.Excel_interfaceViewModel_.Excel_issueInfoViewModel_.EffectiveDate_;
            // < date , value > //

            //string underHistData = this.excel_parameterViewModel_.historyUnderData(effectiveDate, refDate);
            string underHistData = this.excel_interfaceViewModel_.Excel_underlyingCalcInfoViewModel_.historyUnderData(effectiveDate, refDate);

            //string result = CalculationModuleDLL.calculationLibCall(productXmlStr, parameterXmlStr);
            //string result = CalculationModuleDLL.calculationLibCall("HIFIVE",
            string result = CalculationModuleDLL.calculationLibCall(this.booking_type_,
                                                                    productXmlStr,
                                                                    parameterXmlStr,
                                                                    underHistData,
                                                                    refDate
                                                                    );



            this.excel_parameterViewModel_.loadResult(this, result);
        }
Ejemplo n.º 2
0
        public virtual void calculate(Excel_instrumentViewModel e_inst)
        {
            string productXmlStr   = e_inst.Excel_interfaceViewModel_.productXml(true);
            string parameterXmlStr = this.paraXml(false);

            //DateTime tradeDate = e_inst.MasterInformationViewModel_.Trade_date_;
            DateTime effectiveDate = e_inst.Excel_interfaceViewModel_.Excel_issueInfoViewModel_.EffectiveDate_;
            // < date , value > //
            //string underHistData = this.historyUnderData(effectiveDate, false);

            string underHistData = e_inst.Excel_interfaceViewModel_.Excel_underlyingCalcInfoViewModel_.historyUnderData(effectiveDate, this.referenceDate_, false);

            string calculationType = e_inst.MasterInformationViewModel_.Booking_type_.ToUpper();

            string result = "not calculated";

            try
            {
                result = CalculationModuleDLL.calculationLibCall(calculationType,
                                                                 productXmlStr,
                                                                 parameterXmlStr,
                                                                 underHistData,
                                                                 this.referenceDate_
                                                                 );

                this.loadResult(e_inst, result);
            }
            catch (Exception e)
            {
                result = "dll error : " + e.Message;

                OutputLogViewModel.addResult(result);

                throw;
            }


            //string result = "empty";

            //try
            //{
            //    MessageManager messageManager = new MessageManager();

            //    messageManager.loadServerInformation();

            //    MessageViewModel mvm = new MessageViewModel();

            //    GridCalculationViewModel gcvm = MessageBodyViewModel.CreateMessageBody("gridCalculation") as GridCalculationViewModel;

            //    gcvm.mergeSetXml(productXmlStr, parameterXmlStr, underHistData);

            //    mvm.TargetCode_ = "gridCalculation";
            //    mvm.MessageBodyViewModel_ = gcvm;

            //    messageManager.send(mvm);

            //    //result = CalculationModuleDLL.calculationLibCall(calculationType,
            //    //                                                        productXmlStr,
            //    //                                                        parameterXmlStr,
            //    //                                                        underHistData
            //    //                                                        );
            //}
            //catch (Exception)
            //{
            //    result = "dll error";
            //}
        }