public List <DA_TRN> GetLimitOverwriteReport(SessionInfo sessionInfo, string strReportDate, string strCtpy) { try { DateTime dteReport; Guid guCtpyID = Guid.Empty; DealBusiness _dealBusiness = new DealBusiness(); if (String.IsNullOrEmpty(strReportDate)) { throw this.CreateException(new Exception(), "Please input date."); } else if (!DateTime.TryParseExact(strReportDate, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReport)) { throw this.CreateException(new Exception(), "Invalid date."); } else { dteReport = DateTime.ParseExact(strReportDate, "dd/MM/yyyy", null); } var trns = _dealBusiness.GetDealByProcessDate(dteReport).AsQueryable(); trns = trns.Where(t => t.OVER_APPROVER != null && t.SOURCE == "INT" && t.MA_STATUS.LABEL != StatusCode.CANCELLED.ToString()); if (Guid.TryParse(strCtpy, out guCtpyID)) { trns = trns.Where(a => a.CTPY_ID == guCtpyID); } return(trns.ToList()); } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }
public async Task <IActionResult> CheckBalance(string invoiceref) { var serv = new DealBusiness(); var result = await serv.CheckBalance(invoiceref); if (result.Code == 200) { var validate = SchemaEngine.Validate <ResponseBalance>(result, respBalanceSchema); if (!validate) { result.Code = 500; result.Message = "Invalid result data schema"; result.Data = null; return(StatusCode(500, result)); } } else { return(StatusCode(result.Code, result)); } return(Ok(result)); }
public static object SubmitFXSwapDeal(SessionInfo sessioninfo , DA_TRN trn1 , DA_TRN trn2 , string strOverApprover , string strOverComment , string strProductId1 , string strProductId2) { try { DealBusiness _dealBusiness = new DealBusiness(); string strDealNO1 = _dealBusiness.SubmitFXDeal(sessioninfo , trn1 , strOverApprover , strOverComment , strProductId1); trn2.INT_DEAL_NO = strDealNO1; string strDealNO2 = _dealBusiness.SubmitFXDeal(sessioninfo , trn2 , strOverApprover , strOverComment , strProductId2 ); return(new { Result = "OK", Message = strDealNO1 }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public void CancelDealTest() { DealBusiness target = new DealBusiness(); // TODO: Initialize to an appropriate value SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value Guid guTrnID = new Guid(); // TODO: Initialize to an appropriate value target.CancelDeal(sessioninfo, guTrnID); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public static List <FIDealModel> GetDealInternalByProcessDate(SessionInfo sessioninfo) { DealBusiness _dealBusiness = new DealBusiness(); UserBusiness _userBusiness = new UserBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); List <MA_CURRENCY> ccys = _lookupBusiness.GetCurrencyAll(); List <MA_USER> users = _userBusiness.GetAll(); Guid productID = _lookupBusiness.GetProductAll().FirstOrDefault(p => p.LABEL == ProductCode.BOND.ToString()).ID; List <DA_TRN> trns = _dealBusiness.GetDealInternalByProcessDate(sessioninfo.Process.CurrentDate); return((from t in trns.Where(a => a.PRODUCT_ID.Value == productID && a.DA_TMBA_EXTENSION != null) join user in users on t.LOG.INSERTBYUSERID equals user.ID into ljuser from inputuser in ljuser.DefaultIfEmpty() join tempccy1 in ccys on t.FIRST.CCY_ID equals tempccy1.ID into ljccy1 from ccy1 in ljccy1.DefaultIfEmpty() join tbmauser in users on t.DA_TMBA_EXTENSION.SENDER_ID equals tbmauser.ID into ljtbmauser from tbmainputuser in ljtbmauser.DefaultIfEmpty() orderby t.LOG.INSERTDATE descending select new FIDealModel { ID = t.ID, DMK_NO = t.INT_DEAL_NO, OPICS_NO = t.EXT_DEAL_NO, InsertState = t.MA_STATUS.LABEL == StatusCode.CANCELLED.ToString() ? "Cancelled" : t.DA_TMBA_EXTENSION.SEND_DATE != null ? "Sent" : 1800 - DateTime.Now.Subtract(t.LOG.INSERTDATE).TotalSeconds <= 0 ? "Late" : (1800 - Math.Round(DateTime.Now.Subtract(t.LOG.INSERTDATE).TotalSeconds)).ToString(), TradeDate = t.TRADE_DATE.Value, MaturityDate = t.MATURITY_DATE, Instrument = t.MA_INSRUMENT.LABEL, BuySell = t.FLAG_BUYSELL, Portfolio = t.MA_PORTFOLIO.LABEL, Counterparty = t.MA_COUTERPARTY.SNAME, Yield = t.FIRST.RATE.Value, GrossValue = t.FIRST.NOTIONAL.Value, CCY = ccy1 != null ? ccy1.LABEL : null, Trader = inputuser != null ? inputuser.USERCODE : null, Status = t.MA_STATUS.LABEL, PCE = t.KK_CONTRIBUTE.HasValue ? t.KK_CONTRIBUTE.Value : 0, Sender = tbmainputuser != null ? tbmainputuser.USERCODE : null, Unit = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.UNIT : 0, CleanPrice = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.CLEAN_PRICE : 0, GrossPrice = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.GROSS_PRICE : 0, YieldType = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.YIELD_TYPE : string.Empty, ReporyBy = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.IS_REPORT_CLEAN ? "Clean Price" : "Gross Price" : string.Empty, Purpose = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.PURPOSE : string.Empty, Term = t.DA_TMBA_EXTENSION != null && t.DA_TMBA_EXTENSION.TERM.HasValue ? t.DA_TMBA_EXTENSION.TERM.Value : 0, Rate = t.DA_TMBA_EXTENSION != null && t.DA_TMBA_EXTENSION.RATE.HasValue ? t.DA_TMBA_EXTENSION.RATE.Value : 0, TBMA_Remark = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.REMARK : string.Empty, SendTime = t.DA_TMBA_EXTENSION != null ? t.DA_TMBA_EXTENSION.SEND_DATE.HasValue ? t.DA_TMBA_EXTENSION.SEND_DATE.Value.ToString("dd MMM yyy HH:mm") : string.Empty : string.Empty, PrimaryMarket = t.FLAG_PCE.Value ? "Yes" : "No", NonDVP = t.FLAG_SETTLE.Value ? "Yes" : "No" }).ToList()); }
public void UpdateDealReconcile(SessionInfo sessioninfo, List <DealTranModel> trns) { DealBusiness _dealBusiness = new DealBusiness(); LoggingHelper.Debug("Begin UpdateDealReconcile...."); using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { foreach (DealTranModel tran in trns) { switch (tran.UpdateStates) { case UpdateStates.Adding: unitOfWork.DA_TRNRepository.Add(tran.Transaction); LoggingHelper.Debug(String.Format("Insert DA_TRN {0} [{1}] is completed", tran.Transaction.INT_DEAL_NO, tran.Transaction.ID.ToString())); break; case UpdateStates.Editing: var update = unitOfWork.DA_TRNRepository.All().FirstOrDefault(p => p.ID == tran.Transaction.ID); if (update == null) { throw this.CreateException(new Exception(), "Data not found!"); } else { update.EXT_DEAL_NO = tran.Transaction.EXT_DEAL_NO; update.EXT_PORTFOLIO = tran.Transaction.EXT_PORTFOLIO; update.MATURITY_DATE = tran.Transaction.MATURITY_DATE; update.STATUS_ID = tran.Transaction.STATUS_ID; update.LOG.MODIFYBYUSERID = tran.Transaction.LOG.MODIFYBYUSERID; update.LOG.MODIFYDATE = tran.Transaction.LOG.MODIFYDATE; update.INSERT_BY_EXT = tran.Transaction.INSERT_BY_EXT; } LoggingHelper.Debug(String.Format("Update DA_TRN {0} [{1}] is completed", update.INT_DEAL_NO, update.ID.ToString())); break; case UpdateStates.Deleting: var delete = unitOfWork.DA_TRNRepository.All().FirstOrDefault(p => p.ID == tran.Transaction.ID); if (delete == null) { throw this.CreateException(new Exception(), "Data not found!"); } else { unitOfWork.DA_TRNRepository.Delete(delete); } LoggingHelper.Debug(String.Format("Delete DA_TRN {0} [{1}] is completed", delete.INT_DEAL_NO, delete.ID.ToString())); break; } } unitOfWork.Commit(); LoggingHelper.Debug("Commit UpdateDealReconcile...."); } }
public static DA_TRN GenerateFXForwardTransactionObject(SessionInfo sessionInfo, string strTradeDate, string strSpotDate, string strSetDate, string strCtpy, string strPortfolio , string strCurrencyPair, string strBS, string strContractCcy, string strCounterCcy , string strSpotRate, string strSwapPoint, string strContractAmt, string strCounterAmt, string strRemark, bool settleFlag, string strProductId) { DealBusiness _dealBusiness = new DealBusiness(); return(_dealBusiness.GenerateFXForwardTransactionObject(sessionInfo, strTradeDate, strSpotDate, strSetDate, strCtpy, strPortfolio , strCurrencyPair, strBS, strContractCcy, strCounterCcy , strSpotRate, strSwapPoint, strContractAmt, strCounterAmt, strRemark, settleFlag, strProductId)); }
public void GetAllTest() { DealBusiness target = new DealBusiness(); // TODO: Initialize to an appropriate value List <DA_TRN> expected = null; // TODO: Initialize to an appropriate value List <DA_TRN> actual; actual = target.GetAll(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void GetNewDealNoTest() { DealBusiness target = new DealBusiness(); // TODO: Initialize to an appropriate value DateTime dteEngine = new DateTime(); // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; actual = target.GetNewDealNo(dteEngine); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public static DA_TRN GenerateFXSwapTransactionObject2(SessionInfo sessionInfo, string strTradeDate, string strCtpy, string strPortfolio, string strCurrencyPair , string strContractCcy, string strCounterCcy, string strSpotRate , string strBSFar, string strSetDateFar, string strSwapPointFar , string strContractAmtFar, string strCounterAmtFar, string strSpotDate, string strRemark, bool settleFlag, int Version) { DealBusiness _dealBusiness = new DealBusiness(); return(_dealBusiness.GenerateFXSwapTransactionObject2(sessionInfo, strTradeDate, strCtpy, strPortfolio, strCurrencyPair , strContractCcy, strCounterCcy, strSpotRate , strBSFar, strSetDateFar, strSwapPointFar , strContractAmtFar, strCounterAmtFar, strSpotDate, strRemark, settleFlag, Version)); }
public List <DA_TRN_CASHFLOW> GetSCEDetailReport(SessionInfo sessioninfo, string strReportDate, string strCtpy, string strProduct, string strSource) { try { DateTime dteReport; DealBusiness _dealBusiness = new DealBusiness(); Guid guTemp; if (String.IsNullOrEmpty(strReportDate)) { throw this.CreateException(new Exception(), "Please input report date."); } else if (!DateTime.TryParseExact(strReportDate, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReport)) { throw this.CreateException(new Exception(), "Invalid report date."); } else { dteReport = DateTime.ParseExact(strReportDate, "dd/MM/yyyy", null); } if (_dealBusiness.CountByProcessDate(dteReport) == 0) { throw this.CreateException(new Exception(), "No data for selected report date."); } var cashflows = _dealBusiness.GetFlowsByProcessDate(dteReport).AsQueryable(); if (!string.IsNullOrEmpty(strSource)) { cashflows = cashflows.Where(p => p.DA_TRN.SOURCE == strSource); } if (Guid.TryParse(strCtpy, out guTemp)) { cashflows = cashflows.Where(p => p.DA_TRN.CTPY_ID == Guid.Parse(strCtpy)); } if (Guid.TryParse(strProduct, out guTemp)) { cashflows = cashflows.Where(p => p.DA_TRN.PRODUCT_ID == Guid.Parse(strProduct)); } return(cashflows.OrderBy(p => p.DA_TRN.INT_DEAL_NO).ThenByDescending(p => p.FLAG_FIRST).ThenBy(p => p.SEQ).ToList()); } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }
public static DA_TRN GenerateFITransactionObject(SessionInfo sessionInfo , string strTradeDate , string strBuySell , string strInstrument , string strCtpy , string strPortfolio , string strSettlementDate , string strYield , string strUnit , string strCleanPrice , string strGrossPrice , string strNotional , string strCCY , string strPceFlag , string strSettleFlag , string strYeildType , string strReportBy , string strPurpose , string strTerm , string strRate , string strTBMARemark , string strRemark , string strProductId) { DealBusiness _dealBusiness = new DealBusiness(); return(_dealBusiness.GenerateFITransactionObject(sessionInfo , strTradeDate , strBuySell , strInstrument , strCtpy , strPortfolio , strSettlementDate , strYield , strUnit , strCleanPrice , strGrossPrice , strNotional , strCCY , strPceFlag , strSettleFlag , strYeildType , strReportBy , strPurpose , strTerm , strRate , strTBMARemark , strRemark , strProductId)); }
public List <DA_TRN> GetPCEDetailReport(SessionInfo sessioninfo, string strReportDate, string strCtpy, string strProduct, string strSource) { try { DateTime dteReport; DealBusiness _dealBusiness = new DealBusiness(); Guid guTemp; if (String.IsNullOrEmpty(strReportDate)) { throw this.CreateException(new Exception(), "Please input report date."); } else if (!DateTime.TryParseExact(strReportDate, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReport)) { throw this.CreateException(new Exception(), "Invalid report date."); } else { dteReport = DateTime.ParseExact(strReportDate, "dd/MM/yyyy", null); } if (_dealBusiness.CountByProcessDate(dteReport) == 0) { throw this.CreateException(new Exception(), "No data for selected report date."); } var trns = _dealBusiness.GetDealByProcessDate(dteReport).Where(p => p.MA_STATUS.LABEL.ToString() != StatusCode.CANCELLED.ToString()).AsQueryable(); if (!string.IsNullOrEmpty(strSource)) { trns = trns.Where(p => p.SOURCE == strSource); } if (Guid.TryParse(strCtpy, out guTemp)) { trns = trns.Where(t => t.CTPY_ID == Guid.Parse(strCtpy)); } if (Guid.TryParse(strProduct, out guTemp)) { trns = trns.Where(s => s.PRODUCT_ID == Guid.Parse(strProduct)); } return(trns.ToList()); } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }
public static DA_TRN GenerateSwapTransactionObject(SessionInfo sessionInfo, string strTradeDate, string strInstrument, string strCtpy, string strPortfolio , string strEffDate, string strMatDate, string strNotional1 , string strCCY1, string strFFL1, string strFFix1, string strRate1, string strFreq1 , string strNotional2, string strCCY2, string strFFL2, string strFFix2, string strRate2, string strFreq2 , int intDaySpan, string strRemark, string strProductId) { DealBusiness _dealBusiness = new DealBusiness(); return(_dealBusiness.GenerateSwapTransactionObject(sessionInfo, strTradeDate, strInstrument, strCtpy, strPortfolio , strEffDate, strMatDate, strNotional1 , strCCY1, strFFL1, strFFix1, strRate1, strFreq1 , strNotional2, strCCY2, strFFL2, strFFix2, strRate2, strFreq2 , intDaySpan, strRemark, strProductId)); //return trn; }
public static DA_TRN GenerateRepoTransactionObject(SessionInfo sessioninfo , string strTradeDate , string strBuySell , string strInstrument , string strCtpy , string strPortfolio , string strEffectiveDate , string strMaturityDate , string strNotional , string strProductId , string strRemark) { DealBusiness _dealBusiness = new DealBusiness(); return(_dealBusiness.GenerateRepoTransactionObject(sessioninfo, strTradeDate, strBuySell, strInstrument , strCtpy, strPortfolio, strEffectiveDate, strMaturityDate , strNotional, strProductId, strRemark)); }
public static object SendFIReport(SessionInfo sessioninfo, string IDs) { try { string[] TrnsID = IDs.Split(','); DealBusiness _dealBusiness = new DealBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); MA_TBMA_CONFIG config = _lookupBusiness.GetTBMAConfig(sessioninfo); Guid productID = _lookupBusiness.GetProductAll().FirstOrDefault(p => p.LABEL == ProductCode.BOND.ToString()).ID; List <DA_TRN> trns = _dealBusiness.GetDealInternalByProcessDate(sessioninfo.Process.CurrentDate) .Where(a => a.PRODUCT_ID.Value == productID && TrnsID.Contains(a.ID.ToString()) && a.DA_TMBA_EXTENSION.SEND_DATE == null).ToList(); var validateTBMA_NAME = (from o1 in trns where string.IsNullOrEmpty(o1.MA_COUTERPARTY.TBMA_NAME) select o1.MA_COUTERPARTY.SNAME).Distinct().ToArray(); //verify required info if (validateTBMA_NAME.Length > 0) { throw CreateException(new Exception(), "TBMA_NAME can't be empty. Please input TBMA_NAME on counterparty " + string.Join(",", validateTBMA_NAME)); } if (config == null) { throw CreateException(new Exception(), "Cannot get configurations. Please contact administrator"); } foreach (DA_TRN trn in trns) { _dealBusiness.CreatingTBMAReportFile(sessioninfo, trn, config); } Guid[] TrnsIDSend = trns.Select(t => t.ID).ToArray(); _dealBusiness.UpdateFISendReport(sessioninfo, TrnsIDSend); return(new { Result = "OK", Message = String.Format("Sending report completed") }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public void SubmitFIDealTest() { DealBusiness target = new DealBusiness(); // TODO: Initialize to an appropriate value SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value string strCtpy = string.Empty; // TODO: Initialize to an appropriate value string strTradeDate = string.Empty; // TODO: Initialize to an appropriate value string strSettlementDate = string.Empty; // TODO: Initialize to an appropriate value string strBuySell = string.Empty; // TODO: Initialize to an appropriate value string strInstrument = string.Empty; // TODO: Initialize to an appropriate value string strPortfolio = string.Empty; // TODO: Initialize to an appropriate value string strNotional = string.Empty; // TODO: Initialize to an appropriate value string strCCY = string.Empty; // TODO: Initialize to an appropriate value string strLimitApp = string.Empty; // TODO: Initialize to an appropriate value Decimal decOverAmount = new Decimal(); // TODO: Initialize to an appropriate value string strOverComment = string.Empty; // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; actual = target.SubmitFIDeal(sessioninfo, strCtpy, strTradeDate, strSettlementDate, strBuySell, strInstrument, strPortfolio, strNotional, strCCY, strLimitApp, decOverAmount, strOverComment); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public async Task <IActionResult> PayService([FromBody] RequestBalance data) { var result = new ResponsePayment(); var validateRequest = SchemaEngine.Validate <RequestBalance>(data, reqBalanceSchema); if (validateRequest) { var serv = new DealBusiness(); result = await serv.PayService(data); if (result.Code == 200) { var validate = SchemaEngine.Validate <ResponsePayment>(result, respPaymentSchema); if (!validate) { result.Code = 500; result.Message = "Invalid result data schema"; result.Data = null; return(StatusCode(500, result)); } } else { return(StatusCode(result.Code, result)); } return(Ok(result)); } else { result.Code = 500; result.Message = "Invalid params schema"; result.Data = null; return(StatusCode(500, result)); } }
public static object SubmitFIDeal(SessionInfo sessioninfo , DA_TRN trn , string strOverApprover , string strOverComment , string strProductId) { try { DealBusiness _dealBusiness = new DealBusiness(); string strDealNO = _dealBusiness.SubmitFIDeal(sessioninfo , trn , strOverApprover , strOverComment , strProductId); return(new { Result = "OK", Message = strDealNO }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public void GetDealInquiryByFilterTest() { DealBusiness target = new DealBusiness(); // TODO: Initialize to an appropriate value SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value string strDMKNo = string.Empty; // TODO: Initialize to an appropriate value string strOPICNo = string.Empty; // TODO: Initialize to an appropriate value string strProduct = string.Empty; // TODO: Initialize to an appropriate value string strCtpy = string.Empty; // TODO: Initialize to an appropriate value string strPortfolio = string.Empty; // TODO: Initialize to an appropriate value string strTradeDate = string.Empty; // TODO: Initialize to an appropriate value string strEffDate = string.Empty; // TODO: Initialize to an appropriate value string strMatDate = string.Empty; // TODO: Initialize to an appropriate value string strInstrument = string.Empty; // TODO: Initialize to an appropriate value string strUser = string.Empty; // TODO: Initialize to an appropriate value int startIndex = 0; // TODO: Initialize to an appropriate value int count = 0; // TODO: Initialize to an appropriate value string sorting = string.Empty; // TODO: Initialize to an appropriate value List <DA_TRN> expected = null; // TODO: Initialize to an appropriate value List <DA_TRN> actual; actual = target.GetDealInquiryByFilter(sessioninfo, strDMKNo, strOPICNo, strProduct, strCtpy, strPortfolio, strTradeDate, strEffDate, strMatDate, strInstrument, strUser, startIndex, count, sorting); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public List <LimitCheckModel> GetCountryReport(SessionInfo sessioninfo, string strReportDate, string strCountry, string strSource, string strStatus) { try { DateTime dteReport; LimitCheckBusiness _limitBusiness = new LimitCheckBusiness(); DealBusiness _dealBusiness = new DealBusiness(); CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); CountryBusiness _countryBusiness = new CountryBusiness(); Guid guCountryID = Guid.Empty; MA_COUNTRY_LIMIT temp_limit = null; if (String.IsNullOrEmpty(strReportDate)) { throw this.CreateException(new Exception(), "Please input report date."); } else if (!DateTime.TryParseExact(strReportDate, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReport)) { throw this.CreateException(new Exception(), "Invalid report date."); } else { dteReport = DateTime.ParseExact(strReportDate, "dd/MM/yyyy", null); } if (_dealBusiness.CountByProcessDate(dteReport) == 0) { throw this.CreateException(new Exception(), "No data for selected report date."); } if (Guid.TryParse(strCountry, out guCountryID)) { guCountryID = Guid.Parse(strCountry); } List <LimitCheckModel> sets = _limitBusiness.GetCountrySETByCriteria(dteReport, guCountryID, strSource, Guid.Empty, Guid.Empty); List <LimitCheckModel> pces = _limitBusiness.GetCountryPCEByCriteria(dteReport, guCountryID, strSource, Guid.Empty, Guid.Empty); var reports = (from report in sets.Union(pces) join pce in pces on report.COUNTRY_ID equals pce.COUNTRY_ID select new LimitCheckModel { COUNTRY_LABEL = report.COUNTRY_LABEL, COUNTRY_ID = report.COUNTRY_ID, FLAG_CONTROL = report.FLAG_CONTROL, GEN_AMOUNT = report.AMOUNT, PROCESSING_DATE = report.PROCESSING_DATE, EXPIRE_DATE = report.EXPIRE_DATE, FLOW_DATE = report.FLOW_DATE, SET_CONTRIBUTE = report.SET_CONTRIBUTE, PCE_CONTRIBUTE = pce.PCE_CONTRIBUTE }).GroupBy(g => new { g.COUNTRY_ID, g.COUNTRY_LABEL, g.FLAG_CONTROL, g.GEN_AMOUNT, g.PROCESSING_DATE, g.EXPIRE_DATE, g.FLOW_DATE, g.PCE_CONTRIBUTE }).Select(s => new LimitCheckModel { COUNTRY_LABEL = s.Key.COUNTRY_LABEL, COUNTRY_ID = s.Key.COUNTRY_ID, FLAG_CONTROL = s.Key.FLAG_CONTROL, GEN_AMOUNT = s.Key.GEN_AMOUNT, PROCESSING_DATE = s.Key.PROCESSING_DATE, EXPIRE_DATE = s.Key.EXPIRE_DATE, FLOW_DATE = s.Key.FLOW_DATE, PCE_CONTRIBUTE = s.Key.PCE_CONTRIBUTE, SET_CONTRIBUTE = s.Sum(x => x.SET_CONTRIBUTE), ORIGINAL_KK_CONTRIBUTE = s.Key.PCE_CONTRIBUTE + s.Sum(y => y.SET_CONTRIBUTE) }).ToList(); foreach (var report in reports) { temp_limit = _countryBusiness.GetActiveTempByCountryID(sessioninfo.Process.CurrentDate, report.FLOW_DATE, report.COUNTRY_ID); if (temp_limit != null) { report.TEMP_AMOUNT = temp_limit.AMOUNT; } } if (strStatus != "") { reports = reports.Where(t => t.STATUS.IndexOf(strStatus, StringComparison.OrdinalIgnoreCase) >= 0).ToList(); } return(reports.OrderBy(p => p.COUNTRY_LABEL).ThenBy(t => t.FLOW_DATE).ToList()); } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }
public static object CancelDeal(SessionInfo sessioninfo, DA_TRN trn) { try { LookupBusiness _lookupBusiness = new LookupBusiness(); UserBusiness _userBusiness = new UserBusiness(); DealBusiness _dealbusiness = new DealBusiness(); DA_TRN t = _dealbusiness.CancelDeal(sessioninfo, trn); DA_TRN t2 = _dealbusiness.GetDealByDealNo(t.INT_DEAL_NO, t.VERSION).FirstOrDefault(p => p.ID != t.ID); if (t2 != null) { _dealbusiness.CancelDeal(sessioninfo, t2); } var inputuser = _userBusiness.GetAll().FirstOrDefault(u => u.ID == t.LOG.INSERTBYUSERID); var query = new DealViewModel { ID = t.ID, EntryDate = t.LOG.INSERTDATE, DMK_NO = t.INT_DEAL_NO , OPICS_NO = t.EXT_DEAL_NO, TradeDate = t.TRADE_DATE.Value , EffectiveDate = t.START_DATE, Instrument = t.MA_INSRUMENT.LABEL , MaturityDate = t.MATURITY_DATE, BuySell = t.FLAG_BUYSELL , Product = t.MA_PRODUCT.LABEL, Portfolio = t.MA_PORTFOLIO.LABEL , Counterparty = t.MA_COUTERPARTY.SNAME, Notional1 = t.FIRST.NOTIONAL , PayRec1 = t.FIRST.FLAG_PAYREC, FixedFloat1 = !t.FIRST.FLAG_FIXED.HasValue ? null : t.FIRST.FLAG_FIXED.Value ? "FIXED" : "FLOAT" , Rate1 = t.FIRST.RATE, Fixing1 = t.FIRST.FIRSTFIXINGAMT, SwapPoint1 = t.FIRST.SWAP_POINT, Notional2 = t.SECOND.NOTIONAL , PayRec2 = t.SECOND.FLAG_PAYREC, FixedFloat2 = !t.SECOND.FLAG_FIXED.HasValue ? null : t.SECOND.FLAG_FIXED == true ? "FIXED" : "FLOAT" , Rate2 = t.SECOND.RATE, Fixing2 = t.SECOND.FIRSTFIXINGAMT, SwapPoint2 = t.SECOND.SWAP_POINT, Status = _lookupBusiness.GetStatusAll().FirstOrDefault(p => p.ID == t.STATUS_ID).LABEL , KKContribute = t.KK_CONTRIBUTE, BotContribute = t.BOT_CONTRIBUTE , LimitOverwrite = string.IsNullOrEmpty(t.OVER_APPROVER) ? "No" : t.OVER_AMOUNT > 0 && t.OVER_SETTL_AMOUNT > 0 ? "Yes" : t.OVER_AMOUNT > 0 ? "PCE" : "SET" , LimitApprover = t.OVER_APPROVER , Trader = inputuser != null ? inputuser.USERCODE : "" , Remark = t.REMARK }; return(new { Result = "OK", Record = query, DealPairID = t2 != null?t2.ID.ToString() : string.Empty }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static DA_TRN GetFXSwapPair(SessionInfo sessioninfo, string strIntDealNo, int intVersion, Guid id) { DealBusiness _dealBusiness = new DealBusiness(); return(_dealBusiness.GetFXSwapPair(strIntDealNo, intVersion, id)); }
public static DA_TRN GetByID(Guid id) { DealBusiness _dealBusiness = new DealBusiness(); return(_dealBusiness.GetByID(id)); }
public static LimitDisplayModel CheckSwapCountryLimit(SessionInfo sessioninfo, DA_TRN trn, string strExcludeID) { DealBusiness _dealBusiness = new DealBusiness(); return(_dealBusiness.CheckSwapCountryLimit(sessioninfo, trn, strExcludeID)); }
public static List <DealViewModel> GetDealInquiryData(SessionInfo sessioninfo , string strDMKNo , string strOPICNo , string strProduct , string strCtpy , string strPortfolio , string strTradeDate , string strEffDate , string strMatDate , string strInstrument , string strUser , string strStatus , string strOverStatus , string strProcDate , string strSettleStatus) { DealBusiness _dealBusiness = new DealBusiness(); UserBusiness _userBusiness = new UserBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database List <DA_TRN> trns = _dealBusiness.GetDealInquiryByFilter(sessioninfo , strDMKNo , strOPICNo , strProduct , strCtpy , strPortfolio , strTradeDate , strEffDate , strMatDate , strInstrument , strUser , strStatus , strProcDate); //Get user data List <MA_USER> users = _userBusiness.GetAll(); List <MA_CURRENCY> ccys = _lookupBusiness.GetCurrencyAll(); List <MA_FREQ_TYPE> freq = _lookupBusiness.GetFreqTypeAll(); return((from t in trns join user in users on t.LOG.INSERTBYUSERID equals user.ID into ljuser from inputuser in ljuser.DefaultIfEmpty() join tempccy1 in ccys on t.FIRST.CCY_ID equals tempccy1.ID into ljccy1 from ccy1 in ljccy1.DefaultIfEmpty() join tempccy2 in ccys on t.SECOND.CCY_ID equals tempccy2.ID into ljccy2 from ccy2 in ljccy2.DefaultIfEmpty() join f1 in freq on t.FIRST.FREQTYPE_ID equals f1.ID into fg1 from subfg1 in fg1.DefaultIfEmpty() join f2 in freq on t.SECOND.FREQTYPE_ID equals f2.ID into fg2 from subfg2 in fg2.DefaultIfEmpty() select new DealViewModel { ID = t.ID, EntryDate = t.LOG.INSERTDATE, DMK_NO = t.INT_DEAL_NO, OPICS_NO = t.EXT_DEAL_NO, TradeDate = t.TRADE_DATE.Value, EffectiveDate = t.START_DATE, Instrument = t.MA_INSRUMENT.LABEL, MaturityDate = t.MATURITY_DATE, BuySell = t.FLAG_BUYSELL, Product = t.MA_PRODUCT.LABEL, Portfolio = t.MA_PORTFOLIO.LABEL, Counterparty = t.MA_COUTERPARTY.SNAME, Notional1 = t.FIRST.NOTIONAL, PayRec1 = t.FIRST.FLAG_PAYREC, FixedFloat1 = !t.FIRST.FLAG_FIXED.HasValue ? null : t.FIRST.FLAG_FIXED.Value ? "FIXED" : "FLOAT", Rate1 = t.FIRST.RATE, Fixing1 = t.FIRST.FIRSTFIXINGAMT, SwapPoint1 = t.FIRST.SWAP_POINT, Notional2 = t.SECOND.NOTIONAL, PayRec2 = t.SECOND.FLAG_PAYREC, FixedFloat2 = !t.SECOND.FLAG_FIXED.HasValue ? null : t.SECOND.FLAG_FIXED == true ? "FIXED" : "FLOAT", Rate2 = t.SECOND.RATE, Fixing2 = t.SECOND.FIRSTFIXINGAMT, SwapPoint2 = t.SECOND.SWAP_POINT, Status = t.MA_STATUS.LABEL, KKContribute = t.KK_CONTRIBUTE, BotContribute = t.BOT_CONTRIBUTE, LimitOverwrite = string.IsNullOrEmpty(t.OVER_APPROVER) ? "No" : t.OVER_AMOUNT > 0 && t.OVER_SETTL_AMOUNT > 0 ? "Yes" : t.OVER_AMOUNT > 0 ? "PCE" : "SET", LimitApprover = t.OVER_APPROVER, Trader = inputuser != null ? inputuser.USERCODE : null, Remark = t.REMARK, CCY1 = ccy1 != null ? ccy1.LABEL : null, CCY2 = ccy2 != null ? ccy2.LABEL : null, SettlementLimit = !t.FLAG_SETTLE.HasValue || !t.FLAG_SETTLE.Value ? "No" : "Yes", Freq1 = subfg1 != null ? subfg1.USERCODE : null, Freq2 = subfg2 != null ? subfg2.USERCODE : null, OpicsTrader = t.INSERT_BY_EXT, TBMA_SENT = t.DA_TMBA_EXTENSION == null ? "N/A" : t.DA_TMBA_EXTENSION.SEND_DATE != null ? "Yes" : "No" }).Where(p => p.LimitOverwrite == strOverStatus || String.IsNullOrEmpty(strOverStatus)) .Where(t => t.SettlementLimit == strSettleStatus || string.IsNullOrEmpty(strSettleStatus)).ToList()); }
public static LimitDisplayModel CheckFXSwapSCE(SessionInfo sessioninfo, DA_TRN trn1, DA_TRN trn2, string strExcludeID) { DealBusiness _dealBusiness = new DealBusiness(); return(_dealBusiness.CheckFXSwapSCE(sessioninfo, trn1, trn2, strExcludeID)); }
public void DealBusinessConstructorTest() { DealBusiness target = new DealBusiness(); Assert.Inconclusive("TODO: Implement code to verify target"); }
public List <LimitCheckModel> GetPCEReport(SessionInfo sessioninfo, string strReportDate, string strCtpy, string strLimit, string strSource, string strStatus) { try { DateTime dteReport; LimitCheckBusiness _limitBusiness = new LimitCheckBusiness(); DealBusiness _dealBusiness = new DealBusiness(); CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); Guid guCtpyID = Guid.Empty; Guid guLimitID = Guid.Empty; if (String.IsNullOrEmpty(strReportDate)) { throw this.CreateException(new Exception(), "Please input report date."); } else if (!DateTime.TryParseExact(strReportDate, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReport)) { throw this.CreateException(new Exception(), "Invalid report date."); } else { dteReport = DateTime.ParseExact(strReportDate, "dd/MM/yyyy", null); } if (Guid.TryParse(strCtpy, out guCtpyID)) { guCtpyID = Guid.Parse(strCtpy); } if (_dealBusiness.CountByProcessDate(dteReport) == 0) { throw this.CreateException(new Exception(), "No data for selected report date."); } var limits = _limitBusiness.GetPCEByCriteria(dteReport, guCtpyID, Guid.Empty, strSource, Guid.Empty, Guid.Empty).Distinct(new LimitCheckComparer()).AsQueryable(); //Get temp limit //Look for temp limit when all conditions meet // 1. Transaction maturity date <= Temp limit maturity date foreach (LimitCheckModel limit in limits) { MA_TEMP_CTPY_LIMIT temp_limit = _counterpartyBusiness.GetActiveTempByID(sessioninfo.Process.CurrentDate, sessioninfo.Process.CurrentDate, limit.CTPY_LIMIT_ID); if (temp_limit != null) { limit.TEMP_AMOUNT = temp_limit.AMOUNT; } } //Additional filter on limit name if (Guid.TryParse(strLimit, out guLimitID)) { LookupBusiness _lookupBusiness = new LookupBusiness(); MA_LIMIT limit = _lookupBusiness.GetLimitAll().FirstOrDefault(t => t.ID == Guid.Parse(strLimit)); limits = limits.Where(t => t.LIMIT_LABEL.IndexOf(limit.LABEL, StringComparison.OrdinalIgnoreCase) >= 0); } if (strStatus != "") { limits = limits.Where(t => t.STATUS.IndexOf(strStatus, StringComparison.OrdinalIgnoreCase) >= 0); } return(limits.ToList()); } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }
public List <RepoReportModel> GetRepoReport(SessionInfo sessioninfo, string strReportDate, string strSource, string strCtpy) { try { DateTime dteReport; LimitCheckBusiness _limitBusiness = new LimitCheckBusiness(); DealBusiness _dealBusiness = new DealBusiness(); LimitProductBusiness _limitProductBusiness = new LimitProductBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); StaticDataBusiness _staticBusiness = new StaticDataBusiness(); List <RepoReportModel> reports = new List <RepoReportModel>(); RepoReportModel report; Guid guCtpyID = Guid.Empty; if (String.IsNullOrEmpty(strReportDate)) { throw this.CreateException(new Exception(), "Please input report date."); } else if (!DateTime.TryParseExact(strReportDate, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReport)) { throw this.CreateException(new Exception(), "Invalid report date."); } else { dteReport = DateTime.ParseExact(strReportDate, "dd/MM/yyyy", null); } if (Guid.TryParse(strCtpy, out guCtpyID)) { guCtpyID = Guid.Parse(strCtpy); } Guid guProductID = _lookupBusiness.GetProductByUsercode(ProductCode.REPO.ToString()).ID; MA_PCCF rev_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("84f608c9-8b58-48eb-a6dd-a5407548784a")); MA_PCCF rep_gov_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("28b24b19-e81d-4f82-a2f0-7c834ee3f91c")); MA_PCCF rep_soe_pccf = _staticBusiness.GetPCCFByID(sessioninfo, Guid.Parse("7014b05e-198f-4f62-94b0-1d54322efbca")); var limits = _limitBusiness.GetPCEByCriteria(dteReport, guCtpyID, guProductID, strSource, Guid.Empty, Guid.Empty).Distinct(new LimitCheckComparer()).ToList(); foreach (LimitCheckModel limit in limits) { report = new RepoReportModel(); report.PROCESSING_DATE = limit.PROCESSING_DATE; report.SNAME = limit.SNAME; report.LIMIT_LABEL = limit.LIMIT_LABEL; report.GEN_AMOUNT = limit.GEN_AMOUNT; report.TEMP_AMOUNT = limit.TEMP_AMOUNT; //report.AMOUNT = limit.AMOUNT; report.EXPIRE_DATE = limit.EXPIRE_DATE; report.ORIGINAL_KK_CONTRIBUTE = limit.ORIGINAL_KK_CONTRIBUTE; report.DEAL_CONTRIBUTION = 0; report.REV_AMOUNT = report.AVAILABLE / rev_pccf.C1.Value * 100; report.REP_GOV_5_AMOUNT = report.AVAILABLE / rep_gov_pccf.C5.Value * 100; report.REP_GOV_10_AMOUNT = report.AVAILABLE / rep_gov_pccf.C10.Value * 100; report.REP_GOV_20_AMOUNT = report.AVAILABLE / rep_gov_pccf.C20.Value * 100; report.REP_GOV_20s_AMOUNT = report.AVAILABLE / rep_gov_pccf.more20.Value * 100; report.REP_SOE_5_AMOUNT = report.AVAILABLE / rep_soe_pccf.C5.Value * 100; report.REP_SOE_10_AMOUNT = report.AVAILABLE / rep_soe_pccf.C10.Value * 100; report.REP_SOE_20_AMOUNT = report.AVAILABLE / rep_soe_pccf.C20.Value * 100; report.REP_SOE_20s_AMOUNT = report.AVAILABLE / rep_soe_pccf.more20.Value * 100; reports.Add(report); } return(reports); } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }