예제 #1
0
        /// <summary>
        ///     Adds the extension to the supported extensions.
        /// </summary>
        /// <param name="extensionName">Name of the extension.</param>
        protected void AddExtension(string extensionName)
        {
            if (SupportedExtensions == null)
            {
                SupportedExtensions = new PxExtensionNamesClass();
            }

            SupportedExtensions.Add(extensionName);
        }
예제 #2
0
        /// <summary>
        /// Opens a connection to the process framework database.
        /// </summary>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="extensionNames">The names of process framework extensions.</param>
        /// <returns>
        /// Returns the <see cref="IMMPxApplication" /> application reference; otherwise <c>null</c>.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        /// connectionString
        /// or
        /// userName
        /// or
        /// extensionNames
        /// </exception>
        public virtual IMMPxApplication Open(string connectionString, string userName, params string[] extensionNames)
        {
            if (connectionString == null)
            {
                throw new ArgumentNullException("connectionString");
            }
            if (userName == null)
            {
                throw  new ArgumentNullException("userName");
            }
            if (extensionNames == null)
            {
                throw new ArgumentNullException("extensionNames");
            }

            // Open the connection with the given properties.
            Connection connection = new ConnectionClass();

            connection.Open(connectionString);

            // Create PxLogin object.
            IMMPxLogin pxLogin = new PxLoginClass();

            pxLogin.Connection = connection;

            // Load the extensions.
            IMMEnumExtensionNames extensions = new PxExtensionNamesClass();

            foreach (var extension in extensionNames)
            {
                extensions.Add(extension);
            }

            // Initialize the application using the user name and extensions.
            IMMPxApplication pxApp = new PxApplicationClass();
            var pxAppEx3           = (IMMPxApplicationEx3)pxApp;

            pxAppEx3.Startup(pxLogin, extensions, ref userName);

            return(pxApp);
        }