Пример #1
0
        private QuestTree getQuestTree(HotelsTree hotelTree)
        {
            QuestTree tree = new QuestTree();

            tree.Root = new QuestNode("START");

            QuestNode node;
            QuestLink link;

            for (int i = 0; i < hotelTree.Root.Children.Count; i++)
            {
                node = new QuestNode("C" + i);

                link = new QuestLink();

                link.KU = "1.0";
                link.Arg = "Страна";
                link.Function = "=";
                link.Link = hotelTree.Root.Children[i].NodeName;
                link.Node = node;

                tree.Root.Links.Add(link);

            }


            QuestNode node_all_c = new QuestNode("ALL");
            link = new QuestLink();

            link.KU = "1.0";
            link.Arg = "Страна";
            link.Function = "=";
            link.Link = "все";
            link.Node = node_all_c;

            tree.Root.Links.Add(link);

            for (int i = 0; i < hotelTree.Root.Children.Count; i++)
            {
                QuestNode cn = tree.Root.Links[i].Node;
                QuestNode node_all = new QuestNode("ALL_" + i);

                for (int j = 0; j < hotelTree.Root.Children[i].Children.Count; j++)
                {

                    node = new QuestNode("R" + i + "_" + j);

                    link = new QuestLink();

                    link.KU = "1.0";
                    link.Arg = "Регион";
                    link.Function = "=";
                    link.Link = hotelTree.Root.Children[i].Children[j].NodeName;
                    link.Node = node;

                    cn.Links.Add(link);

                    Region region = Region.GetRegion(hotelTree.Root.Children[i].NodeName, hotelTree.Root.Children[i].Children[j].NodeName);
                    link = new QuestLink();
                    link.KU = "1.0";
                    link.Arg = "Климат";
                    link.Function = "=";
                    link.Link = II.CurentII.Climate[region];
                    link.Node = node;
                    node_all_c.Links.Add(link);

                    link = new QuestLink();
                    link.KU = "1.0";
                    link.Arg = "Климат";
                    link.Function = "=";
                    link.Link = II.CurentII.Climate[region];
                    link.Node = node;
                    node_all.Links.Add(link);

                }


                link = new QuestLink();

                link.KU = "1.0";
                link.Arg = "Регион";
                link.Link = "все";
                link.Function = "=";
                link.Node = node_all;

                cn.Links.Add(link);


            }


            for (int i = 0; i < hotelTree.Root.Children.Count; i++)
            {

                for (int j = 0; j < hotelTree.Root.Children[i].Children.Count; j++)
                {

                    Region region = Region.GetRegion(hotelTree.Root.Children[i].NodeName, hotelTree.Root.Children[i].Children[j].NodeName);
                    string climate = II.CurentII.Climate[region];
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node;
                    node = new QuestNode("CZ" + i + "_" + j);

                    link = new QuestLink();

                    link.KU = II.CurentII.ClimateHealthKU[climate]["плохое"] + "";
                    link.Arg = "Здоровье";
                    link.Function = "=";
                    link.Link = "плохое";
                    link.Node = node;
                    cn.Links.Add(link);

                    link = new QuestLink();

                    link.KU = II.CurentII.ClimateHealthKU[climate]["ниже среднего"] + "";
                    link.Arg = "Здоровье";
                    link.Function = "=";
                    link.Link = "ниже среднего";
                    link.Node = node;
                    cn.Links.Add(link);

                    link = new QuestLink();

                    link.KU = II.CurentII.ClimateHealthKU[climate]["среднее"] + "";
                    link.Arg = "Здоровье";
                    link.Function = "=";
                    link.Link = "среднее";
                    link.Node = node;
                    cn.Links.Add(link);

                    link = new QuestLink();

                    link.KU = II.CurentII.ClimateHealthKU[climate]["выше среднего"] + "";
                    link.Arg = "Здоровье";
                    link.Function = "=";
                    link.Link = "выше среднего";
                    link.Node = node;
                    cn.Links.Add(link);

                    link = new QuestLink();

                    link.KU = II.CurentII.ClimateHealthKU[climate]["хорошее"] + "";
                    link.Arg = "Здоровье";
                    link.Function = "=";
                    link.Link = "хорошее";
                    link.Node = node;
                    cn.Links.Add(link);



                }

            }

            for (int i = 0; i < hotelTree.Root.Children.Count; i++)
            {

                for (int j = 0; j < hotelTree.Root.Children[i].Children.Count; j++)
                {
                    Region region = Region.GetRegion(hotelTree.Root.Children[i].NodeName, hotelTree.Root.Children[i].Children[j].NodeName);
                    string climate = II.CurentII.Climate[region];

                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node;
                    node = new QuestNode("CV" + i + "_" + j);

                    link = new QuestLink();

                    link.KU = "Климат/Возраст";
                    link.Arg = "Возраст";
                    link.Function = "подходит к";
                    link.Link = climate;
                    link.Node = node;

                    cn.Links.Add(link);

                }

            }

            List<QuestNode> questNodeList = new List<QuestNode>();

            for (int i = 0; i < hotelTree.Root.Children.Count; i++)
            {

                for (int j = 0; j < hotelTree.Root.Children[i].Children.Count; j++)
                {
                    for (int k = 0; k < hotelTree.Root.Children[i].Children[j].Children.Count; k++)
                    {
                        QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node;
                        node = new QuestNode("DIS" + i + "_" + j + "_" + k);

                        link = new QuestLink();

                        link.KU = "1.0";
                        link.Arg = "Назначение";
                        link.Function = "=";
                        link.Link = hotelTree.Root.Children[i].Children[j].Children[k].NodeName;
                        link.Node = node;

                        cn.Links.Add(link);

                        questNodeList.Add(node);
                    }

                }

            }

            List<QuestNode> questNodeList_2 = new List<QuestNode>();

            for (int z = 0; z < questNodeList.Count; z++)
            {
                string[] sbstr = questNodeList[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);

                string dis = hotelTree.Root.Children[i].Children[j].Children[k].NodeName;

                QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node;
                node = new QuestNode("DIN" + i + "_" + j + "_" + k);

                link = new QuestLink();

                link.KU = II.CurentII.DestinationInsuranceKU[dis][Values.InsuranceYes] + "";
                link.Arg = "Страховка";
                link.Function = "=";
                link.Link = Values.InsuranceYes;
                link.Node = node;
                cn.Links.Add(link);

                link = new QuestLink();

                link.KU = II.CurentII.DestinationInsuranceKU[dis][Values.InsuranceNo] + "";
                link.Arg = "Страховка";
                link.Function = "=";
                link.Link = Values.InsuranceNo;
                link.Node = node;
                cn.Links.Add(link);

                questNodeList_2.Add(node);

            }

            questNodeList = new List<QuestNode>();

            for (int z = 0; z < questNodeList_2.Count; z++)
            {
                string[] sbstr = questNodeList_2[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);

                string dis = hotelTree.Root.Children[i].Children[j].Children[k].NodeName;

                QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node;
                node = new QuestNode("DIZ" + i + "_" + j + "_" + k);

                link = new QuestLink();

                link.KU = II.CurentII.DestinationHealthKU[dis]["плохое"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "плохое";
                link.Node = node;
                cn.Links.Add(link);

                link = new QuestLink();

                link.KU = II.CurentII.DestinationHealthKU[dis]["ниже среднего"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "ниже среднего";
                link.Node = node;
                cn.Links.Add(link);

                link = new QuestLink();

                link.KU = II.CurentII.DestinationHealthKU[dis]["среднее"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "среднее";
                link.Node = node;
                cn.Links.Add(link);

                link = new QuestLink();

                link.KU = II.CurentII.DestinationHealthKU[dis]["выше среднего"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "выше среднего";
                link.Node = node;
                cn.Links.Add(link);

                link = new QuestLink();

                link.KU = II.CurentII.DestinationHealthKU[dis]["хорошее"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "хорошее";
                link.Node = node;
                cn.Links.Add(link);

                questNodeList.Add(node);

            }

            questNodeList_2 = new List<QuestNode>();

            for (int z = 0; z < questNodeList.Count; z++)
            {
                string[] sbstr = questNodeList[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);



                QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node;
                node = new QuestNode("DIV" + i + "_" + j + "_" + k);

                link = new QuestLink();

                link.KU = "Назначение/Возраст";
                link.Arg = "Возраст";
                link.Function = "подходит";
                link.Link = hotelTree.Root.Children[i].Children[j].Children[k].NodeName;
                link.Node = node;

                cn.Links.Add(link);

                questNodeList_2.Add(node);

            }

            List<QuestNode> questNodeList_1 = new List<QuestNode>();

            for (int z = 0; z < questNodeList_2.Count; z++)
            {
                string[] sbstr = questNodeList_2[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);


                for (int l = 0; l < hotelTree.Root.Children[i].Children[j].Children[k].Children.Count; l++)
                {
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node;
                    node = new QuestNode("LOC" + i + "_" + j + "_" + k + "_" + l);

                    link = new QuestLink();

                    link.KU = "1.0";
                    link.Arg = "Расположение";
                    link.Function = "=";
                    link.Link = hotelTree.Root.Children[i].Children[j].Children[k].Children[l].NodeName;
                    link.Node = node;

                    cn.Links.Add(link);

                    questNodeList_1.Add(node);
                }
            }



            questNodeList = new List<QuestNode>();

            for (int z = 0; z < questNodeList_1.Count; z++)
            {
                string[] sbstr = questNodeList_1[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);

                for (int m = 0; m < hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children.Count; m++)
                {
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node;
                    node = new QuestNode("LVL" + i + "_" + j + "_" + k + "_" + l + "_" + m);

                    link = new QuestLink();

                    link.KU = "1.0";
                    link.Arg = "Уровень";
                    link.Function = "=";
                    link.Link = hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].NodeName;
                    link.Node = node;

                    cn.Links.Add(link);

                    questNodeList.Add(node);
                }
            }

            questNodeList_1 = new List<QuestNode>();

            for (int z = 0; z < questNodeList.Count; z++)
            {
                string[] sbstr = questNodeList[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);
                int m = Int32.Parse(sbstr[4]);


                for (int n = 0; n < hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children.Count; n++)
                {
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node.Links[m].Node;
                    node = new QuestNode("TPY" + i + "_" + j + "_" + k + "_" + l + "_" + m + "_" + n);

                    link = new QuestLink();

                    link.KU = "1.0";
                    link.Arg = "Тип";
                    link.Function = "=";
                    link.Link = hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].NodeName;
                    link.Node = node;

                    cn.Links.Add(link);

                    questNodeList_1.Add(node);
                }
            }


            questNodeList = new List<QuestNode>();

            for (int z = 0; z < questNodeList_1.Count; z++)
            {
                string[] sbstr = questNodeList_1[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);
                int m = Int32.Parse(sbstr[4]);
                int n = Int32.Parse(sbstr[5]);


                for (int o = 0; o < hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children.Count; o++)
                {
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node.Links[m].Node.Links[n].Node;
                    node = new QuestNode("MLS" + i + "_" + j + "_" + k + "_" + l + "_" + m + "_" + n + "_" + o);

                    link = new QuestLink();

                    link.KU = "1.0";
                    link.Arg = "Питание";
                    link.Function = "=";
                    link.Link = hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].NodeName;
                    link.Node = node;

                    cn.Links.Add(link);

                    questNodeList.Add(node);
                }
            }

            questNodeList_1 = new List<QuestNode>();

            for (int z = 0; z < questNodeList.Count; z++)
            {
                string[] sbstr = questNodeList[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);
                int m = Int32.Parse(sbstr[4]);
                int n = Int32.Parse(sbstr[5]);
                int o = Int32.Parse(sbstr[6]);


                QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node.Links[m].Node.Links[n].Node.Links[o].Node;
                node = new QuestNode("MLZ" + i + "_" + j + "_" + k + "_" + l + "_" + m + "_" + n + "_" + o);

                string meals = hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].NodeName;

                link = new QuestLink();

                link.KU = II.CurentII.MealHealthKU[meals]["плохое"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "плохое";
                link.Node = node;
                cn.Links.Add(link);

                link = new QuestLink();

                link.KU = II.CurentII.MealHealthKU[meals]["ниже среднего"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "ниже среднего";
                link.Node = node;
                cn.Links.Add(link);

                link = new QuestLink();

                link.KU = II.CurentII.MealHealthKU[meals]["среднее"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "среднее";
                link.Node = node;
                cn.Links.Add(link);

                link = new QuestLink();

                link.KU = II.CurentII.MealHealthKU[meals]["выше среднего"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "выше среднего";
                link.Node = node;
                cn.Links.Add(link);

                link = new QuestLink();

                link.KU = II.CurentII.MealHealthKU[meals]["хорошее"] + "";
                link.Arg = "Здоровье";
                link.Function = "=";
                link.Link = "хорошее";
                link.Node = node;
                cn.Links.Add(link);

                questNodeList_1.Add(node);

            }

            questNodeList = new List<QuestNode>();

            for (int z = 0; z < questNodeList_1.Count; z++)
            {
                string[] sbstr = questNodeList_1[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);
                int m = Int32.Parse(sbstr[4]);
                int n = Int32.Parse(sbstr[5]);
                int o = Int32.Parse(sbstr[6]);


                QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node.Links[m].Node.Links[n].Node.Links[o].Node.Links[0].Node;
                node = new QuestNode("MLV" + i + "_" + j + "_" + k + "_" + l + "_" + m + "_" + n + "_" + o);

                link = new QuestLink();

                link.KU = "Питание/Возраст";
                link.Arg = "Возраст";
                link.Function = "подходит к";
                link.Link = hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].NodeName;
                link.Node = node;

                cn.Links.Add(link);

                questNodeList.Add(node);

            }

            questNodeList_1 = new List<QuestNode>();

            for (int z = 0; z < questNodeList.Count; z++)
            {
                string[] sbstr = questNodeList[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);
                int m = Int32.Parse(sbstr[4]);
                int n = Int32.Parse(sbstr[5]);
                int o = Int32.Parse(sbstr[6]);


                for (int p = 0; p < hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children.Count; p++)
                {
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node.Links[m].Node.Links[n].Node.Links[o].Node.Links[0].Node.Links[0].Node;
                    node = new QuestNode("UHT" + i + "_" + j + "_" + k + "_" + l + "_" + m + "_" + n + "_" + o + "_" + p);

                    link = new QuestLink();
                    link.KU = "1.0";
                    link.Arg = "Услуги в отеле";
                    link.Function = "содержат";
                    link.Link = String.Join(", ", hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children[p].NodeNameList);
                    link.Node = node;

                    cn.Links.Add(link);

                    questNodeList_1.Add(node);
                }
            }

            questNodeList = new List<QuestNode>();

            for (int z = 0; z < questNodeList_1.Count; z++)
            {
                string[] sbstr = questNodeList_1[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);
                int m = Int32.Parse(sbstr[4]);
                int n = Int32.Parse(sbstr[5]);
                int o = Int32.Parse(sbstr[6]);
                int p = Int32.Parse(sbstr[7]);


                for (int q = 0; q < hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children[p].Children.Count; q++)
                {
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node.Links[m].Node.Links[n].Node.Links[o].Node.Links[0].Node.Links[0].Node.Links[p].Node;
                    node = new QuestNode("URM" + i + "_" + j + "_" + k + "_" + l + "_" + m + "_" + n + "_" + o + "_" + p + "_" + q);

                    link = new QuestLink();
                    link.KU = "1.0";
                    link.Arg = "Услуги в номере";
                    link.Function = "содержат";
                    link.Link = String.Join(", ", hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children[p].Children[q].NodeNameList);

                    link.Node = node;

                    cn.Links.Add(link);

                    questNodeList.Add(node);
                }
            }

            questNodeList_1 = new List<QuestNode>();

            for (int z = 0; z < questNodeList.Count; z++)
            {
                string[] sbstr = questNodeList[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);
                int m = Int32.Parse(sbstr[4]);
                int n = Int32.Parse(sbstr[5]);
                int o = Int32.Parse(sbstr[6]);
                int p = Int32.Parse(sbstr[7]);
                int q = Int32.Parse(sbstr[8]);


                for (int r = 0; r < hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children[p].Children[q].Children.Count; r++)
                {
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node.Links[m].Node.Links[n].Node.Links[o].Node.Links[0].Node.Links[0].Node.Links[p].Node.Links[q].Node;
                    node = new QuestNode("UCH" + i + "_" + j + "_" + k + "_" + l + "_" + m + "_" + n + "_" + o + "_" + p + "_" + q + "_" + r);

                    link = new QuestLink();
                    link.KU = "1.0";
                    link.Arg = "Услуги для детей";
                    link.Function = "содержат";
                    link.Link = String.Join(", ", hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children[p].Children[q].Children[r].NodeNameList);

                    link.Node = node;

                    cn.Links.Add(link);

                    questNodeList_1.Add(node);
                }
            }

            questNodeList = new List<QuestNode>();

            for (int z = 0; z < questNodeList_1.Count; z++)
            {
                string[] sbstr = questNodeList_1[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);
                int m = Int32.Parse(sbstr[4]);
                int n = Int32.Parse(sbstr[5]);
                int o = Int32.Parse(sbstr[6]);
                int p = Int32.Parse(sbstr[7]);
                int q = Int32.Parse(sbstr[8]);
                int r = Int32.Parse(sbstr[9]);


                for (int s = 0; s < hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children[p].Children[q].Children[r].Children.Count; s++)
                {
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node.Links[m].Node.Links[n].Node.Links[o].Node.Links[0].Node.Links[0].Node.Links[p].Node.Links[q].Node.Links[r].Node;
                    node = new QuestNode("SRM" + i + "_" + j + "_" + k + "_" + l + "_" + m + "_" + n + "_" + o + "_" + p + "_" + q + "_" + r + "_" + s);

                    link = new QuestLink();
                    link.KU = "Сумма";
                    link.Arg = "Сумма";
                    link.Function = "без услуг приблизительно равна";
                    link.Link = hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children[p].Children[q].Children[r].Children[s].NodeName;

                    link.Node = node;

                    cn.Links.Add(link);

                    questNodeList.Add(node);
                }
            }

            questNodeList_1 = new List<QuestNode>();

            for (int z = 0; z < questNodeList.Count; z++)
            {
                string[] sbstr = questNodeList[z].Name.Substring(3).Split('_');
                int i = Int32.Parse(sbstr[0]);
                int j = Int32.Parse(sbstr[1]);
                int k = Int32.Parse(sbstr[2]);
                int l = Int32.Parse(sbstr[3]);
                int m = Int32.Parse(sbstr[4]);
                int n = Int32.Parse(sbstr[5]);
                int o = Int32.Parse(sbstr[6]);
                int p = Int32.Parse(sbstr[7]);
                int q = Int32.Parse(sbstr[8]);
                int r = Int32.Parse(sbstr[9]);
                int s = Int32.Parse(sbstr[10]);


                for (int t = 0; t < hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children[p].Children[q].Children[r].Children[s].Children.Count; t++)
                {
                    QuestNode cn = tree.Root.Links[i].Node.Links[j].Node.Links[0].Node.Links[0].Node.Links[k].Node.Links[0].Node.Links[0].Node.Links[0].Node.Links[l].Node.Links[m].Node.Links[n].Node.Links[o].Node.Links[0].Node.Links[0].Node.Links[p].Node.Links[q].Node.Links[r].Node.Links[s].Node;
                    node = new QuestNode(hotelTree.Root.Children[i].Children[j].Children[k].Children[l].Children[m].Children[n].Children[o].Children[p].Children[q].Children[r].Children[s].Children[t].NodeName);

                    link = new QuestLink();
                    link.KU = "1.0";
                    link.Arg = "Отель";
                    link.Function = "является";
                    link.Link = "";

                    link.Node = node;

                    cn.Links.Add(link);

                    questNodeList_1.Add(node);
                }
            }

            return tree;
        }
Пример #2
0
        private string bz(QuestNode l)
        {
            string s = "";
            if (l != null && l.Links != null)
            {
                for (int i = 0; i < l.Links.Count; i++)
                {
                    if (!l.Links[i].Used)
                    {

                        s += "\n ЕСЛИ '" + l.Name + "' И '" + l.Links[i].Arg + "'" + l.Links[i].Function + "'" + l.Links[i].Link + "' ТО '" + l.Links[i].Node.Name + "' (КУ = " + l.Links[i].KU + ")";

                        l.Links[i].Used = true;
                        s += bz(l.Links[i].Node);
                    }
                }
            }
            return s;
        }