Example #1
0
 public void DataGrid_Loaded(string id, string fn, string ln)
 {
     SelectedFirstName = fn;
     TherapistsList.Add(new TherapistModel {
         IDTherapist = id, FirstNameTherapist = fn, LastNameTherapist = ln
     });
 }
Example #2
0
        public AddActivitySubViewModel()
        {
            addSaveActivityCommand = new AddSaveActivityCommand(this);
            therapistsList         = new ObservableCollection <TherapistModel>
            {
            };
            TherapistsList.Clear();

            DBClass.openConnection();
            DBClass.sql             = "select * from therapists";
            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);
            TherapistsList.Clear();
            // wyciągamy dane
            int j = 0;

            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();
                    }
                    TherapistsList.Add(new TherapistModel {
                        IDTherapist = (data[0]), FirstNameTherapist = data[1], LastNameTherapist = data[2]
                    });
                    Console.WriteLine("Terapeuta - " + data[1]);
                }
            }
            DBClass.closeConnection();

            //saveCommand = new SaveCommand(this);
            //Console.WriteLine("Getterrek - " + SelectedFirstName);
            selectedPatient = new string[9];
            // wyciągnięcie danych z tabeli - patients
            selectedPatient   = getter.InfoPatientGetter();
            SelectedIDPatient = selectedPatient[0];
            SelectedFirstName = selectedPatient[1];
            SelectedLastName  = selectedPatient[2];
            //SelectedDateOfBirth = selectedPatient[3];
            //SelectedStreet = selectedPatient[4];
            //SelectedZIP = selectedPatient[5];
            //SelectedCity = selectedPatient[6];
            //SelectedIDTherapist = selectedPatientAfterChange[7];
            //SelectedNameTherapist = selectedPatient[8];
            Console.WriteLine("Getterrek - " + selectedPatient[7]);
        }
        public AddPatientSubViewModel()
        {
            therapistsList = new ObservableCollection <TherapistModel>
            {
            };

            DBClass.openConnection();
            DBClass.sql             = "select * from therapists";
            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);
            TherapistsList.Clear();
            // wyciągamy dane
            int j = 0;

            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();
                    }
                    TherapistsList.Add(new TherapistModel {
                        IDTherapist = (data[0]), FirstNameTherapist = data[1], LastNameTherapist = data[2]
                    });
                    //Console.WriteLine("Terapeuta - " + data[1]);
                }
            }
            DBClass.closeConnection();
            //addCommand = new AddCommand(this);
            //Console.WriteLine("Getterrek - " + SelectedFirstName);
            //_selectedTherapist = new string[9];
            //_selectedTherapist = getter.ListTherapistsGetter();
            //SelectedIDPatient = selectedPatient[0];
            //SelectedFirstName = selectedPatient[1];
            //SelectedLastName = selectedPatient[2];
            //Console.WriteLine("Getterrek - " + selectedPatientAfterChange[1]);
        }
Example #4
0
        public void DataGrid_Loaded()
        {
            DBClass.openConnection();

            DBClass.sql             = "select * from therapists";
            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 j = 0;

            //Console.WriteLine("Przy bazie" + DBClass.dt);
            TherapistsList.Clear();
            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();
                    }
                    if (data[0] != "0")
                    {
                        TherapistsList.Add(new TherapistModel {
                            IDTherapist = (data[0]), FirstNameTherapist = data[1], LastNameTherapist = data[2], EmailTherapist = data[3], PhoneTherapist = data[4], NoteTherapist = data[5]
                        });
                    }
                    //Console.WriteLine("IDTherapist" + reader["IDTherapist"].ToString());
                    //Console.WriteLine("FirstNameTherapist" + reader["FirstNameTherapist"].ToString());
                }
            }

            DBClass.closeConnection();
        }