Esempio n. 1
0
        public static LocationRepository GetInstance()
        {
            if (_instance == null)
            {
                _instance = new LocationRepository();
            }

            return(_instance);
        }
Esempio n. 2
0
        public static FishingRecord CreateFishingRecord(DateTime inDtStart, DateTime inDtEnd, string inLocationName,
                                                        Winds inWind, MoonPhases inMoonPhase, Tides inTide, FishCatch inFishCatch)
        {
            DateTime         dtAdded    = DateTime.Now;
            DateTimeInterval dtInterval = new DateTimeInterval(inDtStart, inDtEnd);
            Location         location   = LocationRepository.GetInstance().GetLocation(inLocationName);
            NatureEvents     nContext   = new NatureEvents(inWind, inMoonPhase, inTide);

            FishingRecord record = new FishingRecord(dtAdded, dtInterval, location, nContext, inFishCatch);

            return(record);
        }
        private void Initialize()
        {
            LocationRepository repository = LocationRepository.GetInstance();
            FishingRecord      record;

            _records = new List <FishingRecord>();
            DateTime         dtAdded    = new DateTime(2014, 1, 10, 12, 34, 45);
            DateTimeInterval dtInterval = new DateTimeInterval(new DateTime(2013, 9, 1, 12, 00, 00), new DateTime(2013, 9, 1, 16, 00, 00));
            Location         location   = repository.GetLocation("Medulin");
            NatureEvents     context    = new NatureEvents(Winds.NE, MoonPhases.newMoon, Tides.waterRising);
            FishCatch        fishCatch  = new FishCatch();

            fishCatch.AddCatch("orada", 5.0);
            fishCatch.AddCatch("ribon", 2.0);
            fishCatch.AddSale("orada", 3.0, 200.0);
            fishCatch.AddSale("ribon", 2.0, 200.0);
            record = new FishingRecord(dtAdded, dtInterval, location, context, fishCatch);
            _records.Add(record);

            dtAdded    = new DateTime(2014, 1, 11, 14, 23, 12);
            dtInterval = new DateTimeInterval(new DateTime(2013, 9, 15, 14, 00, 00), new DateTime(2013, 9, 15, 18, 00, 00));
            location   = repository.GetLocation("Medulin");
            context    = new NatureEvents(Winds.N, MoonPhases.fullMoon, Tides.waterRising);
            fishCatch  = new FishCatch();
            fishCatch.AddCatch("brancin", 4.5);
            fishCatch.AddCatch("tuna", 10.0);
            fishCatch.AddSale("tuna", 10.0, 500.0);
            record = new FishingRecord(dtAdded, dtInterval, location, context, fishCatch);
            _records.Add(record);

            dtAdded    = new DateTime(2014, 1, 12, 16, 34, 23);
            dtInterval = new DateTimeInterval(new DateTime(2014, 1, 1, 16, 00, 00), new DateTime(2014, 1, 1, 20, 00, 00));
            location   = repository.GetLocation("Verudela");
            context    = new NatureEvents(Winds.S, MoonPhases.waxingCrescent, Tides.waterFalling);
            fishCatch  = new FishCatch();
            fishCatch.AddCatch("list", 2.0);
            fishCatch.AddSale("list", 2.0, 130);
            record = new FishingRecord(dtAdded, dtInterval, location, context, fishCatch);
            _records.Add(record);
        }