public Retete(int codReteta, Medici medic, Pacienti pacient, string diagnostic, string data)
 {
     this.codRetete  = codReteta;
     this.medic      = medic;
     this.pacient    = pacient;
     this.diagnostic = diagnostic;
     this.data       = data;
 }
Beispiel #2
0
        public static Medici operator+(Medici m, Pacienti p)
        {
            Medici m2 = (Medici)m.Clone();

            Pacienti[] vectorNou = new Pacienti[m.vectorPacienti.Length + 1];
            for (int i = 0; i < m.vectorPacienti.Length; i++)
            {
                vectorNou[i] = (Pacienti)m.vectorPacienti[i].Clone();
            }
            vectorNou[vectorNou.Length] = (Pacienti)p.Clone();
            m2.vectorPacienti           = vectorNou;
            return(m2);
        }
Beispiel #3
0
        public int CompareTo(object obj)
        {
            Pacienti p1 = (Pacienti)obj;

            return(string.Compare(this.Nume, p1.Nume));
        }
Beispiel #4
0
        public object Clone()
        {
            Pacienti p = (Pacienti)this.MemberwiseClone();

            return(p);
        }
Beispiel #5
0
        private void adaugareInFisierTextToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                StreamReader sr  = new StreamReader("Pacienti.txt");
                string       row = null;
                while ((row = sr.ReadLine()) != null)
                {
                    try
                    {
                        int    codPacient = Convert.ToInt32(row.Split(' ')[0]);
                        string nume       = row.Split(' ')[1];
                        string prenume    = row.Split(' ')[2];

                        int    varsta            = Convert.ToInt32(row.Split(' ')[3]);
                        string sex               = row.Split(' ')[4];
                        string categorieAsigurat = row.Split(' ')[5];


                        Pacienti p = new Pacienti(nume, prenume, varsta, sex, codPacient, categorieAsigurat);
                        listaPacienti.Add(p);


                        string          provider  = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source = Proiect.accdb";
                        OleDbConnection conexiune = new OleDbConnection(provider);
                        OleDbCommand    comanda   = new OleDbCommand("INSERT INTO Pacienti VALUES(?,?,?,?,?,?)", conexiune);
                        try
                        {
                            conexiune.Open();
                            comanda.Parameters.Add("codPacient", OleDbType.Integer).Value           = codPacient;
                            comanda.Parameters.Add("Nume", OleDbType.Char, nume.Length).Value       = nume;
                            comanda.Parameters.Add("Prenume", OleDbType.Char, prenume.Length).Value = prenume;

                            comanda.Parameters.Add("Varsta", OleDbType.Integer).Value       = varsta;
                            comanda.Parameters.Add("Sex", OleDbType.Char, sex.Length).Value = sex;
                            comanda.Parameters.Add("CategorieAsigurat", OleDbType.Char, prenume.Length).Value = categorieAsigurat;



                            comanda.ExecuteNonQuery();
                            MessageBox.Show("Client adaugat in BD ");
                        }
                        catch (Exception e1)
                        {
                            MessageBox.Show(e1.Message);
                        }
                        finally
                        {
                            conexiune.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Eroare " + ex.Message);
                    }
                }
                MessageBox.Show("Date citite cu succes");
                sr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fisier negasit " + ex.Message);
            }
        }