コード例 #1
0
        private void citireDate()
        {
            OleDbConnection conexiune = new OleDbConnection(this.connString);
            OleDbCommand    comanda   = new OleDbCommand("SELECT * FROM pacienti", conexiune);

            try
            {
                conexiune.Open();
                OleDbDataReader reader = comanda.ExecuteReader();
                while (reader.Read())
                {
                    int    idPacient = Convert.ToInt32(reader["ID"].ToString());
                    string nume      = reader["nume"].ToString();
                    int    idMedic   = Convert.ToInt32(reader["idMedic"].ToString());
                    string data      = reader["data"].ToString();
                    string ora       = reader["ora"].ToString();

                    Pacient p = new Pacient(idPacient, nume, idMedic, data, ora);
                    this.pacienti.Add(p);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conexiune.Close();
            }

            MessageBox.Show("Date incarcate din baza de date");

            treeView1.Nodes.Clear();
            foreach (Medic c in medici)
            {
                TreeNode node = new TreeNode(c.IdMedic + " - " + c.Specializare);
                treeView1.Nodes.Add(node);
                if (c.IdMedic == 1)
                {
                    creeaza_copii(node, 1);
                }
                if (c.IdMedic == 2)
                {
                    creeaza_copii(node, 2);
                }
                if (c.IdMedic == 3)
                {
                    creeaza_copii(node, 3);
                }
                if (c.IdMedic == 4)
                {
                    creeaza_copii(node, 4);
                }
                if (c.IdMedic == 5)
                {
                    creeaza_copii(node, 5);
                }
            }
            treeView1.ExpandAll();
        }
コード例 #2
0
        private void treeView1_DoubleClick(object sender, EventArgs e)
        {
            TreeNode nodSelectat = treeView1.SelectedNode;
            int      id          = Convert.ToInt32(nodSelectat.Text.Split(',')[0]);
            string   nume        = nodSelectat.Text.Split(',')[1];
            int      idMedic     = Convert.ToInt32(nodSelectat.Text.Split(',')[2]);
            string   data        = nodSelectat.Text.Split(',')[3];
            string   ora         = nodSelectat.Text.Split(',')[4];
            Pacient  p           = new Pacient(id, nume, idMedic, data, ora);
            Form2    formular    = new Form2(p);

            formular.ShowDialog();
            citireDate();
        }
コード例 #3
0
ファイル: Form2.cs プロジェクト: StefanLazea/paw
 public Form2(Pacient pacient)
 {
     this.pacient    = pacient;
     this.connString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source = cabinet.accdb";
     InitializeComponent();
 }