示例#1
0
        private static i9Message SendMessageAsync(i9Message MobileMsg)
        {
            i9Message ReturnMessage = new i9Message();

            try
            {
                //Thread.Sleep(10000);


                //Security Information to the Message.
                MobileMsg.MessageSecurity.MachineName      = Environment.MachineName;
                MobileMsg.MessageSecurity.MachineUserName  = Environment.UserName;
                MobileMsg.MessageSecurity.IPAddress        = "???";
                MobileMsg.MessageSecurity.LoginPersonnelID = SettingManager.Instance.LoginPersonnelID;
                MobileMsg.MessageSecurity.AgencyID         = SettingManager.Instance.AgencyID;

                string TextMsg          = MobileMsg.XMLSerializeMessage();
                string ReturnXMLMessage = "";
                if (ConfigurationManager.Instance.IsDemoMode)
                {
                    //Demo Verison of the application.  No Backend system.
                    if (mIi9MessageManager == null)
                    {
                        mIi9MessageManager = GetIi9BizManager();
                    }

                    ReturnXMLMessage = mIi9MessageManager.ProcessMobileMessage(TextMsg);
                }
                else
                {
                    //Production Verison of the application.  biz logic and data access is handed in the backend.
                    Invert911Service oInvert911Service = (Invert911Service)WebServiceUtilities.GetWebService(new Invert911Service());
                    //Invert911.InvertCommon.Invert911service.Invert911Service oInvert911Service = new Invert911service.Invert911Service();

                    //ReturnXMLMessage = oInvert911Service.ProcessMobileMessageTest(TextMsg);

                    ReturnXMLMessage = oInvert911Service.ProcessMobileMessage(TextMsg);
                }

                ReturnMessage = (i9Message)i9Message.XMLDeserializeMessage(typeof(i9Message), ReturnXMLMessage);
            }
            catch (Exception ex)
            {
                ReturnMessage.ErrorStatus.IsError = true;
                //ReturnMessage.ErrorStatus.ErrorMsg = ex.GetBaseException().Message;
                ReturnMessage.ErrorStatus.ErrorMsg = "Error: " + ex.GetBaseException().Message + Environment.NewLine + "  StackTrace:  " + ex.GetBaseException().StackTrace;
                LogManager.Instance.LogMessage("Error in the MessageManager.SendMessage", ex);
            }

            return(ReturnMessage);
        }
        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;
        }
        private static i9Message SendMessageAsync(i9Message MobileMsg)
        {
            i9Message ReturnMessage = new i9Message();

            try
            {
                //Security Information to the Message.
                MobileMsg.MessageSecurity.MachineName = Environment.MachineName;
                MobileMsg.MessageSecurity.MachineUserName = Environment.UserName;
                MobileMsg.MessageSecurity.IPAddress = "???";
                MobileMsg.MessageSecurity.LoginPersonnelID = ""; // SettingManager.Instance.LoginPersonnelID;
                MobileMsg.MessageSecurity.AgencyID = "";         // SettingManager.Instance.AgencyID;

                string TextMsg = MobileMsg.XMLSerializeMessage();
                string ReturnXMLMessage = "";

                Ii9MessageManager oIi9MessageManager = new InvertService.BusinessLib.i9MessageManagerBLL();
                ReturnXMLMessage = oIi9MessageManager.ProcessMobileMessage(TextMsg);

                ReturnMessage = (i9Message)i9Message.XMLDeserializeMessage(typeof(i9Message), ReturnXMLMessage);
            }
            catch (Exception ex)
            {
                ReturnMessage.ErrorStatus.IsError = true;
                ReturnMessage.ErrorStatus.ErrorMsg = "Error: " + ex.GetBaseException().Message + Environment.NewLine + "  StackTrace:  " + ex.GetBaseException().StackTrace;
                //LogManager.Instance.LogMessage("Error in the MessageManager.SendMessage", ex);
                ServiceLogManager.LogThis("", LogEventType.Error, ex, "", "");
            }

            return ReturnMessage;
        }
示例#4
0
        private static i9Message SendMessageAsync(i9Message MobileMsg)
        {
            i9Message ReturnMessage = new i9Message();

            try
            {
                //Thread.Sleep(10000);


                //Security Information to the Message.
                MobileMsg.MessageSecurity.MachineName = Environment.MachineName;
                MobileMsg.MessageSecurity.MachineUserName = Environment.UserName;
                MobileMsg.MessageSecurity.IPAddress = "???";
                MobileMsg.MessageSecurity.LoginPersonnelID = SettingManager.Instance.LoginPersonnelID;
                MobileMsg.MessageSecurity.AgencyID = SettingManager.Instance.AgencyID;

                string TextMsg = MobileMsg.XMLSerializeMessage();
                string ReturnXMLMessage = "";
                if (ConfigurationManager.Instance.IsDemoMode)
                {
                    //Demo Verison of the application.  No Backend system.
                    if (mIi9MessageManager == null)
                        mIi9MessageManager = GetIi9BizManager();

                    ReturnXMLMessage = mIi9MessageManager.ProcessMobileMessage(TextMsg);
                }
                else
                {
                    //Production Verison of the application.  biz logic and data access is handed in the backend.
                    Invert911Service oInvert911Service = (Invert911Service)WebServiceUtilities.GetWebService(new Invert911Service());
                    //Invert911.InvertCommon.Invert911service.Invert911Service oInvert911Service = new Invert911service.Invert911Service();

                    //ReturnXMLMessage = oInvert911Service.ProcessMobileMessageTest(TextMsg);

                    ReturnXMLMessage = oInvert911Service.ProcessMobileMessage(TextMsg);
                    
                }

                ReturnMessage = (i9Message)i9Message.XMLDeserializeMessage(typeof(i9Message), ReturnXMLMessage);
            }
            catch (Exception ex)
            {
                ReturnMessage.ErrorStatus.IsError = true;
                //ReturnMessage.ErrorStatus.ErrorMsg = ex.GetBaseException().Message;
                ReturnMessage.ErrorStatus.ErrorMsg = "Error: " + ex.GetBaseException().Message + Environment.NewLine + "  StackTrace:  " + ex.GetBaseException().StackTrace;
                LogManager.Instance.LogMessage("Error in the MessageManager.SendMessage", ex);
            }

            return ReturnMessage;
        }