Exemplo n.º 1
0
        /// <summary>
        /// Builds a domain consisting of the Workflow Manager privileges
        /// </summary>
        /// <param name="wmxDb">A reference to the active Workflow Manager database</param>
        /// <param name="extraValues">An array of string values to be added to the list</param>
        /// <returns>A coded value domain as an IGPDomain</returns>
        public static IGPDomain BuildPrivilegesDomain(IJTXDatabase3 wmxDb, string[] extraValues)
        {
            IGPCodedValueDomain domain = new GPCodedValueDomainClass();

            // Sort the types first
            SortedList <string, string> sortedValues = new SortedList <string, string>();
            IJTXPrivilegeSet            privileges   = wmxDb.ConfigurationManager.Privileges;

            for (int i = 0; i < privileges.Count; i++)
            {
                IJTXPrivilege2 priv = privileges.get_Item(i) as IJTXPrivilege2;
                sortedValues.Add(priv.Name, null);
            }

            // Add the extra values, if any
            if (extraValues != null)
            {
                foreach (string s in extraValues)
                {
                    sortedValues.Add(s, null);
                }
            }

            // Add the sorted types to the domain
            foreach (string value in sortedValues.Keys)
            {
                IGPValue tempGpVal = new GPStringClass();
                tempGpVal.SetAsText(value);
                domain.AddCode(tempGpVal, value);
            }

            return(domain as IGPDomain);
        }
        /// <summary>
        /// Builds a domain consisting of the Workflow Manager privileges
        /// </summary>
        /// <returns>A coded value domain of strings</returns>
        private IGPDomain BuildPrivilegesDomain()
        {
            IGPCodedValueDomain domain = new GPCodedValueDomainClass();

            // Sort the types first
            SortedList <string, string> sortedValues = new SortedList <string, string>();
            IJTXPrivilegeSet            privileges   = this.WmxDatabase.ConfigurationManager.Privileges;

            for (int i = 0; i < privileges.Count; i++)
            {
                IJTXPrivilege2 priv = privileges.get_Item(i) as IJTXPrivilege2;
                sortedValues.Add(priv.Name, null);
            }

            // Add the "all privileges" option to the list
            sortedValues.Add(C_OPT_ALL_PRIVILEGES, null);

            // Add the sorted types to the domain
            foreach (string value in sortedValues.Keys)
            {
                IGPValue tempGpVal = new GPStringClass();
                tempGpVal.SetAsText(value);
                domain.AddCode(tempGpVal, value);
            }

            return(domain as IGPDomain);
        }