private void pacient_Click(object sender, RoutedEventArgs e) { Pacient window = new Pacient(c); window.Show(); this.Close(); }
private void PreluareDate() { DbProviderFactory factory = DbProviderFactories.GetFactory(ProviderName); using (DbConnection connection = factory.CreateConnection()) { connection.ConnectionString = ConnectionString; connection.Open(); DbCommand cmdSelect = connection.CreateCommand(); cmdSelect.CommandText = "SELECT * FROM Pacienti"; using (DbDataReader reader = cmdSelect.ExecuteReader()) { while (reader.Read()) { Pacient pacient = new Pacient( reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2), reader.GetString(3), reader.GetString(4)); pacienti.Add(pacient); } } } foreach (Medic medic in medici) { TreeNode parinte = new TreeNode("Medic - " + medic.IdMedic.ToString()); treeView1.Nodes.Add(parinte); } foreach (Pacient pacient in pacienti.Where(x => x.IdMedic == 1)) { treeView1.Nodes[0].Nodes.Add(pacient.ToString()); nrMedic1++; } foreach (Pacient pacient in pacienti.Where(x => x.IdMedic == 2)) { treeView1.Nodes[1].Nodes.Add(pacient.ToString()); nrMedic2++; } foreach (Pacient pacient in pacienti.Where(x => x.IdMedic == 3)) { treeView1.Nodes[2].Nodes.Add(pacient.ToString()); nrMedic3++; } foreach (Pacient pacient in pacienti.Where(x => x.IdMedic == 4)) { treeView1.Nodes[3].Nodes.Add(pacient.ToString()); nrMedic4++; } }
private void TreeView1_DoubleClick(object sender, EventArgs e) { TreeNode node = treeView1.SelectedNode; string idMedic = node.Parent.Text.Split('-')[1]; string idPacient = node.Text.Split(',')[0]; string numePacient = node.Text.Split(',')[1]; string dataProgramare = node.Text.Split(',')[2]; string oraProgramare = node.Text.Split(',')[3]; Pacient pacient = new Pacient(int.Parse(idPacient), numePacient, int.Parse(idMedic), dataProgramare, oraProgramare); Form2 formular = new Form2(pacient); formular.ShowDialog(); }
public Form2(Pacient pacient) { this.pacient = pacient; InitializeComponent(); AfisareDate(); }