Exemplo n.º 1
0
        private void MakeBooking(List <Dog> dogs)
        {
            Booking booking = new Booking(AllData.Bookings.Count, currentSimDate);

            foreach (Dog d in dogs)
            {
                int    appToMake;
                double rand = random.NextDouble();
                if (rand < 0.6)
                {
                    appToMake = 1;
                }
                else if (rand < 0.9)
                {
                    appToMake = 2;
                }
                else
                {
                    appToMake = 3;
                }


                int prevDiff = 0;
                for (int i = 0; i < appToMake; i++)
                {
                    int appTypeID = RandGen.GetRandAppTypeID();
                    if (appTypeID == 3)
                    {
                        int count = random.Next(4, 6);
                        List <Appointment> appts = new List <Appointment>();
                        for (int j = 0; j < count; j++)
                        {
                            int         diff = random.Next(15, 30);
                            Appointment app  = BookAppointment(d, booking.BookingID, prevDiff + j * diff, appTypeID);
                            appts.Add(app);
                            booking.Appointments.Add(app);
                        }
                        prevDiff = (int)(currentSimDate - appts[0].AppointmentDate).TotalDays;
                    }
                    else
                    {
                        Appointment app = BookAppointment(d, booking.BookingID, prevDiff, appTypeID);
                        booking.Appointments.Add(app);
                        prevDiff = (int)(currentSimDate - app.AppointmentDate).TotalDays;
                    }
                }
            }
            AllData.Bookings.Add(booking);
        }
Exemplo n.º 2
0
        public void Run(int seed)
        {
            currentCustCount     = 1;
            prevCustCount        = 1;
            daysPassed           = 0;
            random               = new Random(seed);
            appointCountOverTime = new int[2000];
            currentSimDate       = startTime;

            RandGen.Reset(seed);
            AllData.Reset();

            for (int i = 0; i < 365 * 6; i++)
            {
                SimulateDay();
            }
        }
Exemplo n.º 3
0
        public Client(int clientID, string clientNotes, DateTime joinDate, Random random)
        {
            ClientID    = clientID;
            ClientNotes = clientNotes;
            JoinDate    = joinDate;

            IsReturn = RandGen.ShouldBeReturnClient();

            Contacts = new List <Contact>();
            int    contactsCount = random.Next(1, 4);
            string surname       = RandGen.GetRandomSurname();
            string address       = RandGen.GenAddress();
            string town          = RandGen.GenTown();
            string county        = RandGen.GenCounty();
            string postcode      = RandGen.GenPostcode();

            for (int i = 0; i < contactsCount; i++)
            {
                string forename = RandGen.GetRandomForename();
                Contacts.Add(new Contact(AllData.GetNextContactID() + Contacts.Count, ClientID, forename + " " + surname, RandGen.GenEmail(forename, surname).ToLower(), address, county, town, postcode, RandGen.GenPhoneNo()));
            }

            Dogs = new List <Dog>();
            int dogCount = random.Next(1, 4);

            for (int i = 0; i < dogCount; i++)
            {
                string dogGender;
                if (random.Next(2) == 0)
                {
                    dogGender = "M";
                }
                else
                {
                    dogGender = "F";
                }

                Dogs.Add(new Dog(AllData.GetNextDogID() + Dogs.Count, ClientID, RandGen.GenDogName(dogGender), RandGen.GenDogAge(JoinDate), RandGen.GenDogType(), dogGender));
            }
            AllData.Dogs.AddRange(Dogs);
        }
Exemplo n.º 4
0
 public MainGeneration()
 {
     RandGen.InitialiseDataFromFile();
 }