public string TolkNearby(PostCode OrderPc, string OderLanguage)
        {
            string returnPostCode = "";
            //PostCode returnP = new PostCode("empty");
            IEnumerator ie = sjaelandHash.Values.GetEnumerator();

            while (ie.MoveNext())
            {
                PostCode p = (PostCode)ie.Current;
                p.parent = null;
            }

            Queue todo = new Queue();

            todo.Enqueue(sjaelandHash[OrderPc.lable]);

            while (todo.Count > 0)
            {
                int      exitloop = 0;
                PostCode p        = (PostCode)todo.Dequeue();
                for (int i = 0; i < p.ActiveTolkInPcList.Count; i++)
                {
                    for (int j = 0; j < p.ActiveTolkInPcList[i].cTlangList.Count; j++)
                    {
                        if (OderLanguage == p.ActiveTolkInPcList[i].cTlangList[j])
                        {
                            returnPostCode = p.lable;
                            //returnP = p;
                            //Console.WriteLine("     Tolk Name: " + p.ActiveTolkInPcList[i].cTname + ", Post Code: " + p.lable + " Language: " + p.ActiveTolkInPcList[i].cTlangList[j]);
                            //p.ActiveTolkInPcList.RemoveAt(i);
                            exitloop = 1;
                            break;
                        }
                    }
                    if (exitloop == 1)
                    {
                        break;
                    }
                }
                if (exitloop == 1)
                {
                    break;
                }
                IEnumerator iePostCode = p.PostCodeHash.Values.GetEnumerator();
                while (iePostCode.MoveNext())
                {
                    PostCode pnull = (PostCode)iePostCode.Current;
                    if (pnull.parent == null)
                    {
                        todo.Enqueue(pnull);
                        pnull.parent = p;
                    }
                }
            }
            return(returnPostCode);
            //return returnP;
        }
Exemple #2
0
        //Program copyTolkPostCode = new Program(); // you can copy tolkdetailist from program file. so there is no need of addTolk method. you can copy ActiveTolkDetailList and populate
        // ActiveTolkInPcList and then you can add languages by using addLangToTolk method. so there is no need of addTolk mehtod.


        public PostCode(string Ppostcode)
        {
            addTolk(Ppostcode);
            addTolkLang();
            addLangToTolk();
            lable        = Ppostcode;
            PostCodeHash = new Hashtable();
            parent       = null;
        }
        public void addPostcodes()
        {
            sjaelandHash = new Hashtable();
            for (int i = 0; i < 165; i++)
            {
                PostCode pEnteringHas = new PostCode(cPostCodesArray[i, 0]);
                sjaelandHash.Add(cPostCodesArray[i, 0], pEnteringHas);
            }

            for (int i = 0; i < 165; i++)
            {
                PostCode AddExitToEachPInHash = (PostCode)sjaelandHash[cPostCodesArray[i, 0]];
                //Console.WriteLine(" aray is " + cPostCodesArray[i, 0]);
                for (int j = 1; j < 7; j++)
                {
                    if (cPostCodesArray[i, j] != null)
                    {
                        AddExitToEachPInHash.addExitPostCode((PostCode)sjaelandHash[cPostCodesArray[i, j]]);
                    }
                }
            }
        }
Exemple #4
0
 public void addExitPostCode(PostCode p)
 {
     PostCodeHash.Add(p.lable, p);
 }