Example #1
0
        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.");
        }
Example #2
0
        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 });
            }
        }