Esempio n. 1
0
        protected override void OnStop()
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                // Tear down the remoting channel
                if (Program.LogEvents)
                {
                    debug.WriteLog("About to unregister TCP server channel");
                }

                ChannelServices.UnregisterChannel(_tcpServer);

                if (Program.LogEvents)
                {
                    debug.WriteLog("Channel unregistered successfully");
                    debug.WriteLog("STOPPING DSR WRAPPER SERVICE");
                }
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (OnStop): " + err.Message);
            }
        }
Esempio n. 2
0
        internal static void DsrInitialize()
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            if (bInitializing)
            {
                return;
            }

            bInitializing = true;

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("About to create DSR main COM object (Pre-Initialization)");
                }

                instanceID = Guid.NewGuid();
                _dsr       = new DSRSERVERClass();

                if (Program.LogEvents)
                {
                    debug.WriteLog("DSR main COM object created successfully (Pre-Initialization). Guid: " + instanceID.ToString());
                }
            }
            finally
            {
                bInitializing = false;
            }
        }
Esempio n. 3
0
        public uint DSR_Export(uint pCompany,
                               string pSubj,
                               string pFrom,
                               string pTo,
                               string pParam1,
                               string pParam2,
                               uint pPackageId)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_Export from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_Export(pCompany, pSubj, pFrom, pTo, pParam1, pParam2, pPackageId));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_Export): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 4
0
        public uint DSR_GetOutboxMessages(uint pCompany,
                                          uint pPackageID,
                                          sbyte pStatus,
                                          DateTime pDate,
                                          uint pMaxRecords,
                                          out object pMessages)
        {
            pMessages = null;

            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_GetOutboxMessages from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_GetOutboxMessages(pCompany, pPackageID, pStatus, pDate, pMaxRecords, out pMessages));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_GetOutboxMessages): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 5
0
        public uint DSR_ExProductType()
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_ExProductType from within the remoting server. Guid: " + instanceID.ToString());
                }
                return(GlobalDSR.WithDSR().DSR_ExProductType());
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_ExProductType): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 6
0
        public void DSR_SendLog(string pMail)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_SendLog from within the remoting server. Guid: " + instanceID.ToString());
                }

                GlobalDSR.WithDSR().DSR_SendLog(pMail);
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_SendLog): " + err.Message);
            }
        }
Esempio n. 7
0
        public uint DSR_ViewCISResponse(Guid pOutboxGuid, Guid pFileGuid, out string pXML)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            pXML = "";
            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_ViewCISResponse from within the remoting server. Guid: " + instanceID.ToString());
                }
                return(GlobalDSR.WithDSR().DSR_ViewCISResponse(pOutboxGuid, pFileGuid, out pXML));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_ViewCISResponse): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 8
0
        public uint DSR_DenySyncRequest(uint pCompany, Guid pGuid)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_DenySyncRequest from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_DenySyncRequest(pCompany, pGuid));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_DenySyncRequest): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 9
0
        public uint DSR_AddNewUser(string pUserName, string pUserLogin, string pUserPassword)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_AddNewUser from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_AddNewUser(pUserName, pUserLogin, pUserPassword));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_AddNewUser): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 10
0
        public uint DSR_SetDailySchedule(Guid pGuid, uint pCompany, string pSubj, string pFrom, string pTo, string pParam1, string pParam2, uint pPackageId, DateTime pStartDate, DateTime pEndDate, DateTime pStartTime, sbyte pAllDays, sbyte pWeekDays, sbyte pEveryDay)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_SetDailySchedule from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_SetDailySchedule(pGuid, pCompany, pSubj, pFrom, pTo, pParam1, pParam2, pPackageId, pStartDate, pEndDate, pStartTime, pAllDays, pWeekDays, pEveryDay));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_SetDailySchedule): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 11
0
        public string DSR_TranslateErrorCode(uint pErrorCode)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_TranslateErrorCode from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_TranslateErrorCode(pErrorCode));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_TranslateErrorCode): " + err.Message);
                return(string.Empty);
            }
        }
