Ejemplo n.º 1
0
        public doctor get_doc(string specialization)
        {
            Node <doctor> temp   = Doctors;
            doctor        answer = null;

            while (temp != null)
            {
                Console.WriteLine(".");
                if (temp.GetValue().Specialization == specialization)
                {
                    try
                    {
                        if (temp.GetValue().Treatments == null || l(temp.GetValue().Treatments) < l(answer.Treatments))
                        {
                            answer = temp.GetValue();
                        }
                    }
                    catch
                    {
                        answer = temp.GetValue();
                    }
                }
                temp = temp.GetNext();
            }
            return(answer);
        }
Ejemplo n.º 2
0
        public void adddoc(string name, string specialization)
        {
            doctor        d    = new doctor(name, specialization);
            Node <doctor> temp = new Node <doctor>(d);

            if (Doctors == null)
            {
                Doctors = temp;
            }
            else
            {
                Doctors.SetNext(temp);
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            office o = new office("name");

            o.adddoc("doc name", "heart");

            doctor doc = o.get_doc("heart");

            if (o.Doctors == null)
            {
                Console.WriteLine("test..");
            }

            Console.WriteLine(o.Doctors.GetValue().Specialization);

            Console.WriteLine(doc.Name);


            Console.ReadKey();
        }