public static object GetAll() { return(LookupUIP.GetTBMAConfigAll(SessionInfo)); }
public static object Update(MA_FREQ_TYPE record) { return(LookupUIP.UpdateFreqType(SessionInfo, record)); }
public static object Update(MA_STATUS record) { return(LookupUIP.UpdateStatus(SessionInfo, record)); }
public static object Update(MA_BOND_MARKET record) { return(LookupUIP.UpdateBondMarket(SessionInfo, record)); }
public static object Update(MA_LIMIT record) { return(LookupUIP.UpdateLimit(SessionInfo, record)); }
public static object GetByFilter(string processdate, int jtStartIndex, int jtPageSize, string jtSorting) { return(LookupUIP.GetSpotRateByFilter(SessionInfo, processdate, jtStartIndex, jtPageSize, jtSorting)); }
public static object CallTBMA(string instrumentid, string setdate, double yield, double cprice, string ytype, bool y2p) { try { MA_TBMA_CONFIG config = LookupUIP.GetTBMAConfig(SessionInfo); string username, userpassword, token, Key, ErrorMessage; username = config.TBMA_CAL_USERNAME; userpassword = config.TBMA_CAL_PASSWORD; MA_INSTRUMENT ins = InstrumentUIP.GetByID(SessionInfo, new Guid(instrumentid)); if (ins == null) { throw new Exception("Instrument is not found"); } LoggingHelper.Info("TBMA Calculation Service has been called by " + SessionInfo.UserLogon); //Step 1 Create new instant object ThaiBMACalc.ThaiBMA_Claculation_Service calc = new ThaiBMACalc.ThaiBMA_Claculation_Service(); //Service Object ThaiBMACalc.BondFactor BF = new ThaiBMACalc.BondFactor(); //input object ThaiBMACalc.AuthenHeader header = new ThaiBMACalc.AuthenHeader(); //authen object //Step 2 Get token Authen.ThaiBMA_Calculation_Auth authen = new Authen.ThaiBMA_Calculation_Auth(); token = authen.GetToken(username); //Step 3 Get Key for access Key = GetKey.getKeyLogin(token, username, userpassword); header.key = Key; header.username = username; //Step 4 Set auhen value calc.AuthenHeaderValue = header; //Step 5 Set input value to object BF.Symbol = ins.LABEL; BF.SettlementDate = DateTime.ParseExact(setdate, "dd/MM/yyyy", null); BF.TradeDateAndTime = System.DateTime.Now; BF.Yield = yield; BF.Percent_Price = cprice; BF.isYield2Price = y2p; BF.isCallPutOption = false; BF.Unit = 1; BF.PriceType = ThaiBMACalc.PriceType.Clean; if (ins.LABEL.StartsWith("ILB")) { BF.isILB = true; } if (ytype == "DM") { BF.YieldType = ThaiBMACalc.YieldType.DM; } else { BF.YieldType = ThaiBMACalc.YieldType.YTM; } //Step 6 Call calc method ThaiBMACalc.CalculationOutput result = calc.BondCalculation(BF); ThaiBMACalc.ServiceError sresult = (ThaiBMACalc.ServiceError)result.ServiceResult; //Error while calling service if (sresult != null && !sresult.Result) { ErrorMessage = sresult.ErrorMessage; string ErrorNo = sresult.ErrorNo; bool rtn = sresult.Result; string attime = sresult.TimeStamp.ToString(); LoggingHelper.Error("ThaiBMA service is fail. " + ErrorMessage); return(new { Result = "ERROR", Message = "ThaiBMA service is fail. " + ErrorMessage }); } if ((result.CalcError == null) && (result.CalcResult != null)) { ThaiBMACalc.CalcResult myResult = (ThaiBMACalc.CalcResult)result.CalcResult; //Calculation Result double RGrossPrice = 0; double RCleanPrice = 0; double RYield = 0; if (myResult.Symbol.StartsWith("ILB")) { RCleanPrice = (double)myResult.Percent_Unadjusted_CleanPrice; RYield = (double)myResult.Percent_RealYield; RGrossPrice = (double)myResult.Percent_Unadjusted_GrossPrice; } else { RYield = ytype == "DM" ? (double)myResult.Percent_DM : (double)myResult.Percent_Yield; RCleanPrice = (double)myResult.Percent_CleanPrice; RGrossPrice = (double)myResult.Percent_GrossPrice; } return(new { Result = "OK", gprice = RGrossPrice, cprice = RCleanPrice, yield = RYield }); //.... and more } else { Type error = result.CalcError.GetType(); IList <PropertyInfo> props = new List <PropertyInfo>(error.GetProperties()); string errmsg = string.Join(",", props.Where(p => p.GetValue(result.CalcError, null).ToString() != "").Select(p => p.GetValue(result.CalcError, null)).ToList()); LoggingHelper.Error("ThaiBMA Caculation is fail. " + errmsg); return(new { Result = "ERROR", Message = "ThaiBMA Caculation is fail. " + errmsg }); } } catch (Exception ex) { LoggingHelper.Error("ThaiBMA service is fail. " + ex.Message); return(new { Result = "ERROR", Message = ex.Message }); } }
public static object GetCurrencyOptions() { return(LookupUIP.GetCurrencyOptions(SessionInfo)); }
public static object GetBondMarketOptions() { return(LookupUIP.GetBondMarketOptions(SessionInfo)); }
public static object GetPortfolioOptions() { return(LookupUIP.GetPortfolioOptions(SessionInfo)); }
public static object GetFrequencyOptions() { return(LookupUIP.GetFreqTypeOptions(SessionInfo)); }
public static object GetProductNoBondOptions() { return(LookupUIP.GetProductOptions(SessionInfo, ProductCode.BOND.ToString())); }
public static object GetProductOptions() { return(LookupUIP.GetProductOptions(SessionInfo)); }
public static object Update(MA_PRODUCT record) { return(LookupUIP.UpdateProduct(SessionInfo, record)); }
public static object Update(MA_TBMA_CONFIG record) { return(LookupUIP.UpdateTBMAConfig(SessionInfo, record)); }
public static object GetYeildTypeOptions() { return(LookupUIP.GetYeildTypeOptions(SessionInfo)); }
public static object Update(MA_CURRENCY record) { return(LookupUIP.UpdateCurrency(SessionInfo, record)); }
public static object GetReportByOptions() { return(LookupUIP.GetReportByOptions(SessionInfo)); }
public static object Update(MA_SPOT_RATE record) { return(LookupUIP.UpdateSpotRate(SessionInfo, record)); }
public static object GetPurposeOptions() { return(LookupUIP.GetPurposeOptions(SessionInfo)); }
public static object GetByFilter(string label, int jtStartIndex, int jtPageSize, string jtSorting) { return(LookupUIP.GetBondMarketByFilter(SessionInfo, label, jtStartIndex, jtPageSize, jtSorting)); }
public static object GetLimitEventOptions() { return(LookupUIP.GetLimitEventOptions(SessionInfo)); }
public static object GetByFilter(string name, int jtStartIndex, int jtPageSize, string jtSorting) { return(LookupUIP.GetLimitByFilter(SessionInfo, name, jtStartIndex, jtPageSize, jtSorting)); }
public static object Update(MA_PORTFOLIO record) { return(LookupUIP.UpdatePortfolio(SessionInfo, record)); }
public static object GetStatusOptions() { return(LookupUIP.GetStatusOptions(SessionInfo)); }
public static object Update(MA_CSA_TYPE record) { return(LookupUIP.UpdateCSAType(SessionInfo, record)); }