Exemplo n.º 1
0
 public void DataGrid_Loaded(string id, string fn, string ln)
 {
     SelectedFirstName = fn;
     ParentsList.Add(new ParentModel {
         IDParent = id, FirstNameParent = fn, LastNameParent = ln
     });
 }
Exemplo n.º 2
0
        public void DataGrid_Loaded()
        {
            ParentsList.Clear();
            DBClass.openConnection();
            DBClass.sql = "select IDParent, FirstNameParent, LastNameParent, TelephoneParent, EmailParent, StreetParent, ZIPParent, CityParent, parents.IDPatient, FirstName, LastName " +
                          "from parents, patients where FirstName = (select FirstName from patients where patients.IDPatient = parents.IDPatient) and " +
                          "LastName = (select LastName from patients where patients.IDPatient = parents.IDPatient)";
            DBClass.cmd.CommandType = CommandType.Text;
            DBClass.cmd.CommandText = DBClass.sql;

            DBClass.da = new SqlDataAdapter(DBClass.cmd);
            DBClass.dt = new DataTable();
            DBClass.da.Fill(DBClass.dt);

            // wyciągamy dane
            int i = 0;
            int j = 0;

            //Console.WriteLine("Przy bazie" + DBClass.dt);
            using (SqlDataReader reader = DBClass.cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    for (j = 0; j <= reader.FieldCount - 1; j++) // Looping throw colums
                    {
                        data[j] = reader.GetValue(j).ToString();
                    }
                    ParentsList.Add(new ParentModel {
                        IDParent  = (data[0]), FirstNameParent = data[1], LastNameParent = data[2], TelephoneParent = data[3], EmailParent = data[4], StreetParent = data[5],
                        ZIPParent = data[6], CityParent = data[7], IDPatient = data[8], FirstNamePatient = data[9], LastNamePatient = data[10]
                    });
                    i++;
                    Console.WriteLine("IdParent" + reader["IDParent"].ToString());
                    Console.WriteLine("IdParent" + reader["FirstNameParent"].ToString());
                }
            }
            DBClass.closeConnection();
        }
 public void SetParent(MultiTreeNode <TValue, TConnectionWay> parentNode)
 {
     ParentsList.Add(parentNode);
 }