private void mergeOneChild(ParamTreeNode paramParamTreeNode)
        {
            if (paramParamTreeNode.ChildCount == 1)
            {
                ParamTreeNode paramTreeNode = (ParamTreeNode)paramParamTreeNode.getChildAt(0);
                System.Collections.IEnumerator enumeration1 = paramTreeNode.children();
                List <object> arrayList1 = new List <object>();
                while (enumeration1.MoveNext())
                {
                    arrayList1.Add((ParamTreeNode)enumeration1.Current);
                }
                if (StringUtils.isNullOrBlank(paramParamTreeNode.UserObject.ToString()))
                {
                    paramParamTreeNode.UserObject = paramTreeNode.UserObject;
                }
                else
                {
                    paramParamTreeNode.UserObject = paramParamTreeNode.UserObject + ", " + paramTreeNode.UserObject;
                }
                paramParamTreeNode.remove(paramTreeNode);
                foreach (ParamTreeNode paramTreeNode1 in arrayList1)
                {
                    paramParamTreeNode.add(paramTreeNode1);
                    paramTreeNode1.Parent = paramParamTreeNode;
                }
                if (paramParamTreeNode.ChildCount == 1)
                {
                    mergeOneChild(paramParamTreeNode);
                    return;
                }
            }
            System.Collections.IEnumerator enumeration = paramParamTreeNode.children();
            List <object> arrayList = new List <object>();

            while (enumeration.MoveNext())
            {
                arrayList.Add((ParamTreeNode)enumeration.Current);
            }
            foreach (ParamTreeNode paramTreeNode in arrayList)
            {
                mergeOneChild(paramTreeNode);
            }
        }
        private IList <ParamItemInputTable> createInputList(Session paramSession, IList <ParamItemTable> paramList)
        {
            sbyte  b   = 1;
            int    i   = 1;
            string str = "Param";

            this.b_hasCostBooks = false;
            this.o_missingStr   = null;
            List <object> arrayList1 = new List <object>();
            List <object> arrayList2 = new List <object>();
            List <object> arrayList3 = new List <object>();

            foreach (ParamItemTable paramItemTable in paramList)
            {
                paramItemTable = (ParamItemTable)paramSession.load(typeof(ParamItemTable), paramItemTable.Id);
                string str1 = paramItemTable.Title.ToUpper();
                str1 = StringUtils.replaceAll(str1, " ", "");
                str1 = StringUtils.replaceAll(str1, ",", "");
                str1 = StringUtils.replaceAll(str1, "\"", "''");
                System.Collections.IList list = (System.Collections.IList) this.o_descToAccessRightsMap[str1];
                if (list == null)
                {
                    list = new List <object>();
                    this.o_descToAccessRightsMap[str1] = list;
                }
                if (!list.Contains(paramItemTable.AccessRights))
                {
                    list.Add(paramItemTable.AccessRights);
                }
                arrayList3.Add(StringUtils.replaceAll(paramItemTable.Title, "\"", "''"));
                foreach (ParamItemInputTable paramItemInputTable1 in paramItemTable.InputSet)
                {
                    if (paramItemInputTable1.SortOrder.Value > i)
                    {
                        i = paramItemInputTable1.SortOrder.Value;
                    }
                    if (arrayList2.Contains(paramItemInputTable1.Name))
                    {
                        continue;
                    }
                    arrayList2.Add(paramItemInputTable1.Name);
                    ParamItemInputTable paramItemInputTable2 = (ParamItemInputTable)paramItemInputTable1.clone();
                    arrayList1.Add(paramItemInputTable2);
                }
            }
            i++;
            this.o_rootNode = new ParamTreeNode(this, "", "");
            constructTreeFromDescs(this.o_rootNode, arrayList3);
            StringBuilder stringBuffer = new StringBuilder();

            stringBuffer.Append("SUBSTITUTE(SUBSTITUTE(CONCATENATE(");
            System.Collections.IEnumerator enumeration = this.o_rootNode.preorderEnumeration();
            bool @bool = true;

            while (enumeration.MoveNext())
            {
                ParamTreeNode paramTreeNode1 = (ParamTreeNode)enumeration.Current;
                ParamTreeNode paramTreeNode2 = (ParamTreeNode)paramTreeNode1.Parent;
                if (paramTreeNode1.Leaf)
                {
                    continue;
                }
                if (!@bool)
                {
                    stringBuffer.Append(",");
                }
                else
                {
                    @bool = false;
                }
                if (paramTreeNode1.ChildCount > 1)
                {
                    StringBuilder stringBuffer1 = new StringBuilder();
                    string        str1          = "";
                    for (sbyte b1 = 0; b1 < paramTreeNode1.ChildCount; b1++)
                    {
                        ParamTreeNode paramTreeNode = (ParamTreeNode)paramTreeNode1.getChildAt(b1);
                        if (b1 != 0)
                        {
                            stringBuffer1.Append("\n");
                            str1 = paramTreeNode.UserObject.ToString();
                        }
                        stringBuffer1.Append(paramTreeNode.UserObject.ToString());
                    }
                    paramTreeNode1.ParamName = str + b;
                    ParamItemInputTable paramItemInputTable1 = new ParamItemInputTable();
                    paramItemInputTable1.Name         = paramTreeNode1.ParamName;
                    paramItemInputTable1.DataType     = "datatype.list";
                    paramItemInputTable1.DefaultValue = "";
                    if (paramTreeNode1.Level == 0)
                    {
                        paramItemInputTable1.DependencyStatement = "";
                    }
                    else
                    {
                        string str2 = ((ParamTreeNode)paramTreeNode1.Parent).ParamName;
                        string str3 = str2 + "=\"" + paramTreeNode1.UserObject.ToString().ToUpper() + "\"";
                        str3 = "AND(ARG_SHOWING(\"" + str2 + "\")," + str3 + ")";
                        paramItemInputTable1.DependencyStatement = str3;
                    }
                    paramItemInputTable1.ValidationStatement = "";
                    paramItemInputTable1.Description         = "";
                    paramItemInputTable1.Grouping            = "A. Specification";
                    paramItemInputTable1.SelectionList       = stringBuffer1.ToString().ToUpper();
                    paramItemInputTable1.SortOrder           = Convert.ToInt32(i);
                    paramItemInputTable1.Pblk   = false;
                    paramItemInputTable1.Hidden = false;
                    arrayList1.Add(paramItemInputTable1);
                    stringBuffer.Append("\n   IF(ARG_SHOWING(\"" + paramItemInputTable1.Name + "\")," + paramItemInputTable1.Name + ",\"\")");
                    b++;
                    i++;
                    continue;
                }
                if (paramTreeNode1.ChildCount == 1)
                {
                    ParamItemInputTable paramItemInputTable1 = new ParamItemInputTable();
                    paramItemInputTable1.Name     = str + b;
                    paramItemInputTable1.DataType = "datatype.calcvalue";
                    if (paramTreeNode1.Level == 0)
                    {
                        paramItemInputTable1.DependencyStatement = "";
                    }
                    else
                    {
                        string str1 = ((ParamTreeNode)paramTreeNode1.Parent).ParamName;
                        string str2 = str1 + "=\"" + paramTreeNode1.UserObject.ToString().ToUpper() + "\"";
                        str2 = "AND(ARG_SHOWING(\"" + str1 + "\")," + str2 + ")";
                        paramItemInputTable1.DependencyStatement = str2;
                    }
                    paramItemInputTable1.ValidationStatement = "T(\"" + paramTreeNode1.getChildAt(0).ToString().ToUpper() + "\")";
                    paramItemInputTable1.Description         = "";
                    paramItemInputTable1.Grouping            = "A. Specification";
                    paramItemInputTable1.SelectionList       = "";
                    paramItemInputTable1.SortOrder           = Convert.ToInt32(i);
                    paramItemInputTable1.Pblk   = false;
                    paramItemInputTable1.Hidden = false;
                    arrayList1.Add(paramItemInputTable1);
                    stringBuffer.Append("\n   IF(ARG_SHOWING(\"" + paramItemInputTable1.Name + "\")," + paramItemInputTable1.Name + ",\"\")");
                    b++;
                    i++;
                }
            }
            stringBuffer.Append("\n),\" \",\"\"),\",\",\"\")");
            ParamItemInputTable paramItemInputTable = new ParamItemInputTable();

            paramItemInputTable.Name                = "Result";
            paramItemInputTable.DataType            = "datatype.calcvalue";
            paramItemInputTable.DefaultValue        = "";
            paramItemInputTable.DependencyStatement = "";
            paramItemInputTable.ValidationStatement = stringBuffer.ToString();
            paramItemInputTable.Description         = "";
            paramItemInputTable.Grouping            = "A. Specification";
            paramItemInputTable.SelectionList       = "";
            paramItemInputTable.SortOrder           = Convert.ToInt32(i++);
            b++;
            paramItemInputTable.Pblk   = false;
            paramItemInputTable.Hidden = true;
            arrayList1.Add(paramItemInputTable);
            this.o_missingStr = this.o_rootNode.UserObject.ToString();
            this.o_missingStr = StringUtils.replaceAll(this.o_missingStr, " ", "");
            this.o_missingStr = StringUtils.replaceAll(this.o_missingStr, ",", "");
            this.o_missingStr = StringUtils.replaceAll(this.o_missingStr, "\"", "''");
            System.Collections.IEnumerator iterator = this.o_descToAccessRightsMap.Keys.GetEnumerator();
            List <object> arrayList4 = new List <object>();

            while (iterator.MoveNext())
            {
                string str1 = (string)iterator.Current;
                System.Collections.IList list = (System.Collections.IList) this.o_descToAccessRightsMap[str1];
                if (list.Count > 1)
                {
                    str1 = str1.Substring(this.o_missingStr.Length);
                    ParamItemInputTable paramItemInputTable1 = constructCostBookByAccessRights(str1, list, i++, b++);
                    arrayList4.Add(paramItemInputTable1);
                    arrayList1.Add(paramItemInputTable1);
                }
            }
            if (arrayList4.Count != 0)
            {
                this.b_hasCostBooks = true;
                StringBuilder stringBuffer1 = new StringBuilder();
                sbyte         b1            = 0;
                foreach (ParamItemInputTable paramItemInputTable1 in arrayList4)
                {
                    stringBuffer1.Append("IF(ARG_SHOWING(\"" + paramItemInputTable1.Name + "\")," + paramItemInputTable1.Name + ",");
                    b1++;
                }
                stringBuffer1.Append("\"ALL\"");
                for (sbyte b2 = 0; b2 < b1; b2++)
                {
                    stringBuffer1.Append(")");
                }
                paramItemInputTable                     = new ParamItemInputTable();
                paramItemInputTable.Name                = "CostBook";
                paramItemInputTable.DataType            = "datatype.calcvalue";
                paramItemInputTable.DefaultValue        = "";
                paramItemInputTable.DependencyStatement = "";
                paramItemInputTable.ValidationStatement = stringBuffer1.ToString();
                paramItemInputTable.Description         = "";
                paramItemInputTable.Grouping            = "A. Specification";
                paramItemInputTable.SelectionList       = "";
                paramItemInputTable.SortOrder           = Convert.ToInt32(i++);
                paramItemInputTable.Pblk                = false;
                paramItemInputTable.Hidden              = true;
                arrayList1.Add(paramItemInputTable);
                StringBuilder stringBuffer2 = new StringBuilder();
                iterator = this.o_costBooksMap.Values.GetEnumerator();
                b1       = 0;
                while (iterator.MoveNext())
                {
                    string str1 = (string)iterator.Current;
                    foreach (string str2 in this.o_costBooksMap.Keys)
                    {
                        if (((string)this.o_costBooksMap[str2]).Equals(str1))
                        {
                            stringBuffer2.Append("IF(CostBook=\"" + str1 + "\",\"" + str2 + "\",\n");
                            b1++;
                        }
                    }
                }
                if (b1 > 0)
                {
                    stringBuffer2.Append("\"ALL\"");
                    for (sbyte b3 = 0; b3 < b1; b3++)
                    {
                        stringBuffer2.Append(")");
                    }
                }
                paramItemInputTable                     = new ParamItemInputTable();
                paramItemInputTable.Name                = "CostBookAlias";
                paramItemInputTable.DataType            = "datatype.calcvalue";
                paramItemInputTable.DefaultValue        = "";
                paramItemInputTable.DependencyStatement = "";
                paramItemInputTable.ValidationStatement = stringBuffer2.ToString();
                paramItemInputTable.Description         = "";
                paramItemInputTable.Grouping            = "A. Specification";
                paramItemInputTable.SelectionList       = "";
                paramItemInputTable.SortOrder           = Convert.ToInt32(i++);
                paramItemInputTable.Pblk                = false;
                paramItemInputTable.Hidden              = true;
                arrayList1.Add(paramItemInputTable);
            }
            return(resortGroupsInList(arrayList1));
        }