private void Search(string name, string surname, string city, string sex, string pesel)
 {
     Candidates can = new Candidates();
     can.SearchCommand(name, surname, city, sex, pesel);
     can.CreateList();
     dataGrid1.ItemsSource = can.GetList();
 }
 public void CreateList()
 {
     list = new List<Candidates>();
     MySqlCommand command = DBConnection.Instance.Conn.CreateCommand();
     MySqlDataReader Reader;
     command.CommandText = searchCommand;
     DBConnection.Instance.Conn.Open();
     Reader = command.ExecuteReader();
     while (Reader.Read())
     {
         Candidates can = new Candidates();
         can.ID = Reader.GetInt32(0);
         can.Name = Reader.GetString(1);
         can.Surname = Reader.GetString(2);
         can.City = Reader.GetString(3);
         can.Pesel = Reader.GetDecimal(4);
         can.Sex = Reader.GetString(5);
         list.Add(can);
     }
     DBConnection.Instance.Conn.Close();
 }