/// <summary> /// Executa a chamada do callback para as mensagems MegaBolsa /// </summary> /// <param name="mega"></param> private void repassaEventoMega(EventoMega mega) { switch (mega.Function) { case ParserMegaMessage.TIPO_MSG_0100: { MEGA0100NotificacaoCancelamentoNegocioInfo info = (MEGA0100NotificacaoCancelamentoNegocioInfo )mega.Info; subscriberChannel.OnMega_CancelamentoNegocio(info); } break; case ParserMegaMessage.TIPO_MSG_0103: { MEGA0103CriacaoNegocioInfo info = (MEGA0103CriacaoNegocioInfo)mega.Info; subscriberChannel.OnMega_CriacaoNegocio(info); } break; case ParserMegaMessage.TIPO_MSG_0105: { MEGA0105NotificacaoExecucaoInfo info = (MEGA0105NotificacaoExecucaoInfo)mega.Info; subscriberChannel.OnMega_NotificacaoExecucao(info); } break; case ParserMegaMessage.TIPO_MSG_0138: { MEGA0138OrdemEliminadaInfo info = (MEGA0138OrdemEliminadaInfo)mega.Info; subscriberChannel.OnMega_OrdemEliminada(info); } break; case ParserMegaMessage.TIPO_MSG_0172: { MEGA0172ConfirmacaoOrdemInfo info = (MEGA0172ConfirmacaoOrdemInfo)mega.Info; subscriberChannel.OnMega_ConfirmacaoOrdem(info); } break; default: throw new Exception("repassaEventoMega() Tipo de mensagem invalida: " + mega.Function); } }
/// <summary> /// Confirmacao de ordem /// </summary> /// <param name="evento"></param> private void _parse172(EventoSTM evento) { int offset = 0; MEGA0172ConfirmacaoOrdemInfo info172 = new MEGA0172ConfirmacaoOrdemInfo(); info172.FunctionCode = evento.Cabecalho; info172.InternalReference = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD001_TAM_INTERNAL_REFERENCE); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD001_TAM_INTERNAL_REFERENCE; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD002_TAM_FUNCTION_CODE; string dthr = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD003_TAM_DSAIOM); info172.DataEntradaOrdem = DateTime.ParseExact(dthr, "yyyyMMdd", CultureInfo.InvariantCulture); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD003_TAM_DSAIOM; info172.NumeroSequencialOrdem = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD004_TAM_NSEQOM); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD004_TAM_NSEQOM; info172.StatusOrdem = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD005_TAM_IMAJOM); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD005_TAM_IMAJOM; info172.Papel = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD006_TAM_CVALISIN).Trim(); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD006_TAM_CVALISIN; info172.QuantidadeOrdem = Convert.ToInt64(evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD007_TAM_QTITTOTOM)); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD007_TAM_QTITTOTOM; info172.Side = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD008_TAM_ISENSOM); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD008_TAM_ISENSOM; info172.IndicadorFormato = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD009_TAM_FORMAT_INDICATOR); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD009_TAM_FORMAT_INDICATOR; string preco = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD010_TAM_PRICE); preco = STMUtilities.saidaFormatada(info172.IndicadorFormato[0], preco, false, true, false, preco.Length); info172.Preco = Convert.ToDecimal(preco, STMUtilities.ciPtBR); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD010_TAM_PRICE; info172.CorretoraEmitente = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD011_TAM_CLDAFTEMETOM); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD011_TAM_CLDAFTEMETOM; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD012_TAM_NMSGREPON; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD013_TAM_HMSGREPON; info172.TipoOrdem = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD014_TAM_YPLIMSAIOM); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD014_TAM_YPLIMSAIOM; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD015_TAM_QTITXTEINTROM; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD016_TAM_CFONORG; info172.DataModificacao = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD017_TAM_DOMINI); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD017_TAM_DOMINI; info172.NumeroSequencialOriginal = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD018_TAM_NSEQOMINI); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD018_TAM_NSEQOMINI; info172.TipoValidadeOrdem = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD019_TAM_YVALIOMNSC); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD019_TAM_YVALIOMNSC; info172.DataValidadeOrdem = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD020_TAM_DVALIOM); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD020_TAM_DVALIOM; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD021_TAM_QTITMINOM; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD022_TAM_QTITDVLOM; info172.CodigoOrigemOferta = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD023_TAM_YOM); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD023_TAM_YOM; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD024_TAM_ICFMOM; info172.QuantidadeRemanescente = Convert.ToInt64(evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD025_TAM_QTITRESTOMINI)); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD025_TAM_QTITRESTOMINI; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD026_TAM_FORMAT_INDICATOR2; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD027_TAM_PRICE2; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD028_TAM_TVALIOM; info172.CodigoOperadorMega = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD029_TAM_CLDNGSAIOM); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD029_TAM_CLDNGSAIOM; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD030_TAM_YCPTEMBROM; info172.CodigoClienteMegabolsa = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD031_TAM_NCPTEPOSIPTOM).Trim(); info172.CodigoCliente = STMUtilities.RetornarNumeros(info172.CodigoClienteMegabolsa); offset += MEGA0172ConfirmacaoOrdemInfo.FIELD031_TAM_NCPTEPOSIPTOM; offset += MEGA0172ConfirmacaoOrdemInfo.FIELD032_TAM_CLDOMNG; dthr = evento.Corpo.Substring(offset, MEGA0172ConfirmacaoOrdemInfo.FIELD033_TAM_DHSAIOMADF); info172.DataHoraCriacaoOrdem = DateTime.ParseExact(dthr, "yyyyMMddHHmmss", CultureInfo.InvariantCulture); EventoMega newevent = new EventoMega(TIPO_MSG_0172, info172, evento.MsgID); ServicoConectorSTM.epService.EPRuntime.SendEvent(newevent); }
public void OnMega_ConfirmacaoOrdem(Gradual.OMS.ConectorSTM.Lib.Mensagens.MEGA0172ConfirmacaoOrdemInfo info) { MEGA0172ConfirmacaoOrdemInfo xxx = info; }