Esempio n. 12
0
        protected override void OnStart(string[] args)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            if (args.Length > 0)
            {
                if (args[0].ToUpper().Equals("WITHLOG"))
                {
                    Program.LogEvents = true;
                }
            }

            try
            {
                // Set up the Remoting channel
                if (Program.LogEvents)
                {
                    debug.WriteLog("STARTING DSR WRAPPER SERVICE");
                    debug.WriteLog("About to create TCP server channel on " + ConfigurationManager.AppSettings["PortNumber"].ToString());
                }
                _tcpServer = new TcpServerChannel(Convert.ToInt32(ConfigurationManager.AppSettings["PortNumber"]));

                if (Program.LogEvents)
                {
                    debug.WriteLog("About to register TCP server channel");
                }

                ChannelServices.RegisterChannel(_tcpServer, false);

                if (Program.LogEvents)
                {
                    debug.WriteLog("About to register well known service type: IWrapperDSR");
                }

                RemotingConfiguration.RegisterWellKnownServiceType(typeof(WrapperDSR), "WrapperDSR", WellKnownObjectMode.Singleton);

                GlobalDSR.DsrInitialize();
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (OnStart): " + err.Message);
            }
        }
Esempio n. 13
0
        public uint DSR_GetInboxXml(Guid pGuid, uint pOrder, out string pXML)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            pXML = "";
            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_GetInboxXml from within the remoting server. Guid: " + instanceID.ToString());
                }
                return(GlobalDSR.WithDSR().DSR_GetInboxXml(pGuid, pOrder, out pXML));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_GetInboxXml): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 14
0
        public uint DSR_AddNewContact(string pContactName, string pContactMail, uint pContactCompany)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_AddNewContact from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_AddNewContact(pContactName, pContactMail, pContactCompany));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_AddNewContact): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 15
0
        public uint DSR_CheckDripFeed(uint pCompany, out uint pStatus)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            pStatus = 0;
            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_CheckDripFeed from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_CheckDripFeed(pCompany, out pStatus));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_CheckDripFeed): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 16
0
        public uint DSR_GetMailSettings(out string pXml)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            pXml = "";
            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_GetMailSettings from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_GetMailSettings(out pXml));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_UpdateMailSettings): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 17
0
        public uint DSR_TotalOutboxMessages(uint pCompany, out uint pMsgCount)
        {
            pMsgCount = 0;
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_TotalOutboxMessages from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_TotalOutboxMessages(pCompany, out pMsgCount));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_TotalOutboxMessages): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 18
0
        public uint DSR_GetContacts(out object pContacts)
        {
            pContacts = string.Empty;
            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_GetContacts from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_GetContacts(out pContacts));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_GetContacts): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 19
0
        public uint DSR_NewInboxMessage(uint pMaxRecords, out object pMessages)
        {
            pMessages = null;

            DebugFileCtrl debug = new DebugFileCtrl(false);

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_NewInboxMessage from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_NewInboxMessage(pMaxRecords, out pMessages));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_NewInboxMessage): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 20
0
        public uint DSR_GetDripFeedParams(uint pCompany, out string pPeriodYear1, out string pPeriodYear2)
        {
            DebugFileCtrl debug = new DebugFileCtrl(false);

            pPeriodYear1 = "";
            pPeriodYear2 = "";

            try
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Calling DSR_GetDripFeedParams from within the remoting server. Guid: " + instanceID.ToString());
                }

                return(GlobalDSR.WithDSR().DSR_GetDripFeedParams(pCompany, out pPeriodYear1, out pPeriodYear2));
            }
            catch (System.Exception err)
            {
                debug.WriteLog("EXCEPTION (DSR_GetDripFeedParams): " + err.Message);
                return(GENERIC_FAIL);
            }
        }
Esempio n. 21
0
        public static IDSRSERVER WithDSR()
        {
            int           lCounter = 0;
            DebugFileCtrl debug    = new DebugFileCtrl(false);

            if (bInitializing)
            {
                while (bInitializing)
                {
                    System.Threading.Thread.Sleep(500);

                    lCounter = lCounter + 1;

                    if (lCounter >= 180)
                    {
                        if (Program.LogEvents)
                        {
                            debug.WriteLog("DSR did not respond in a timely fashion");
                        }
                        throw new Exception("DSR did not respond in a timely fashion");
                    }
                }
            }



            if (_dsr == null)
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("About to create DSR main COM object");
                }

                instanceID = Guid.NewGuid();
                try
                {
                    _dsr = new DSRSERVERClass();

                    if (Program.LogEvents)
                    {
                        debug.WriteLog("DSR main COM object created successfully. Guid: " + instanceID.ToString());
                    }

                    return(_dsr);
                }
                catch (System.Exception err)
                {
                    debug.WriteLog("EXCEPTION (WrapperDSR ctor): " + err.Message);
                    return(null);
                }
            }
            else
            {
                if (Program.LogEvents)
                {
                    debug.WriteLog("Returning instance of DSR COM object. Guid: " + instanceID.ToString());
                }

                return(_dsr);
            }
        }