示例#1
0
        /// <summary>
        /// Validation OPICS deal as CPTY, INSTRUMENT
        /// </summary>
        /// <param name="opicdeal"></param>
        /// <returns></returns>
        private static bool ValidateOPICS(DEALModel opicdeal)
        {
            bool found = true;
            InstrumentBusiness _instrumentBusiness = new InstrumentBusiness();
            CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
            MA_INSTRUMENT ins = null;

            LoggingHelper.Debug("Validate OPICS data");

            MA_COUTERPARTY counterparty = _counterpartyBusiness.GetByUsercode(Convert.ToInt32(opicdeal.CPTY));

            if (counterparty == null) //counterparty must be check whether it exist in  DMK
                throw new UIPException(new Exception(), String.Format("Counterparty {0} is not defined in Dealmaker.", opicdeal.SNAME.Trim()));

            ProductCode eProductCode = (ProductCode)Enum.Parse(typeof(ProductCode), opicdeal.PRODUCT.Replace(" ", string.Empty));

            if (eProductCode == ProductCode.BOND || eProductCode == ProductCode.REPO)
            {
                ins = _instrumentBusiness.GetByLabel(null, opicdeal.INSTRUMENT);

                if (ins == null)
                {
                    found = false;
                    throw new UIPException(new Exception(), String.Format("Instrument {0} is not defined in Dealmaker.", opicdeal.INSTRUMENT));
                }
            }
            else if (eProductCode == ProductCode.FXSPOT || eProductCode == ProductCode.FXFORWARD || eProductCode == ProductCode.FXSWAP)
            {
                ins = _instrumentBusiness.GetFXInstrumentByCCY(null, eProductCode, opicdeal.CCY1, opicdeal.CCY2);

                if (ins == null)
                {
                    found = false;
                    throw new UIPException(new Exception(), String.Format("Currency pair {0} is not defined in Dealmaker.", opicdeal.CCY1 + "/" + opicdeal.CCY2));
                }
            }

            return found;
        }
示例#2
0
        /// <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;
        }
示例#3
0
        /// <summary>
        /// Import Passed for OPICS Deal to DA_TRN table
        /// </summary>
        /// <param name="sessioninfo"></param>
        /// <param name="opicdeal"></param>
        private static void ImportPassedOPICSDeal(SessionInfo sessioninfo, DEALModel opicdeal, DateTime processdate, ref List<DealTranModel> DealTrans)
        {
            StaticDataBusiness _staticdataBusiness = new StaticDataBusiness();
            DealBusiness _dealBusiness = new DealBusiness();
            CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
            InstrumentBusiness _instrumentBusiness = new InstrumentBusiness();

            DA_TRN pastimported = _dealBusiness.GetPastImportedDealsByExtNo(opicdeal.EXT_DEAL_NO);

            DA_TRN newDeal = GenerateTrnObject(sessioninfo, opicdeal, pastimported, processdate);

            DealTrans.Add(new DealTranModel() { ProductTransaction = (ProductCode)Enum.Parse(typeof(ProductCode), opicdeal.PRODUCT.Replace(" ", string.Empty)), Transaction = newDeal, UpdateStates = UpdateStates.Adding });
        }