コード例 #1
0
 public Consultatie()
 {
     this.b    = new Boala();
     this.p    = new Pacient();
     this.zi   = 1;
     this.luna = 1;
     this.an   = 2000;
 }
コード例 #2
0
 public Consultatie(Boala b, Pacient p, int zi, int luna, int an)
 {
     this.b    = b;
     this.p    = p;
     this.zi   = zi;
     this.luna = luna;
     this.an   = an;
 }
コード例 #3
0
        //Metoda pentru citirea tuturor consultatiilor dintr-un  fisier Medic.txt
        public String ReadFromFile()
        {
            String msg = "Fisier gol";
            //try
            //{

            StreamReader br = new StreamReader("D:\\Visual Studio\\repos\\MedicDeFamilie\\read.txt");

            String line = null;

            while ((line = br.ReadLine()) != null)
            {
                char[]   separator  = { ',' };
                String[] components = line.Split(separator, StringSplitOptions.RemoveEmptyEntries);

                String stringzi     = components[0].Trim();
                String stringluna   = components[1].Trim();
                String stringan     = components[2].Trim();
                String nume         = components[3].Trim();
                String prenume      = components[4].Trim();
                String stringvarsta = components[5].Trim();
                String adresa       = components[6].Trim();
                String numeBoala    = components[7].Trim();
                String tratament    = components[8].Trim();
                int    zi           = Int32.Parse(stringzi);
                int    luna         = Int32.Parse(stringluna);
                int    an           = Int32.Parse(stringan);
                int    varsta       = Int32.Parse(stringvarsta);
                Boala  b            = new Boala();
                b.AddElm(tratament);
                b.setNumeBoala(numeBoala);
                Pacient p = new Pacient();
                p.setVarsta(varsta);
                p.setAdresa(adresa);
                p.setNume(nume);
                p.setPrenume(prenume);
                p.AddElm(b);
                Consultatie c = new Consultatie(b, p, zi, luna, an);
                AddElm(c);
                Comparare(p);
            }
            if (repo.Count() != 0)
            {
                msg = "Citire reusita";
            }

            br.Close();

            //}
            //catch (IOException e)
            //	{
            //		msg = "Eroare";
            //}
            return(msg);

            //for (int i = 0; i < repo.Count(); i++)
            //Console.WriteLine("|%-28.8s",repo.ElementAt(i).getZi(), repo.ElementAt(i).getLuna(), repo.ElementAt(i).getAn(), repo.ElementAt(i).getP().getNume(), repo.ElementAt(i).getP().getPrenume());
        }
コード例 #4
0
        //Metoda pt Verificarea daca un pacient a mai fost stocat in lista de pacienti sau daca e unul nou.Daca este deja in lista i se va adauga o noua boala in vectorul de boli
        public void Comparare(Pacient p)
        {
            int gasit = 0, i;

            for (i = 0; i < pacienti.Count && gasit == 0; i++)
            {
                if (p.getNume().Equals(pacienti.ElementAt(i).getNume()) && p.getPrenume().Equals(pacienti.ElementAt(i).getPrenume()))
                {
                    gasit = 1;
                }
            }
            if (gasit == 0)
            {
                AddPacient(p);
            }
            else
            {
                pacienti.ElementAt(i - 1).getBoli().Add(p.getBoli().ElementAt(0));
            }
        }
コード例 #5
0
 public void setP(Pacient p)
 {
     this.p = p;
 }
コード例 #6
0
 //Metoda pt adaugarea unui pacient
 public void AddPacient(Pacient p)
 {
     this.pacienti.Add(p);
 }