Пример #1
0
        public ValueObject Execute(string CbmId, UserData userdata, ValueObject vo)
        {
            UserData usr = UserData.GetUserData();

            usr.UserCode    = userdata.UserCode;
            usr.FactoryCode = userdata.FactoryCode;

            CbmController cbm = cbmContainer.GetCbm(CbmId);

            return(DefaultCbmInvoker.Invoke(cbm, vo, userdata, UserDataSpecifiedTransactionContextFactory.GetInstance()));
        }
Пример #2
0
        /// <summary>
        /// Execute cbm with userdataspecifiedtransaction
        /// </summary>
        /// <param name="cbm">cbm  to be executed</param>
        /// <param name="userdata">userdata information for cbm invoker</param>
        /// <param name="vo">input vo for the cbm</param>
        /// <exception cref="Com.Nidec.Mes.Framework.SystemException">exception handled in cbm getting cbm instance for cbmid and throw as new soapexcepion</exception>
        /// <exception cref="System.Exception">unhandledexception handled in cbm getting cbm instance for cbmid and throw as new soapexcepion</exception>
        /// <exception cref="Com.Nidec.Mes.Framework.ApplicationException">exception handled in cbm invoke and throw as new soapexcepion</exception>
        /// <exception cref="Com.Nidec.Mes.Framework.SystemException">exception handled in cbm invoke and throw as new soapexcepion</exception>
        /// <exception cref="System.Exception">unhandledexception handled in cbm invoke and throw as new soapexcepion</exception>
        /// <returns>cbm output as valueobject/ exception as soapexception</returns>
        public static ValueObject Execute(string CbmId, UserData userdata, ValueObject vo)
        {
            if (userdata != null)
            {
                UserData usr = UserData.GetUserData();
                usr.UserCode    = userdata.UserCode;
                usr.FactoryCode = userdata.FactoryCode;
                usr.SessionId   = userdata.SessionId;
            }

            CbmController cbm;

            ///get cbm instance
            try
            {
                cbm = cbmContainer.GetCbm(CbmId);
            }
            catch (Framework.SystemException ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, SYSTEM_EXCEPTION, ex);
            }
            catch (Exception ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, UNHANDLED_EXCEPTION, ex);
            }

            if (cbm == null)
            {
                MessageData messageData = new MessageData("fsce00052", Properties.Resources.fsce00052);
                logger.Error(messageData, new NullReferenceException());

                throw new Framework.SystemException(messageData, new NullReferenceException()); //throw original exception as sys exception
            }

            ///execute cbm
            try
            {
                return(DefaultCbmInvoker.Invoke(cbm, vo, userdata, UserDataSpecifiedTransactionContextFactory.GetInstance()));
            }
            catch (Framework.ApplicationException ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, APPLICATION_EXCEPTION, ex);
            }
            catch (Framework.SystemException ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, SYSTEM_EXCEPTION, ex);
            }
            catch (Exception ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, UNHANDLED_EXCEPTION, ex);
            }
        }
Пример #3
0
        /// <summary>
        /// execute cbm using cbm id
        /// </summary>
        /// <param name="cbm">cbm  to be executed</param>
        /// <param name="userdata">userdata information for cbm invoker</param>
        /// <param name="vo">input vo for the cbm</param>
        /// <exception cref="Com.Nidec.Mes.Framework.SystemException">exception handled in cbm getting cbm instance for cbmid</exception>
        /// <exception cref="System.Exception">unhandledexception handled in cbm getting cbm instance for cbmid and throws Com.Nidec.Mes.Framework.SystemException</exception>
        /// <exception cref="Com.Nidec.Mes.Framework.ApplicationException">exception handled in cbm invoke</exception>
        /// <exception cref="Com.Nidec.Mes.Framework.SystemException">exception handled in cbm invoke</exception>
        /// <exception cref="System.Exception">unhandledexception handled in cbm invoke and throws Com.Nidec.Mes.Framework.SystemException</exception>
        /// <returns>output vo will be returned/ exception will be thrown for error cases</returns>
        public ValueObject Execute(string CbmId, UserData userdata, ValueObject vo)
        {
            UserData usr = UserData.GetUserData();

            usr.UserCode    = userdata.UserCode;
            usr.FactoryCode = userdata.FactoryCode;

            CbmController cbm;

            ///get cbm instance
            try
            {
                cbm = cbmContainer.GetCbm(CbmId);
            }
            catch (Framework.SystemException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                MessageData message = new MessageData("fsce00041", Properties.Resources.fsce00041, ex.Message);
                logger.Error(message, ex);

                throw new Framework.SystemException(message, ex);
            }

            try
            {
                return(DefaultCbmInvoker.Invoke(cbm, vo, userdata, UserDataSpecifiedTransactionContextFactory.GetInstance()));
            }
            catch (Framework.ApplicationException ex)
            {
                throw ex;
            }
            catch (Framework.SystemException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                MessageData message = new MessageData("fsce00050", Properties.Resources.fsce00050, ex.Message);
                logger.Error(message, ex);

                throw new Framework.SystemException(message, ex);
            }
        }
Пример #4
0
        /// <summary>
        /// Execute cbm with userdataspecifiedtransaction
        /// </summary>
        /// <param name="CbmId"></param>
        /// <param name="userdata"></param>
        /// <param name="vo"></param>
        /// <returns></returns>
        public static ValueObject Execute(string CbmId, UserData userdata, ValueObject vo)
        {
            if (userdata != null)
            {
                UserData usr = UserData.GetUserData();
                usr.UserCode    = userdata.UserCode;
                usr.FactoryCode = userdata.FactoryCode;
            }
            CbmController cbm;

            ///get cbm instance
            try
            {
                cbm = cbmContainer.GetCbm(CbmId);
            }
            catch (Framework.ApplicationException ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, "ApplicationException", ex);
            }
            catch (Framework.SystemException ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, "SystemException", ex);
            }
            catch (Exception ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, "SystemException", ex);
            }

            ///execute cbm
            try
            {
                return(DefaultCbmInvoker.Invoke(cbm, vo, userdata, UserDataSpecifiedTransactionContextFactory.GetInstance()));
            }
            catch (Framework.ApplicationException ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, "ApplicationException", ex);
            }
            catch (Framework.SystemException ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, "SystemException", ex);
            }
            catch (Exception ex)
            {
                throw new SoapException(string.Empty, SoapException.ServerFaultCode, "SystemException", ex);
            }
        }