예제 #1
0
        public void LoadThisGame(Player player)
        {
            GetPlayerInfo(player);
            LoadSeason mySeason = new LoadSeason(loadGameSeasonLength);

            GetPlayerReports(player, mySeason);
            GetPlayerSupplies(player, loadGameDay);
            mySeason.DayCount = loadGameDay + 1;
            mySeason.SalesSeason(player);
        }
예제 #2
0
        public void GetPlayerReports(Player player, LoadSeason season)
        {
            try
            {
                mydb.Open();
            }
            catch (Exception e)
            {
                Console.WriteLine("Openning Getting Reports" + e);
                Console.ReadLine();
            }
            try
            {
                string        query    = $"SELECT DayNumber, Net, Gross, Temprature, Weather_Condition, Price_Per_Cup, Pitchers_Sold, Cost_Of_Pitcher, Cups_Sold, Pitchers_Available, Quality_Of_Supply FROM dbo.Report WHERE Player_Id = {player.PlayerId} ORDER BY DayNumber";
                SqlCommand    myCmd    = new SqlCommand(query, mydb);
                SqlDataReader myReader = myCmd.ExecuteReader();
                while (myReader.Read())
                {
                    DailyReport report = new DailyReport();
                    report.DayNumber         = myReader.GetInt32(0);
                    report.Net               = double.Parse(myReader.GetSqlMoney(1).ToString());
                    report.Gross             = double.Parse(myReader.GetSqlMoney(2).ToString());
                    report.WTemp             = myReader.GetInt32(3);
                    report.WCondition        = myReader.GetString(4);
                    report.PricePerCup       = double.Parse(myReader.GetSqlMoney(5).ToString());
                    report.PitchersSold      = myReader.GetInt32(6);
                    report.CostOfPitcher     = double.Parse(myReader.GetSqlMoney(7).ToString());
                    report.CupsSold          = myReader.GetInt32(8);
                    report.PitchersAvailable = myReader.GetInt32(9);
                    report.QualityOfSupply   = myReader.GetString(10);
                    season.MyReports.Add(report);
                    loadGameDay = report.DayNumber;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Finding reports" + e);
                Console.ReadLine();
            }

            try
            {
                mydb.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Closing reports" + e);
                Console.ReadLine();
            }
        }