예제 #1
0
파일: Simulation.cs 프로젝트: Piwo13/FM
        private static void Regen()
        {
            var players = PlayerRepo.GetRet();

            using (var connection = DBConnection.Instance.Connection)
            {
                foreach (int player in players)
                {
                    DateTime date = new DateTime(ClubStatus.SeasonEnd.Year - 16, 1, 1);
                    Random   rnd  = new Random();
                    date.AddDays(rnd.Next(365));
                    SQLiteCommand command = new SQLiteCommand($"update players set dateofbirth = \"{date:yyyy-MM-dd}\", contract_terminates = \"{ClubStatus.SeasonEnd.Year + 3}-{ClubStatus.SeasonEnd:MM-dd}\", overall = {rnd.Next(51, 65)}, isRetiring = 0 where id = {player}", connection);
                    connection.Open();
                    command.ExecuteNonQuery();
                    connection.Close();
                }
            }
        }