private static void ShowSpiel(Spiel sp, Spieler s) { Console.Clear(); try { Console.WriteLine("Spiel vom: " + sp.GetDatum().ToString("g")); Dart.WriteChar('~', 30); Console.WriteLine("Gesamt - Avg: " + RoundDouble(AvgD_Spiel_NotFinish(sp, s), 2) + " -> W: " + RoundDouble(AvgW_Spiel_NotFinish(sp, s), 2) + "| D: " + RoundDouble(100 * GetDoubleFinishQuoteSpielSpieler(sp, s), 2) + "%"); List <Set> sets = sp.GetSetsPlayer(s); for (int set = 0; set < sets.Count(); set++) { Dart.WriteChar(' ', 2, false); Console.WriteLine("Set " + (set + 1) + " - Avg: " + RoundDouble(AvgD_Set_NotFinish(sets.ElementAt(set)), 2) + " -> W: " + RoundDouble(AvgW_Set_NotFinish(sets.ElementAt(set)), 2) + "| D: " + RoundDouble(100 * GetDoubleFinishQuoteSet(sets.ElementAt(set)), 2) + "%"); List <Leg> legs = sets.ElementAt(set).GetLegs(); for (int leg = 0; leg < legs.Count(); leg++) { Dart.WriteChar(' ', 4, false); Console.WriteLine("Leg " + (leg + 1) + " - Avg: " + RoundDouble(AvgD_Leg_NotFinish(legs.ElementAt(leg)), 2) + " -> W: " + RoundDouble(AvgW_Leg_NotFinish(legs.ElementAt(leg)), 2) + "| D: " + RoundDouble(100 * GetDoubleFinishQuoteLeg(legs.ElementAt(leg)), 2) + "%"); List <Durchgang> durchgänge = legs.ElementAt(leg).GetDurchgänge(); for (int ds = 0; ds < durchgänge.Count(); ds++) { Dart.WriteChar(' ', 6, false); Console.WriteLine("Aufnahme " + (ds + 1)); Wurf[] würfe = durchgänge.ElementAt(ds).GetWürfe(); for (int w = 0; w < durchgänge.ElementAt(ds).GetAnzahlWürfe(); w++) { Dart.WriteChar(' ', 8, false); Console.WriteLine("Wurf " + (w + 1) + ": " + würfe[w].GetMulti() + "x" + würfe[w].GetWert()); } } Dart.WriteChar(' ', 4, false); Console.WriteLine("Finish: " + legs.ElementAt(leg).GetFinish()); } Dart.WriteChar(' ', 2, false); Console.WriteLine("Highest Finish: " + Highest_Finish_Set(sets.ElementAt(set))); Dart.WriteChar(' ', 2, false); Console.WriteLine("Avg Finish: " + RoundDouble(Average_Finish_Set(sets.ElementAt(set)), 2)); } } catch (Exception e) { Console.WriteLine(e.Message); Dart.Confirm_Dialog(); } }
public static void InsertSpiel(Spiel s) { //string query = "INSERT INTO spiel (`id_spiel`, `datum`, `start`, `setsToWin`, `legsToWin`) VALUES ('" + s.GetId() + "', '" + s.GetDatum().Year + "-" + s.GetDatum().Month + "-" + s.GetDatum().Day + "', '501', '" + s.GetSetsToWin() + "', '" + s.GetLegsToWin() + "')"; string query = "INSERT INTO spiel (`id_spiel`, `datum`, `start`, `setsToWin`, `legsToWin`) VALUES ('" + s.GetId() + "', '" + s.GetDatum().Year + "-" + s.GetDatum().Month + "-" + s.GetDatum().Day + " " + s.GetDatum().Hour + ":" + s.GetDatum().Minute + ":" + s.GetDatum().Second + "', '501', '" + s.GetSetsToWin() + "', '" + s.GetLegsToWin() + "')"; //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("Spiel: " + e.Message); Console.ReadLine(); } //close connection CloseConnection(); } }