コード例 #1
0
ファイル: BOAContext.cs プロジェクト: beyaz/ApiInspector
        static BOAContextData GetOrCreateContext(BOAContextData data, Action <string> trace)
        {
            if (data.context != null)
            {
                return(data);
            }

            data = LoadBOAConfigurationFile(data, trace);

            var context = new ExecutionDataContext
            {
                EngineContext = new EngineContext()
            };

            data = LoadBOAConfigurationFile(data, trace);

            data = Authenticate(data, trace, ConfigurationManager.ChannelSection.Channel.DefaultChannel);

            context.ApplicationContext = data.authenticationResponse.ApplicationContext;

            var createNewBusinessKey = FPExtensions.Fun(() =>
            {
                const string ResourceCode = "ODSTATMTCP";

                return(new BusinessKey(context).CreateBusinessKey(ResourceCode, context.ApplicationContext.User.BranchId, DateTime.Now.Date).Value);
            });

            context.EngineContext.MainBusinessKey = createNewBusinessKey();

            return(data.WithExecutionDataContext(context));
        }
コード例 #2
0
ファイル: BOAContext.cs プロジェクト: beyaz/ApiInspector
        static BOAContextData Authenticate(BOAContextData data, Action <string> trace, ChannelContract channelContract)
        {
            if (data.authenticationResponse != null)
            {
                return(data);
            }

            data = LoadBOAConfigurationFile(data, trace);

            var request = new AuthenticationRequest
            {
                AuthenticationContext = new AuthenticationContext
                {
                    Channel  = channelContract,
                    UserName = AuthenticationUserName
                }
            };

            trace("Authenticate response waiting...");

            var response = new UserManager().Authenticate(request);

            if (!response.Success)
            {
                throw new AuthenticationException("LoginFailed." + StringHelper.ResultToDetailedString(response.Results));
            }

            trace("Authenticate is success.");

            return(data.WithAuthenticationResponse(response));
        }
コード例 #3
0
ファイル: BOAContext.cs プロジェクト: beyaz/ApiInspector
        static BOAContextData LoadBOAConfigurationFile(BOAContextData data, Action <string> trace)
        {
            if (data.IsBoaConfigurationFileLoaded)
            {
                return(data);
            }

            BoaConfigurationFile.Load(data.EnvironmentInfo.ToString, trace);

            return(data.MarkAsConfigurationFileLoaded());
        }
コード例 #4
0
ファイル: BOAContext.cs プロジェクト: beyaz/ApiInspector
        static BOAContextData GetOrCreateObjectHelper(BOAContextData data, Action <string> trace)
        {
            if (data.objectHelper != null)
            {
                return(data);
            }

            data = GetOrCreateContext(data, trace);

            var objectHelper = new ObjectHelper
            {
                Context = data.context
            };

            objectHelper.Context.DBLayer.BeginTransaction();

            return(data.WithObjectHelper(objectHelper));
        }
コード例 #5
0
ファイル: BOAContext.cs プロジェクト: beyaz/ApiInspector
        public BOAContext(EnvironmentInfo environmentInfo, Action <string> trace)
        {
            data = new BOAContextData(environmentInfo);

            this.trace = trace;
        }
コード例 #6
0
ファイル: BOAContext.cs プロジェクト: beyaz/ApiInspector
 /// <summary>
 ///     Loads the boa configuration file.
 /// </summary>
 public void LoadBOAConfigurationFile()
 {
     data = LoadBOAConfigurationFile(data, trace);
 }
コード例 #7
0
ファイル: BOAContext.cs プロジェクト: beyaz/ApiInspector
        /// <summary>
        ///     Gets the object helper.
        /// </summary>
        public ObjectHelper GetObjectHelper()
        {
            data = GetOrCreateObjectHelper(data, trace);

            return(data.objectHelper);
        }
コード例 #8
0
ファイル: BOAContext.cs プロジェクト: beyaz/ApiInspector
 /// <summary>
 ///     Authenticates the specified channel contract.
 /// </summary>
 public void Authenticate(ChannelContract channelContract)
 {
     data = Authenticate(data, trace, channelContract);
 }