private Dictionary <String, Spieler> CreateSpielerDic()
        {
            Dictionary <String, Spieler> spieler = new Dictionary <string, Spieler>();

            for (int i = 0; i < (int)(numUpDown_anzahlSpieler.Value); i++)
            {
                Spieler s = Dart.GetSpieler(tBArraySpieler[i].Text);
                spieler.Add(s.GetUsername(), s);
            }
            return(spieler);
        }
Exemple #2
0
        public SpielerInformationView(string spielerName)
        {
            InitializeComponent();

            Spieler sp = Dart.GetSpieler(spielerName);

            tBx_eMail.Text      = sp.GetEMail();
            tBx_firstName.Text  = sp.GetFirstName();
            tBx_geburtstag.Text = sp.GetGeburtstag().ToString();
            tBx_lastName.Text   = sp.GetLastName();
            tBx_username.Text   = sp.GetUsername();
        }
Exemple #3
0
        public static void InsertUser(Spieler s)
        {
            if (!CheckSpieler(s))
            {
                String firstNameData  = "'" + s.GetFirstName() + "'";
                String lastNameData   = "'" + s.GetLastName() + "'";
                String geburtstagData = "'" + s.GetGeburtstag().Year + "-" + s.GetGeburtstag().Month + "-" + s.GetGeburtstag().Day + "'";
                String eMailData      = "'" + s.GetEMail() + "'";
                String passwdData     = "'" + s.GetPasswd() + "'";
                if (s.GetFirstName() == "")
                {
                    firstNameData = "NULL";
                }
                if (s.GetLastName() == "")
                {
                    lastNameData = "NULL";
                }
                if (s.GetEMail() == "")
                {
                    eMailData = "NULL";
                }
                if (s.GetPasswd() == "")
                {
                    passwdData = "NULL";
                }
                if (s.GetGeburtstag().Equals(new DateTime(1900, 1, 1)))
                {
                    geburtstagData = "NULL";
                }
                string query = "INSERT INTO user (`id_user`, `username`, `firstName`, `lastName`, `geburtstag`, `eMail`, `password`) VALUES('" + s.GetId() + "', '" + s.GetUsername() + "', " + firstNameData + ", " + lastNameData + ", " + geburtstagData + ", " + eMailData + ", " + passwdData + ")";
                //Console.WriteLine(query);
                //Console.ReadKey();
                //open connection
                if (OpenConnection() == true)
                {
                    try
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connection);

                        //Execute command
                        cmd.ExecuteNonQuery();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                        Console.ReadLine();
                    }
                    //close connection
                    CloseConnection();
                }
                else
                {
                    Console.WriteLine("HALLOI");
                    Console.ReadLine();
                }
            }
        }
Exemple #4
0
 /// <summary>
 /// gibt die länge des Usernames des übergebenen Spielers zurück
 /// </summary>
 /// <param name="s">Spieler dessen Länge des Usernames überprüft werden soll</param>
 /// <returns>länge des Usernames des übergebenen Spielers</returns>
 public static int LengthSpieler(Spieler s)
 {
     return(s.GetUsername().Count());
 }