// batch를 위한 calculate임. // controller를 통해 도는게 아님 public string calculate(string itemCode, DateTime refDate) { string result = ""; try { // load from master Excel_instrumentViewModel e_ivm = MasterInformationViewModel.loadInstrumentVM(itemCode); e_ivm.loadBatchDetailContext(); e_ivm.Excel_parameterViewModel_.ReferenceDate_ = refDate; e_ivm.loadParameterFromXml(); e_ivm.calculate(); result = e_ivm.Excel_parameterViewModel_.Excel_resultViewModel_.calcValue(); return(result); } catch (Exception e) { string errStr = "calculation fail : " + e.Message; return(errStr); } }
public void load_instrument(string itemCode) { try { Excel_instrumentViewModel e_i_hvm = MasterInformationViewModel.loadInstrumentVM(itemCode); //this.InstVM_ = new Excel_instrument_hifiveViewModel(); this.InstVM_ = e_i_hvm as Excel_instrument_structuredSwapViewModel; if (this.InstVM_ == null) { throw new Exception("instrument is not structuredSwap type"); } this.InstVM_.loadInterfaceVMFromXml(XMLFileLoader.LoadInstrument(itemCode)); this.swapInterfaceVM_ = this.InstVM_.Excel_interfaceViewModel_ as Excel_structuredSwapViewModel; // parameter load는 나중에 하자으. //// //Excel_standardSwapParaViewModel e_sspvm = this.InstVM_.Excel_parameterViewModel_ as Excel_standardSwapParaViewModel; //// //foreach (var item in InstVM_.Excel_interfaceViewModel_.Excel_underlyingCalcInfoViewModel_.Excel_underlyingInfoViewModel_) //{ // Excel_underlyingInfo_paraViewModel e_u_pvm = new Excel_underlyingInfo_paraViewModel(); // e_u_pvm.buildParaSetting(item); // e_sspvm.Excel_underlyingCalcInfo_paraViewModel_.Excel_underlyingInfo_paraViewModel_.Add(e_u_pvm); // e_sspvm.Excel_underlyingCalcInfo_paraViewModel_.Excel_correlationInfo_paraViewModel_.addDiagonal(e_u_pvm); //} this.ErrLog_.add("load complete"); } catch (Exception e) { this.ErrLog_.add("load err : " + e.Message); } }
public string build_parameter(string itemCode, DateTime refDate, ParameterBuildType pbt) { try { // load from master Excel_instrumentViewModel e_ivm = MasterInformationViewModel.loadInstrumentVM(itemCode); e_ivm.loadBatchDetailContext(); // build e_ivm.buildParameterFromInstrument(refDate); e_ivm.Excel_parameterViewModel_.saveXml(); return("para build OK : " + itemCode); } catch (Exception e) { return("para build fail : " + itemCode + " , " + e.Message); } }