Ejemplo n.º 1
0
        public void AddEvent(DateTime date, string title, string location)
        {
            Event newEvent = new Event(date, title, location);
            this.ByTitle.Add(title.ToLower(), newEvent);
            this.ByDate.Add(newEvent);

            Messages.EventAdded();
        }
Ejemplo n.º 2
0
        private void LoadTestData()
        {
            BindingList<DateTime> event1Dates = new BindingList<DateTime>();
            event1Dates.Add(new DateTime(2011, 02, 15));
            event1Dates.Add(new DateTime(2011, 02, 16));
            Event event1 = new Event()
            {
                ID = 1,
                name = "OSU Race February",
                city = "Columbus",
                state = "OH",
                dates = event1Dates
            };

            BindingList<DateTime> event2Dates = new BindingList<DateTime>();
            event2Dates.Add(new DateTime(2011, 03, 20));
            event2Dates.Add(new DateTime(2011, 03, 21));
            Event event2 = new Event()
            {
                ID = 2,
                name = "OSU Race March",
                city = "Columbus",
                state = "OH",
                dates = event2Dates
            };

            events.Add(event1);
            events.Add(event2);

            Competitor cmp = new Competitor()
            {
                ID = 1,
                LastName = "Doe",
                FirstName = "John",
                Address = new Address("OSU", "Columbus", "OH", 43201),
                Phone = new PhoneNumber("123-456-7890"),
                DOB = DateTime.Now,
                Age = 29,
                Gender = true,
                Sponsors = "Honda",
                BikeBrand = "Honda",
                BikeNumber = "33",
                TagNumber = new TagId("0343")
            };

            Competitor cmp2 = new Competitor()
            {
                ID = 2,
                LastName = "Smith",
                FirstName = "Mike",
                Address = new Address("OSU", "Columbus", "OH", 43201),
                Phone = new PhoneNumber("123-456-7890"),
                DOB = DateTime.Now,
                Age = 40,
                Gender = true,
                Sponsors = "Suzuki",
                BikeBrand = "Suzuki",
                BikeNumber = "37",
                TagNumber = new TagId("0365")
            };

            competitors.Add(cmp);
            competitors.Add(cmp2);

            event1.competitors.Add(cmp);
            event2.competitors.Add(cmp);

            event1.competitors.Add(cmp2);
            event2.competitors.Add(cmp2);

            Class class125cc = new Class();
            class125cc.name = "125cc";
            class125cc.description = "125cc";

            Class class250cc = new Class();
            class250cc.name = "250cc";
            class250cc.description = "250cc";

            classes.Add(class125cc);
            classes.Add(class250cc);

            Race event1Race1 = new Race("qualify race 1", "Qualifying");
            Race event1Race2 = new Race("qualify race 2", "Qualifying");
            Race event1Race3 = new Race("final race", "Race");

            Race event2Race1 = new Race("qualify race 1", "Qualifying");
            Race event2Race2 = new Race("qualify race 2", "Qualifying");
            Race event2Race3 = new Race("final race", "Race");

            event1.races = new BindingList<Race>() { event1Race1, event1Race2, event1Race3 };
            event2.races = new BindingList<Race>() { event2Race1, event2Race2, event2Race3 };

            EventEntry eve1 = new EventEntry();
            eve1.competitor = cmp;
            eve1.eventID = event1.ID;
            eve1.className = "250cc";

            EventEntry eve2 = new EventEntry();
            eve2.competitor = cmp2;
            eve2.eventID = event1.ID;
            eve2.className = "250cc";

            eventEntries.Add(eve1);
            eventEntries.Add(eve2);

            LoadTagFile("");
        }
Ejemplo n.º 3
0
        private void addEventButtonClicked(object sender, EventArgs e)
        {
            //add a new event with empty fields
            ClearControls();
            Event newEvent = new Event();
            newEvent.name = "New Event";
            DataManager.Instance.Events.Add(newEvent);
            eventsDataGridView.DataSource = DataManager.Instance.Events;
            //set selection of the new event in the grid
            for (int i = 0; i < eventsDataGridView.Rows.Count; i++)
            {
                eventsDataGridView.Rows[i].Selected = false;
            }
            eventsDataGridView.Rows[eventsDataGridView.Rows.Count - 1].Selected = true;

            if (eventDatesGridView.Columns != null)
            {
                for (int i = 1; i < eventDatesGridView.Columns.Count; i++)
                    eventDatesGridView.Columns[i].Visible = false;
            }

            DataManager.Instance.SerializeData();
        }