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; } }
void EventMds_OnMDSSRespostaCancelamentoEvent(object sender, MDSEventArgs e) { try { CR_CancelamentoStopResposta _CR_CancelamentoStopResposta = (CR_CancelamentoStopResposta)(sender); int id_stopstart = int.Parse(_CR_CancelamentoStopResposta.pStrIdStopStart); int id_status = int.Parse(_CR_CancelamentoStopResposta.pStrStatus); OrdemStopStatus ordemStopEnum = OrdemStopStatus.CancelamentoAceitoExecutadoMDS; if (id_status == (int)RespostaOrdem.Aceito) { ordemStopEnum = OrdemStopStatus.CancelamentoAceitoExecutadoMDS; logger.Info(string.Format("{0}{1}", "\r\n " + int.Parse(_CR_CancelamentoStopResposta.pStrIdStopStart).ToString(), " Stop Cancelado pelo MDS")); txtHistorico.Text += string.Format("{0}{1}", "\r\n " + int.Parse(_CR_CancelamentoStopResposta.pStrIdStopStart).ToString(), " Stop Cancelado pelo MDS"); } if (id_status == (int)RespostaOrdem.Rejeitado) { ordemStopEnum = OrdemStopStatus.CancelamentoRejeitadoMDS; logger.Info(string.Format("{0}{1}", "\r\n Cancelamento do stop " + int.Parse(_CR_CancelamentoStopResposta.pStrIdStopStart).ToString(), " foi rejeitado pelo MDS")); txtHistorico.Text += string.Format("{0}{1}", "\r\n Cancelamento do stop " + int.Parse(_CR_CancelamentoStopResposta.pStrIdStopStart).ToString(), " foi rejeitado pelo MDS"); } //Altera o status no banco de dados new AutomacaoOrdensDados().CancelaOrdemStopStart(id_stopstart, (int)ordemStopEnum); } catch (Exception ex) { logger.Error(string.Format("{0}{1}", "EventMds_OnMDSSRespostaCancelamentoEvent: ", ex.Message)); } }