Exemplo n.º 1
0
        public string ProcessMobileMessage(string Message)
        {
            ServiceLogManager.LogThis(Message, LogEventType.InMessages, "", "");

            
  
            i9Message Response = new i9Message();
            
            try
            {
                i9Message RequestMessage = (i9Message)i9Message.XMLDeserializeMessage(typeof(i9Message), Message);

                if (RequestMessage.MessageFormatVersion != i9Message.MESSAGE_FORMAT_VERSION)
                {
                    throw new Exception("Your Invert911 Cloud app is out of sync with the Clould server.  Please upgrade to the latest i9Invert911 Clound App");
                }
                
                //Need to Log Inbound Message
                //ServiceLogManager.LogThis(Message, LogEventType.Info, RequestMessage.MessageSecurity.LoginPersonnelID, RequestMessage.MessageSecurity.AgencyID);

                //Security Check:
                if (HasSecurityRight(RequestMessage, ref Response) == false)
                    return Response.XMLSerializeMessage();

                //Module Message Switch.  Routes Messages
                switch (RequestMessage.ToBizLayer)
                {
                    case MobileMessageType.Admin:
                        Response = new AdminBLL().ProcessMobileMessage(RequestMessage);
                        break;
                    case MobileMessageType.Agency:
                        Response = new AgencyBLL().ProcessMobileMessage(RequestMessage);
                        break;
                    case MobileMessageType.Citation:
                        Response = new CitationBLL().ProcessMobileMessage(RequestMessage);
                        break;
                    case MobileMessageType.Common:
                        Response = new CommonBLL().ProcessMobileMessage(RequestMessage);
                        break;
                    case MobileMessageType.FieldContact:
                        Response = new FieldContactBLL().ProcessMobileMessage(RequestMessage);
                        break;
                    case MobileMessageType.Incident:
                        Response = new LawIncidentBLL().ProcessMobileMessage(RequestMessage);
                        break;
                    case MobileMessageType.SyncCache:
                        Response = new SyncBLL().ProcessMobileMessage(RequestMessage);
                        break;
                    case MobileMessageType.Security:
                        Response = new SecurityBLL().ProcessMobileMessage(RequestMessage);
                        break;
                    default:
                        ServiceLogManager.LogThis("Unkown message type in the Message Manager BLL:  " + RequestMessage.ToBizLayerMsgType, LogEventType.Info, "", "");
                        Response.ErrorStatus.SetError(true, "Message Type is unknown", new Exception());
                        break;
                }
            }
            catch (Exception ex)
            {
                ServiceLogManager.LogThis("Error", LogEventType.Error, ex, "", "");
                Response.ErrorStatus.IsError = true;
                Response.ErrorStatus.ErrorMsg = "Error processing server message: ";
                Response.ErrorStatus.ErrorTrace = ex.StackTrace;
                Response.ErrorStatus.ErrorException = ex.Message;
            }

            //Response Message In string format
            string ResponseMessageText = Response.XMLSerializeMessage();

            //Log Outbound Message 
            ServiceLogManager.LogThis(ResponseMessageText, LogEventType.OutMessages, "", "");

            //
            return ResponseMessageText;
        }
Exemplo n.º 2
0
        public string ProcessMobileMessage(string Message)
        {
            ServiceLogManager.LogThis(Message, LogEventType.InMessages, "", "");



            i9Message Response = new i9Message();

            try
            {
                i9Message RequestMessage = (i9Message)i9Message.XMLDeserializeMessage(typeof(i9Message), Message);

                if (RequestMessage.MessageFormatVersion != i9Message.MESSAGE_FORMAT_VERSION)
                {
                    throw new Exception("Your Invert911 Cloud app is out of sync with the Clould server.  Please upgrade to the latest i9Invert911 Clound App");
                }

                //Need to Log Inbound Message
                //ServiceLogManager.LogThis(Message, LogEventType.Info, RequestMessage.MessageSecurity.LoginPersonnelID, RequestMessage.MessageSecurity.AgencyID);

                //Security Check:
                if (HasSecurityRight(RequestMessage, ref Response) == false)
                {
                    return(Response.XMLSerializeMessage());
                }

                //Module Message Switch.  Routes Messages
                switch (RequestMessage.ToBizLayer)
                {
                case MobileMessageType.Admin:
                    Response = new AdminBLL().ProcessMobileMessage(RequestMessage);
                    break;

                case MobileMessageType.Agency:
                    Response = new AgencyBLL().ProcessMobileMessage(RequestMessage);
                    break;

                case MobileMessageType.Citation:
                    Response = new CitationBLL().ProcessMobileMessage(RequestMessage);
                    break;

                case MobileMessageType.Common:
                    Response = new CommonBLL().ProcessMobileMessage(RequestMessage);
                    break;

                case MobileMessageType.FieldContact:
                    Response = new FieldContactBLL().ProcessMobileMessage(RequestMessage);
                    break;

                case MobileMessageType.Incident:
                    Response = new LawIncidentBLL().ProcessMobileMessage(RequestMessage);
                    break;

                case MobileMessageType.SyncCache:
                    Response = new SyncBLL().ProcessMobileMessage(RequestMessage);
                    break;

                case MobileMessageType.Security:
                    Response = new SecurityBLL().ProcessMobileMessage(RequestMessage);
                    break;

                default:
                    ServiceLogManager.LogThis("Unkown message type in the Message Manager BLL:  " + RequestMessage.ToBizLayerMsgType, LogEventType.Info, "", "");
                    Response.ErrorStatus.SetError(true, "Message Type is unknown", new Exception());
                    break;
                }
            }
            catch (Exception ex)
            {
                ServiceLogManager.LogThis("Error", LogEventType.Error, ex, "", "");
                Response.ErrorStatus.IsError        = true;
                Response.ErrorStatus.ErrorMsg       = "Error processing server message: ";
                Response.ErrorStatus.ErrorTrace     = ex.StackTrace;
                Response.ErrorStatus.ErrorException = ex.Message;
            }

            //Response Message In string format
            string ResponseMessageText = Response.XMLSerializeMessage();

            //Log Outbound Message
            ServiceLogManager.LogThis(ResponseMessageText, LogEventType.OutMessages, "", "");

            //
            return(ResponseMessageText);
        }