Exemplo n.º 1
0
        private void ExecuteFactoryEvent(object pObject)
        {
            try
            {
                if (pObject.GetType() == typeof(SS_StopSimplesResposta))
                {
                    SS_StopSimplesResposta _SS_StopSimplesResposta = (SS_StopSimplesResposta)(pObject);
                    Registrador.SendMDSEventFactory(_SS_StopSimplesResposta);
                }

                if (pObject.GetType() == typeof(RS_RespostaStop))
                {
                    RS_RespostaStop _RS_RespostaStop = (RS_RespostaStop)(pObject);
                    Registrador.SendMDSEventFactory(_RS_RespostaStop);
                }

                if (pObject.GetType() == typeof(CR_CancelamentoStopResposta))
                {
                    CR_CancelamentoStopResposta _CR_CancelamentoStopResposta = (CR_CancelamentoStopResposta)(pObject);
                    Registrador.SendMDSEventFactory(_CR_CancelamentoStopResposta);
                }
            }
            catch (Exception ex)
            {
                WriteEventLog(string.Format("{0}{1}", "ExecuteFactoryEvent: ", ex.Message));
                throw ex;
            }
        }
Exemplo n.º 2
0
        public void EventMds_OnMDSSRespostaSolicitacaoEvent(object sender, MDSEventArgs e)
        {
            try
            {
                RS_RespostaStop _RS_RespostaStop
                    = (RS_RespostaStop)(sender);

                int id_stopstart = int.Parse(_RS_RespostaStop.pStrIdStopStart);
                int id_status    = int.Parse(_RS_RespostaStop.pStrStatus);

                if (id_status == (int)RespostaOrdem.Rejeitado)  // Stop Rejeitado

                {
                    new AutomacaoOrdensDados().AtualizaOrdemStop
                    (
                        int.Parse(_RS_RespostaStop.pStrIdStopStart),
                        (int)OrdemStopStatus.RejeitadoMDS
                    );

                    logger.Info(string.Format("{0}{1}", "\r\n " + int.Parse(_RS_RespostaStop.pStrIdStopStart).ToString(), " Stop rejeitado pelo MDS"));

                    txtHistorico.Text +=
                        string.Format("{0}{1}", "\r\n " + int.Parse(_RS_RespostaStop.pStrIdStopStart).ToString(), " Stop rejeitado pelo MDS");
                }
                else if (id_status == (int)RespostaOrdem.Aceito) // Stop Aceito
                {
                    // Atualiza status da ordem para aceito.
                    new AutomacaoOrdensDados().AtualizaOrdemStop
                    (
                        int.Parse(_RS_RespostaStop.pStrIdStopStart),
                        (int)OrdemStopStatus.AceitoMDS
                    );

                    logger.Info(string.Format("{0}{1}", "\r\n " + int.Parse(_RS_RespostaStop.pStrIdStopStart).ToString(), " Stop aceito pelo MDS"));

                    txtHistorico.Text +=
                        string.Format("{0}{1}", "\r\n " + int.Parse(_RS_RespostaStop.pStrIdStopStart).ToString(), " Stop aceito pelo MDS");
                }
            }
            catch (Exception ex)
            {
                logger.Error(string.Format("{0}{1}", "EventMds_OnMDSSRespostaAutenticacaoEvent: ", ex.Message));
                throw new Exception(string.Format("{0}{1}", "EventMds_OnMDSSRespostaAutenticacaoEvent: ", ex.Message));
            }
        }