public LimitDisplayModel CheckFXSwapPCE(SessionInfo sessioninfo, DA_TRN trn1, DA_TRN trn2, string strExcludeID) { StaticDataBusiness _staticDataBusiness = new StaticDataBusiness(); LimitCheckBusiness _limitCheckBusiness = new LimitCheckBusiness(); LimitDisplayModel limitDisplay = new LimitDisplayModel(); DA_TRN oldtrn1 = null; DA_TRN oldtrn2 = null; Guid guExcludeID1 = Guid.Empty; Guid guExcludeID2 = Guid.Empty; //Exposure include far leg only -> set near leg to 0 trn1.KK_PCCF = 0; trn2.KK_PCCF = _staticDataBusiness.GetPCCF(sessioninfo, trn2); //Find original deals for exclude them from limit calculation if (strExcludeID != null && Guid.TryParse(strExcludeID.Replace("\"", ""), out guExcludeID1)) { guExcludeID1 = Guid.Parse(strExcludeID.Replace("\"", "")); oldtrn1 = GetByID(guExcludeID1); oldtrn2 = GetDealByProcessDate(sessioninfo.Process.CurrentDate).FirstOrDefault(p => p.INT_DEAL_NO == oldtrn1.INT_DEAL_NO && p.VERSION == oldtrn1.VERSION && p.ID != oldtrn1.ID); if (oldtrn2 == null || oldtrn1 == null) throw this.CreateException(new Exception(), "Cannot find original deals."); guExcludeID1 = oldtrn1.ID; guExcludeID2 = oldtrn2.ID; } if (trn1.KK_PCCF != null && trn2.KK_PCCF != null) { trn1.KK_CONTRIBUTE = 0; trn2.KK_CONTRIBUTE = Math.Ceiling(trn2.NOTIONAL_THB.Value * trn2.KK_PCCF.Value / 100); List<LimitCheckModel> limits = _limitCheckBusiness.CheckAllPCE(sessioninfo.Process.CurrentDate, trn1, guExcludeID1, guExcludeID2); foreach (LimitCheckModel limit in limits) { limit.DEAL_CONTRIBUTION = trn1.KK_CONTRIBUTE.Value + trn2.KK_CONTRIBUTE.Value; SetLimitDisplayStatus(limit, sessioninfo.PCEOverwrite, ref limitDisplay); } if (limitDisplay.LimitCheckStatus == eLimitCheckStatus.NEEDAPPROVE) { trn1.OVER_AMOUNT = limitDisplay.OverAmount; trn2.OVER_AMOUNT = limitDisplay.OverAmount; } limitDisplay.LimitDisplayObject = limits; } else { limitDisplay.LimitCheckStatus = eLimitCheckStatus.ERROR; limitDisplay.Message = "This deal breach allowed tenor."; } return limitDisplay; }
//public LimitDisplayModel CheckPCE(SessionInfo sessioninfo, DA_TRN trn) //{ // StaticDataBusiness _staticDataBusiness = new StaticDataBusiness(); // LimitCheckBusiness _limitCheckBusiness = new LimitCheckBusiness(); // LimitDisplayModel limitDisplay = new LimitDisplayModel(); // trn.KK_PCCF = _staticDataBusiness.GetPCCF(sessioninfo, trn); // if (trn.KK_PCCF != null) // { // trn.KK_CONTRIBUTE = Math.Ceiling(trn.NOTIONAL_THB.Value * trn.KK_PCCF.Value / 100); // List<LimitCheckModel> limits = _limitCheckBusiness.GetPCEByCriteria(sessioninfo.Process.CurrentDate, trn.CTPY_ID, trn.PRODUCT_ID.Value, "", Guid.Empty, Guid.Empty); // foreach (LimitCheckModel limit in limits) // { // limit.DEAL_CONTRIBUTION = trn.KK_CONTRIBUTE.Value; // SetLimitDisplayStatus(limit, ref limitDisplay); // } // limitDisplay.LimitDisplayObject = limits; // } // else // { // limitDisplay.LimitCheckStatus = eLimitCheckStatus.NOTALLOW; // limitDisplay.LimitErrorObj = new { Result = "ERROR", Message = "This deal breach allowed tenor." }; // } // return limitDisplay; //} public LimitDisplayModel CheckPCE(SessionInfo sessioninfo, DA_TRN trn, string strExcludeID) { StaticDataBusiness _staticDataBusiness = new StaticDataBusiness(); LimitCheckBusiness _limitCheckBusiness = new LimitCheckBusiness(); LimitDisplayModel limitDisplay = new LimitDisplayModel(); Guid guExcludeID = Guid.Empty; trn.KK_PCCF = _staticDataBusiness.GetPCCF(sessioninfo, trn); //Find original deal for exclude it from limit calculation if (strExcludeID != null && Guid.TryParse(strExcludeID.Replace("\"", ""), out guExcludeID)) guExcludeID = Guid.Parse(strExcludeID.Replace("\"", "")); if (trn.KK_PCCF != null) { trn.KK_CONTRIBUTE = Math.Ceiling(trn.NOTIONAL_THB.Value * trn.KK_PCCF.Value / 100); List<LimitCheckModel> limits = _limitCheckBusiness.CheckAllPCE(sessioninfo.Process.CurrentDate, trn, guExcludeID, Guid.Empty); foreach (LimitCheckModel limit in limits) { limit.DEAL_CONTRIBUTION = trn.KK_CONTRIBUTE.Value; SetLimitDisplayStatus(limit, sessioninfo.PCEOverwrite, ref limitDisplay); } if (limitDisplay.LimitCheckStatus == eLimitCheckStatus.NEEDAPPROVE) trn.OVER_AMOUNT = limitDisplay.OverAmount; limitDisplay.LimitDisplayObject = limits; } else { limitDisplay.LimitCheckStatus = eLimitCheckStatus.ERROR; limitDisplay.Message = "This deal breach allowed tenor."; } return limitDisplay; }
/// <summary> /// Generate DA_TRN object from Opics Transaction /// </summary> /// <param name="sessioninfo"></param> /// <param name="opicdeal"></param> /// <param name="processdate"></param> private static DA_TRN GenerateTrnObject(SessionInfo sessioninfo, DEALModel opicdeal, DA_TRN dmkDeal, DateTime processdate) { StaticDataBusiness _staticdataBusiness = new StaticDataBusiness(); CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); InstrumentBusiness _instrumentBusiness = new InstrumentBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); LoggingHelper.Debug("Generate transaction object : " + opicdeal.EXT_DEAL_NO); DA_TRN newDeal = CreateDealTemplate(sessioninfo); try { newDeal.ENGINE_DATE = processdate; newDeal.STATUS_ID = _lookupvaluesRepository.StatusRepository.GetByLabel(StatusCode.MATCHED.ToString()).ID; newDeal.PRODUCT_ID = _lookupvaluesRepository.ProductRepository.GetByLabel(opicdeal.PRODUCT.Trim()).ID; //newDeal.INT_DEAL_NO = dmkNo; newDeal.EXT_DEAL_NO = opicdeal.EXT_DEAL_NO; //newDeal.VERSION = 1; newDeal.SOURCE = SourceType.EXT.ToString(); newDeal.CTPY_ID = _counterpartyBusiness.GetByUsercode(Convert.ToInt32(opicdeal.CPTY.Trim())).ID; newDeal.EXT_PORTFOLIO = opicdeal.EXT_PORTFOLIO; newDeal.FLAG_BUYSELL = opicdeal.BUY_SELL; if (!String.IsNullOrEmpty(opicdeal.PORTFOLIO.Trim())) newDeal.PORTFOLIO_ID = _lookupvaluesRepository.PortfolioRepository.GetByLabel(opicdeal.PORTFOLIO.Trim()).ID; newDeal.START_DATE = opicdeal.START_DATE; newDeal.MATURITY_DATE = opicdeal.MATURITY_DATE; newDeal.TRADE_DATE = opicdeal.TRADE_DATE; newDeal.INSERT_BY_EXT = opicdeal.INSERT_BY_EXT; newDeal.FLAG_SETTLE = dmkDeal != null && dmkDeal.FLAG_SETTLE != null ? dmkDeal.FLAG_SETTLE : opicdeal.FLAG_SETTLE == 1 ? true : false; if (dmkDeal != null) { newDeal.INT_DEAL_NO = dmkDeal.INT_DEAL_NO; newDeal.VERSION = dmkDeal.VERSION; newDeal.REMARK = dmkDeal.REMARK + " " + opicdeal.REMARK; newDeal.LOG.INSERTDATE = dmkDeal.LOG.INSERTDATE; newDeal.LOG.INSERTBYUSERID = dmkDeal.LOG.INSERTBYUSERID; //newDeal.FLAG_SETTLE = dmkDeal.FLAG_SETTLE; newDeal.OVER_AMOUNT = dmkDeal.OVER_AMOUNT; newDeal.OVER_APPROVER = dmkDeal.OVER_APPROVER; newDeal.OVER_COMMENT = dmkDeal.OVER_COMMENT; newDeal.OVER_SETTL_AMOUNT = dmkDeal.OVER_SETTL_AMOUNT; } else { newDeal.VERSION = 1; } var spotrate = _lookupBusiness.GetSpotRateAll().AsQueryable(); MA_SPOT_RATE firstrate = new MA_SPOT_RATE(); MA_SPOT_RATE secondRate = new MA_SPOT_RATE(); switch ((ProductCode)Enum.Parse(typeof(ProductCode), opicdeal.PRODUCT.Replace(" ", string.Empty))) { case ProductCode.BOND: newDeal.INSTRUMENT_ID = _instrumentBusiness.GetByLabel(sessioninfo, opicdeal.INSTRUMENT.Trim()).ID; //First only if (!String.IsNullOrEmpty(opicdeal.CCY1)) newDeal.FIRST.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY1).ID; newDeal.FIRST.NOTIONAL = opicdeal.NOTIONAL1; //THB Notional var firstRate = spotrate.FirstOrDefault(p => p.CURRENCY_ID == newDeal.FIRST.CCY_ID && p.PROC_DATE == newDeal.TRADE_DATE); if (firstRate != null) { newDeal.NOTIONAL_THB = Math.Abs(newDeal.FIRST.NOTIONAL.Value * firstRate.RATE); } else { throw new UIPException(new Exception(), "Error : There is no " + opicdeal.CCY1 + " spot rate on " + newDeal.TRADE_DATE.Value.ToString(FormatTemplate.DATE_DMY_LABEL)); } newDeal.FLAG_PCE = dmkDeal != null && dmkDeal.FLAG_PCE != null ? dmkDeal.FLAG_PCE : false; newDeal.KK_PCCF = _staticdataBusiness.GetPCCF(sessioninfo, newDeal); newDeal.KK_CONTRIBUTE = Math.Ceiling(newDeal.NOTIONAL_THB.Value * newDeal.KK_PCCF.Value / 100); break; case ProductCode.REPO: newDeal.INSTRUMENT_ID = _instrumentBusiness.GetByLabel(sessioninfo, opicdeal.INSTRUMENT.Trim()).ID; //First only if (!String.IsNullOrEmpty(opicdeal.CCY1)) newDeal.FIRST.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY1).ID; newDeal.FIRST.NOTIONAL = newDeal.NOTIONAL_THB = opicdeal.NOTIONAL1; newDeal.KK_PCCF = _staticdataBusiness.GetPCCF(sessioninfo, newDeal); newDeal.KK_CONTRIBUTE = Math.Ceiling(newDeal.NOTIONAL_THB.Value * newDeal.KK_PCCF.Value / 100); break; case ProductCode.SWAP: newDeal.INSTRUMENT_ID = _instrumentBusiness.GetByLabel(sessioninfo, opicdeal.INSTRUMENT.Trim()).ID; //First and Second if (!String.IsNullOrEmpty(opicdeal.CCY1)) newDeal.FIRST.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY1).ID; if (!String.IsNullOrEmpty(opicdeal.FREQ1)) newDeal.FIRST.FREQTYPE_ID = _lookupvaluesRepository.FrequencyRepository.GetByUsercode(opicdeal.FREQ1).ID; newDeal.FIRST.FIRSTFIXINGAMT = opicdeal.FIRST_FIXING1; newDeal.FIRST.FLAG_FIXED = opicdeal.FIXED_FLOAT1 == CouponType.FIXED.ToString() ? true : false; newDeal.FIRST.FLAG_PAYREC = opicdeal.PAY_REC1; newDeal.FIRST.NOTIONAL = newDeal.NOTIONAL_THB = opicdeal.NOTIONAL1; newDeal.FIRST.RATE = opicdeal.RATE1; //Second if (!String.IsNullOrEmpty(opicdeal.CCY2)) newDeal.SECOND.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY2).ID; if (!String.IsNullOrEmpty(opicdeal.FREQ2)) newDeal.SECOND.FREQTYPE_ID = _lookupvaluesRepository.FrequencyRepository.GetByUsercode(opicdeal.FREQ2).ID; newDeal.SECOND.FIRSTFIXINGAMT = opicdeal.FIRST_FIXING2; newDeal.SECOND.FLAG_FIXED = opicdeal.FIXED_FLOAT2 == CouponType.FIXED.ToString() ? true : false; newDeal.SECOND.FLAG_PAYREC = opicdeal.PAY_REC2; newDeal.SECOND.NOTIONAL = opicdeal.NOTIONAL2; newDeal.SECOND.RATE = opicdeal.RATE2; //THB Notional if (opicdeal.CCY1 == "THB") newDeal.NOTIONAL_THB = Math.Abs(newDeal.FIRST.NOTIONAL.Value); else if (opicdeal.CCY2 == "THB") newDeal.NOTIONAL_THB = Math.Abs(newDeal.SECOND.NOTIONAL.Value); else { firstRate = spotrate.FirstOrDefault(p => p.CURRENCY_ID == newDeal.FIRST.CCY_ID && p.PROC_DATE == newDeal.TRADE_DATE); secondRate = spotrate.FirstOrDefault(p => p.CURRENCY_ID == newDeal.SECOND.CCY_ID && p.PROC_DATE == newDeal.TRADE_DATE); if (firstRate != null && secondRate != null) { if (Math.Abs(newDeal.FIRST.NOTIONAL.Value * firstRate.RATE) > Math.Abs(newDeal.SECOND.NOTIONAL.Value * secondRate.RATE)) newDeal.NOTIONAL_THB = Math.Abs(newDeal.FIRST.NOTIONAL.Value * firstRate.RATE); else newDeal.NOTIONAL_THB = Math.Abs(newDeal.SECOND.NOTIONAL.Value * secondRate.RATE); } else { string mess = string.Empty; mess += firstRate == null ? opicdeal.CCY1 : string.Empty; mess += secondRate == null ? (mess != string.Empty ? " and " + opicdeal.CCY2 : opicdeal.CCY2) : string.Empty; throw new UIPException(new Exception(), "Error : There is no " + mess + " spot rate on " + newDeal.TRADE_DATE.Value.ToString(FormatTemplate.DATE_DMY_LABEL)); } } newDeal.KK_PCCF = _staticdataBusiness.GetPCCF(sessioninfo, newDeal); newDeal.KK_CONTRIBUTE = Math.Ceiling(newDeal.NOTIONAL_THB.Value * newDeal.KK_PCCF.Value / 100); //newDeal.BOT_PCCF = _staticdataBusiness.GetSwapBOTPCCF(sessioninfo, newDeal); //newDeal.BOT_CONTRIBUTE = Math.Ceiling(newDeal.NOTIONAL_THB.Value * newDeal.BOT_PCCF.Value / 100); break; case ProductCode.FXSPOT: newDeal.INSTRUMENT_ID = _instrumentBusiness.GetFXInstrumentByCCY(sessioninfo, ProductCode.FXSPOT, opicdeal.CCY1, opicdeal.CCY2).ID; if (!String.IsNullOrEmpty(opicdeal.CCY1)) newDeal.FIRST.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY1).ID; newDeal.FIRST.FLAG_PAYREC = opicdeal.PAY_REC1; newDeal.FIRST.NOTIONAL = opicdeal.NOTIONAL1; newDeal.FIRST.RATE = opicdeal.RATE1; if (!String.IsNullOrEmpty(opicdeal.CCY2)) newDeal.SECOND.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY2).ID; newDeal.SECOND.FLAG_PAYREC = opicdeal.PAY_REC2; newDeal.SECOND.NOTIONAL = opicdeal.NOTIONAL2; //THB Notional if (opicdeal.CCY1 == "THB") newDeal.NOTIONAL_THB = Math.Abs(newDeal.FIRST.NOTIONAL.Value); else if (opicdeal.CCY2 == "THB") newDeal.NOTIONAL_THB = Math.Abs(newDeal.SECOND.NOTIONAL.Value); else { firstRate = spotrate.FirstOrDefault(p => p.CURRENCY_ID == newDeal.FIRST.CCY_ID && p.PROC_DATE == newDeal.TRADE_DATE); secondRate = spotrate.FirstOrDefault(p => p.CURRENCY_ID == newDeal.SECOND.CCY_ID && p.PROC_DATE == newDeal.TRADE_DATE); if (firstRate != null && secondRate != null) { if (Math.Abs(newDeal.FIRST.NOTIONAL.Value * firstRate.RATE) > Math.Abs(newDeal.SECOND.NOTIONAL.Value * secondRate.RATE)) newDeal.NOTIONAL_THB = Math.Abs(newDeal.FIRST.NOTIONAL.Value * firstRate.RATE); else newDeal.NOTIONAL_THB = Math.Abs(newDeal.SECOND.NOTIONAL.Value * secondRate.RATE); } else { string mess = string.Empty; mess += firstRate == null ? opicdeal.CCY1 : string.Empty; mess += secondRate == null ? (mess != string.Empty ? " and " + opicdeal.CCY2 : opicdeal.CCY2) : string.Empty; throw new UIPException(new Exception(), "Error : There is no " + mess + " spot rate on " + newDeal.TRADE_DATE.Value.ToString(FormatTemplate.DATE_DMY_LABEL)); } } newDeal.KK_PCCF = _staticdataBusiness.GetPCCF(sessioninfo, newDeal); newDeal.KK_CONTRIBUTE = Math.Ceiling(newDeal.NOTIONAL_THB.Value * newDeal.KK_PCCF.Value / 100); break; case ProductCode.FXFORWARD: newDeal.INSTRUMENT_ID = _instrumentBusiness.GetFXInstrumentByCCY(sessioninfo, ProductCode.FXFORWARD, opicdeal.CCY1, opicdeal.CCY2).ID; newDeal.START_DATE = dmkDeal != null ? dmkDeal.START_DATE : opicdeal.START_DATE; if (!String.IsNullOrEmpty(opicdeal.CCY1)) newDeal.FIRST.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY1).ID; newDeal.FIRST.FLAG_PAYREC = opicdeal.PAY_REC1; newDeal.FIRST.NOTIONAL = opicdeal.NOTIONAL1; newDeal.FIRST.RATE = opicdeal.RATE1; newDeal.FIRST.SWAP_POINT = opicdeal.SWAP_POINT1; if (!String.IsNullOrEmpty(opicdeal.CCY2)) newDeal.SECOND.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY2).ID; newDeal.SECOND.FLAG_PAYREC = opicdeal.PAY_REC2; newDeal.SECOND.NOTIONAL = opicdeal.NOTIONAL2; newDeal.SECOND.SWAP_POINT = opicdeal.SWAP_POINT2; //THB Notional if (opicdeal.CCY1 == "THB") newDeal.NOTIONAL_THB = Math.Abs(newDeal.FIRST.NOTIONAL.Value); else if (opicdeal.CCY2 == "THB") newDeal.NOTIONAL_THB = Math.Abs(newDeal.SECOND.NOTIONAL.Value); else { firstRate = spotrate.FirstOrDefault(p => p.CURRENCY_ID == newDeal.FIRST.CCY_ID && p.PROC_DATE == newDeal.TRADE_DATE); secondRate = spotrate.FirstOrDefault(p => p.CURRENCY_ID == newDeal.SECOND.CCY_ID && p.PROC_DATE == newDeal.TRADE_DATE); if (firstRate != null && secondRate != null) { if (Math.Abs(newDeal.FIRST.NOTIONAL.Value * firstRate.RATE) > Math.Abs(newDeal.SECOND.NOTIONAL.Value * secondRate.RATE)) newDeal.NOTIONAL_THB = Math.Abs(newDeal.FIRST.NOTIONAL.Value * firstRate.RATE); else newDeal.NOTIONAL_THB = Math.Abs(newDeal.SECOND.NOTIONAL.Value * secondRate.RATE); } else { string mess = string.Empty; mess += firstRate == null ? opicdeal.CCY1 : string.Empty; mess += secondRate == null ? (mess != string.Empty ? " and " + opicdeal.CCY2 : opicdeal.CCY2) : string.Empty; throw new UIPException(new Exception(), "Error : There is no " + mess + " spot rate on " + newDeal.TRADE_DATE.Value.ToString(FormatTemplate.DATE_DMY_LABEL)); } } newDeal.SPOT_DATE = opicdeal.SPOT_DATE; newDeal.KK_PCCF = _staticdataBusiness.GetPCCF(sessioninfo, newDeal); newDeal.KK_CONTRIBUTE = Math.Ceiling(newDeal.NOTIONAL_THB.Value * newDeal.KK_PCCF.Value / 100); break; case ProductCode.FXSWAP: newDeal.INSTRUMENT_ID = _instrumentBusiness.GetFXInstrumentByCCY(sessioninfo, ProductCode.FXSWAP, opicdeal.CCY1, opicdeal.CCY2).ID; newDeal.FLAG_NEARFAR = opicdeal.FLAG_NEARFAR; newDeal.START_DATE = dmkDeal != null ? dmkDeal.START_DATE : opicdeal.START_DATE; if (!String.IsNullOrEmpty(opicdeal.CCY1)) newDeal.FIRST.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY1).ID; newDeal.FIRST.FLAG_PAYREC = opicdeal.PAY_REC1; newDeal.FIRST.NOTIONAL = opicdeal.NOTIONAL1; newDeal.FIRST.RATE = opicdeal.RATE1; newDeal.FIRST.SWAP_POINT = opicdeal.SWAP_POINT1; if (!String.IsNullOrEmpty(opicdeal.CCY2)) newDeal.SECOND.CCY_ID = _lookupvaluesRepository.CurrencyRepository.GetByLabel(opicdeal.CCY2).ID; newDeal.SECOND.FLAG_PAYREC = opicdeal.PAY_REC2; newDeal.SECOND.NOTIONAL = opicdeal.NOTIONAL2; newDeal.SECOND.SWAP_POINT = opicdeal.SWAP_POINT2; //THB Notional if (opicdeal.CCY1 == "THB") newDeal.NOTIONAL_THB = Math.Abs(newDeal.FIRST.NOTIONAL.Value); else if (opicdeal.CCY2 == "THB") newDeal.NOTIONAL_THB = Math.Abs(newDeal.SECOND.NOTIONAL.Value); else { firstRate = spotrate.FirstOrDefault(p => p.CURRENCY_ID == newDeal.FIRST.CCY_ID && p.PROC_DATE == newDeal.TRADE_DATE); secondRate = spotrate.FirstOrDefault(p => p.CURRENCY_ID == newDeal.SECOND.CCY_ID && p.PROC_DATE == newDeal.TRADE_DATE); if (firstRate != null && secondRate != null) { if (Math.Abs(newDeal.FIRST.NOTIONAL.Value * firstRate.RATE) > Math.Abs(newDeal.SECOND.NOTIONAL.Value * secondRate.RATE)) newDeal.NOTIONAL_THB = Math.Abs(newDeal.FIRST.NOTIONAL.Value * firstRate.RATE); else newDeal.NOTIONAL_THB = Math.Abs(newDeal.SECOND.NOTIONAL.Value * secondRate.RATE); } else { string mess = string.Empty; mess += firstRate == null ? opicdeal.CCY1 : string.Empty; mess += secondRate == null ? (mess != string.Empty ? " and " + opicdeal.CCY2 : opicdeal.CCY2) : string.Empty; throw new UIPException(new Exception(), "Error : There is no " + mess + " spot rate on " + newDeal.TRADE_DATE.Value.ToString(FormatTemplate.DATE_DMY_LABEL)); } } newDeal.SPOT_DATE = opicdeal.SPOT_DATE; //Exposure include far leg only -> set near leg to 0 if (newDeal.FLAG_NEARFAR == "N") { newDeal.KK_PCCF = 0; newDeal.KK_CONTRIBUTE = 0; } else { newDeal.KK_PCCF = _staticdataBusiness.GetPCCF(sessioninfo, newDeal); newDeal.KK_CONTRIBUTE = Math.Ceiling(newDeal.NOTIONAL_THB.Value * newDeal.KK_PCCF.Value / 100); } break; default: throw new UIPException(new Exception(), String.Format("The product is not defined in the OPICS deal no {0}.", opicdeal.EXT_DEAL_NO)); } } catch (Exception ex) { throw new UIPException(new Exception(), ex.Message); } return newDeal; }