Пример #1
0
        /// <summary>
        /// Gets the <see cref="BasePxEdmRepository" /> repository used to manage the extended data.
        /// </summary>
        /// <param name="pxApp">The process framework application reference.</param>
        /// <returns>
        /// Returns the <see cref="BasePxEdmRepository" /> representing the EDM management controller.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">pxApp</exception>
        /// <exception cref="System.NullReferenceException">The WMSEDM process framework configuration value is null.</exception>
        protected virtual BasePxEdmRepository GetEdmRepository(IMMPxApplication pxApp)
        {
            if (pxApp == null)
            {
                throw new ArgumentNullException("pxApp");
            }

            IMMPxHelper2 helper = (IMMPxHelper2)pxApp.Helper;
            string       progId = helper.GetConfigValue("WMSEDM", string.Empty);

            if (string.IsNullOrEmpty(progId))
            {
                throw new NullReferenceException("The WMSEDM process framework configuration value is null.");
            }

            try
            {
                Type   type = Type.GetTypeFromProgID(progId);
                object obj  = Activator.CreateInstance(type);

                BasePxEdmRepository extendedData = obj as BasePxEdmRepository;
                return(extendedData);
            }
            catch
            {
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        ///     Gets the configuration value that is stored in the MM_PX_CONFIG table and converts the value to the specified type.
        /// </summary>
        /// <typeparam name="TValue">The type of the value.</typeparam>
        /// <param name="source">The helper application reference.</param>
        /// <param name="configName">Name of the configuration.</param>
        /// <param name="fallbackValue">The fallback value.</param>
        /// <returns>
        ///     Returns an object representing the configuration value.
        /// </returns>
        public static TValue GetConfigValue <TValue>(this IMMPxHelper2 source, string configName, TValue fallbackValue)
        {
            if (source == null)
            {
                return(default(TValue));
            }

            object configValue = source.GetConfigValue(configName);

            return(TypeCast.Cast(configValue, fallbackValue));
        }
Пример #3
0
        /// <summary>
        ///     Gets the value for the configuration at the application level.
        /// </summary>
        /// <param name="configName">Name of the config.</param>
        /// <returns>Returns a <see cref="string" /> representing the configuration parameter.</returns>
        protected string GetConfiguration(string configName)
        {
            IMMPxHelper2 helper = (IMMPxHelper2)PxApplication.Helper;

            return(helper.GetConfigValue(configName));
        }