/// <summary> /// Notificacao de execucao de Negocio /// </summary> /// <param name="evento"></param> private void _parse105(EventoSTM evento) { int offset = 0; MEGA0105NotificacaoExecucaoInfo info105 = new MEGA0105NotificacaoExecucaoInfo(); info105.FunctionCode = evento.Cabecalho; info105.InternalReference = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD001_TAM_INTERNAL_REFERENCE); offset += MEGA0105NotificacaoExecucaoInfo.FIELD001_TAM_INTERNAL_REFERENCE; offset += MEGA0105NotificacaoExecucaoInfo.FIELD002_TAM_FUNCTION_CODE; string dthr = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD003_TAM_DSAIOM); info105.DataRegistro = DateTime.ParseExact(dthr, "yyyyMMdd", CultureInfo.InvariantCulture); offset += MEGA0105NotificacaoExecucaoInfo.FIELD003_TAM_DSAIOM; info105.NumeroSequencialOrdem = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD004_TAM_NSEQOM); offset += MEGA0105NotificacaoExecucaoInfo.FIELD004_TAM_NSEQOM; info105.Papel = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD005_TAM_CVALISIM).Trim(); offset += MEGA0105NotificacaoExecucaoInfo.FIELD005_TAM_CVALISIM; info105.GrupoPapel = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD006_TAM_CGRVALCOT); offset += MEGA0105NotificacaoExecucaoInfo.FIELD006_TAM_CGRVALCOT; info105.Side = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD007_TAM_ISENSOM); offset += MEGA0105NotificacaoExecucaoInfo.FIELD007_TAM_ISENSOM; info105.QuantidadeNegocio = Convert.ToInt64(evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD008_TAM_QTITTRAN)); offset += MEGA0105NotificacaoExecucaoInfo.FIELD008_TAM_QTITTRAN; info105.IndicadorFormato = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD009_TAM_FORMAT_INDICATOR); offset += MEGA0105NotificacaoExecucaoInfo.FIELD009_TAM_FORMAT_INDICATOR; string preco = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD010_TAM_PRICE); preco = STMUtilities.saidaFormatada(info105.IndicadorFormato[0], preco, false, true, false, preco.Length); info105.Preco = Convert.ToDecimal(preco, STMUtilities.ciPtBR); offset += MEGA0105NotificacaoExecucaoInfo.FIELD010_TAM_PRICE; info105.IndicadorQtdeRemanescente = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD011_TAM_IPRSQTITREST); offset += MEGA0105NotificacaoExecucaoInfo.FIELD011_TAM_IPRSQTITREST; info105.QuantidadeRemanescente = Convert.ToInt64(evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD012_TAM_QTITRESTOM)); offset += MEGA0105NotificacaoExecucaoInfo.FIELD012_TAM_QTITRESTOM; info105.CorretoraContraparte = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD013_TAM_CLDADFCIE); offset += MEGA0105NotificacaoExecucaoInfo.FIELD013_TAM_CLDADFCIE; info105.CodigoOrigemOferta = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD014_TAM_YOM); offset += MEGA0105NotificacaoExecucaoInfo.FIELD014_TAM_YOM; offset += MEGA0105NotificacaoExecucaoInfo.FIELD015_TAM_NMSGREPON; offset += MEGA0105NotificacaoExecucaoInfo.FIELD016_TAM_DMSGREPON; offset += MEGA0105NotificacaoExecucaoInfo.FIELD017_TAM_HMSGREPON; info105.NumeroNegocio = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD018_TAM_NTRAN); offset += MEGA0105NotificacaoExecucaoInfo.FIELD018_TAM_NTRAN; info105.DataNegocio = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD019_TAM_DTRAN); offset += MEGA0105NotificacaoExecucaoInfo.FIELD019_TAM_DTRAN; offset += MEGA0105NotificacaoExecucaoInfo.FIELD020_TAM_YPLIMSAIOM; info105.TipoValidadeOrdem = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD021_TAM_YVAIOMNSC); offset += MEGA0105NotificacaoExecucaoInfo.FIELD021_TAM_YVAIOMNSC; offset += MEGA0105NotificacaoExecucaoInfo.FIELD022_TAM_CGDSVAL; info105.CodigoOperadorMega = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD023_TAM_CLDNGSAIOM); offset += MEGA0105NotificacaoExecucaoInfo.FIELD023_TAM_CLDNGSAIOM; offset += MEGA0105NotificacaoExecucaoInfo.FIELD024_TAM_YCPTEMBROM; info105.CodigoClienteMegabolsa = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD025_TAM_NCPTEPOSIPTOM).Trim(); info105.CodigoCliente = STMUtilities.RetornarNumeros(info105.CodigoClienteMegabolsa); offset += MEGA0105NotificacaoExecucaoInfo.FIELD025_TAM_NCPTEPOSIPTOM; offset += MEGA0105NotificacaoExecucaoInfo.FIELD026_TAM_CLDNGSAIOM; dthr = evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD027_TAM_DHSAIOMADF); info105.DataHoraEntradaOrdem = DateTime.ParseExact(dthr, "yyyyMMddHHmmss", CultureInfo.InvariantCulture); offset += MEGA0105NotificacaoExecucaoInfo.FIELD027_TAM_DHSAIOMADF; info105.QuantidadePatas = Convert.ToInt32(evento.Corpo.Substring(offset, MEGA0105NotificacaoExecucaoInfo.FIELD028_TAM_ZPRODCPSTRAN)); offset += MEGA0105NotificacaoExecucaoInfo.FIELD028_TAM_ZPRODCPSTRAN; for (int i = 0; i < info105.QuantidadePatas; i++) { PataEstrategiaNegocioInfo pata = new PataEstrategiaNegocioInfo(); pata.CodigoIdentificacao = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD001_TAM_CISINPRODCPS); offset += PataEstrategiaNegocioInfo.FIELD001_TAM_CISINPRODCPS; pata.SinalCompraVenda = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD002_TAM_CSIGNKMUPRODCPS); offset += PataEstrategiaNegocioInfo.FIELD002_TAM_CSIGNKMUPRODCPS; pata.ProporcaoPata = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD003_TAM_KRAOCPSSTG); offset += PataEstrategiaNegocioInfo.FIELD003_TAM_KRAOCPSSTG; pata.FormatIndicator = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD004_TAM_FORMAT_INDICATOR); offset += PataEstrategiaNegocioInfo.FIELD004_TAM_FORMAT_INDICATOR; preco = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD005_TAM_DATA); preco = STMUtilities.saidaFormatada(pata.FormatIndicator[0], preco, false, true, false, preco.Length); pata.Preco = Convert.ToDecimal(preco, STMUtilities.ciPtBR); offset += PataEstrategiaNegocioInfo.FIELD005_TAM_DATA; pata.NumeroNegocio = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD006_TAM_NTRANSCPRODCPS); offset += PataEstrategiaNegocioInfo.FIELD006_TAM_NTRANSCPRODCPS; info105.Patas.Add(pata); } EventoMega newevent = new EventoMega(TIPO_MSG_0105, info105, evento.MsgID); ServicoConectorSTM.epService.EPRuntime.SendEvent(newevent); }
/// <summary> /// Notificacao de cancelamento de negocio /// </summary> /// <param name="evento"></param> private void _parse103(EventoSTM evento) { int offset = 0; MEGA0103CriacaoNegocioInfo info103 = new MEGA0103CriacaoNegocioInfo(); info103.FunctionCode = evento.Cabecalho; info103.InternalReference = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD001_TAM_INTERNAL_REFERENCE); offset += MEGA0103CriacaoNegocioInfo.FIELD001_TAM_INTERNAL_REFERENCE; offset += MEGA0103CriacaoNegocioInfo.FIELD002_TAM_FUNCTION_CODE; string dthr = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD003_TAM_DSEABS); info103.DataNegocio = DateTime.ParseExact(dthr, "yyyyMMdd", CultureInfo.InvariantCulture); offset += MEGA0103CriacaoNegocioInfo.FIELD003_TAM_DSEABS; info103.Papel = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD004_TAM_CVALISIN).Trim(); offset += MEGA0103CriacaoNegocioInfo.FIELD004_TAM_CVALISIN; info103.IndicadorFormato = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD005_TAM_INDICADOR_FORMATO); offset += MEGA0103CriacaoNegocioInfo.FIELD005_TAM_INDICADOR_FORMATO; string preco = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD006_TAM_PRECO); preco = STMUtilities.saidaFormatada(info103.IndicadorFormato[0], preco, false, true, false, preco.Length); info103.Preco = Convert.ToDecimal(preco, STMUtilities.ciPtBR); offset += MEGA0103CriacaoNegocioInfo.FIELD006_TAM_PRECO; info103.QuantidadeNegocio = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD007_TAM_QTITTRAN); offset += MEGA0103CriacaoNegocioInfo.FIELD007_TAM_QTITTRAN; dthr = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD008_TAM_DHTRANBS); info103.DataHoraNegocio = DateTime.ParseExact(dthr, "yyyyMMddHHmmss", CultureInfo.InvariantCulture); offset += MEGA0103CriacaoNegocioInfo.FIELD008_TAM_DHTRANBS; info103.Side = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD009_TAM_ISENSOM); offset += MEGA0103CriacaoNegocioInfo.FIELD009_TAM_ISENSOM; info103.CorretoraContraparte = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD010_TAM_CLDADFCIE); offset += MEGA0103CriacaoNegocioInfo.FIELD010_TAM_CLDADFCIE; info103.CodigoOrigemOferta = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD011_TAM_YOM); offset += MEGA0103CriacaoNegocioInfo.FIELD011_TAM_YOM; offset += MEGA0103CriacaoNegocioInfo.FIELD012_TAM_NMSGREPON; offset += MEGA0103CriacaoNegocioInfo.FIELD013_TAM_HMSGREPON; info103.NumeroNegocio = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD014_TAM_NTRAN); offset += MEGA0103CriacaoNegocioInfo.FIELD014_TAM_NTRAN; info103.TipoOrdemOrigem = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD015_TAM_IORGINFMAR); offset += MEGA0103CriacaoNegocioInfo.FIELD015_TAM_IORGINFMAR; info103.CodigoOperadorMega = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD016_TAM_CLDNGSAIOM); offset += MEGA0103CriacaoNegocioInfo.FIELD016_TAM_CLDNGSAIOM; offset += MEGA0103CriacaoNegocioInfo.FIELD017_TAM_YCPTEMBROM; info103.CodigoClienteMegabolsa = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD018_TAM_NCPTEMBROM); info103.CodigoCliente = STMUtilities.RetornarNumeros(info103.CodigoClienteMegabolsa); offset += MEGA0103CriacaoNegocioInfo.FIELD018_TAM_NCPTEMBROM; offset += MEGA0103CriacaoNegocioInfo.FIELD019_TAM_CLDOMNG; dthr = evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD020_TAM_DHSAIOMADF); info103.DataHoraRegistro = DateTime.ParseExact(dthr, "yyyyMMddHHmmss", CultureInfo.InvariantCulture); offset += MEGA0103CriacaoNegocioInfo.FIELD020_TAM_DHSAIOMADF; info103.QuantidadePatas = Convert.ToInt32(evento.Corpo.Substring(offset, MEGA0103CriacaoNegocioInfo.FIELD021_TAM_ZPRODCPSTRAN)); offset += MEGA0103CriacaoNegocioInfo.FIELD021_TAM_ZPRODCPSTRAN; for (int i = 0; i < info103.QuantidadePatas; i++) { PataEstrategiaNegocioInfo pata = new PataEstrategiaNegocioInfo(); pata.CodigoIdentificacao = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD001_TAM_CISINPRODCPS); offset += PataEstrategiaNegocioInfo.FIELD001_TAM_CISINPRODCPS; pata.SinalCompraVenda = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD002_TAM_CSIGNKMUPRODCPS); offset += PataEstrategiaNegocioInfo.FIELD002_TAM_CSIGNKMUPRODCPS; pata.ProporcaoPata = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD003_TAM_KRAOCPSSTG); offset += PataEstrategiaNegocioInfo.FIELD003_TAM_KRAOCPSSTG; pata.FormatIndicator = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD004_TAM_FORMAT_INDICATOR); offset += PataEstrategiaNegocioInfo.FIELD004_TAM_FORMAT_INDICATOR; preco = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD005_TAM_DATA); preco = STMUtilities.saidaFormatada(pata.FormatIndicator[0], preco, false, true, false, preco.Length); pata.Preco = Convert.ToDecimal(preco, STMUtilities.ciPtBR); offset += PataEstrategiaNegocioInfo.FIELD005_TAM_DATA; pata.NumeroNegocio = evento.Corpo.Substring(offset, PataEstrategiaNegocioInfo.FIELD006_TAM_NTRANSCPRODCPS); offset += PataEstrategiaNegocioInfo.FIELD006_TAM_NTRANSCPRODCPS; info103.Patas.Add(pata); } EventoMega newevent = new EventoMega(TIPO_MSG_0103, info103, evento.MsgID); ServicoConectorSTM.epService.EPRuntime.SendEvent(newevent); }