Esempio n. 1
0
        private void ViewData_Load(object sender, EventArgs e)
        {
            IEqualityComparer <worldDriverProfile> wdpc = new worldDriverProfileComparer();

            personas.Items.AddRange(wllist.Select(x => x.persona.DriverProfile).Distinct(wdpc).OrderBy(x => x.name).Select(x => x.name).ToArray <string>());

            events.Items.AddRange(wle.Events.OrderBy(x => x.eventName).Select(x => x.eventName).ToArray <string>());

            eventmodes.Items.AddRange(wle.Events.Select(x => getEventModeName(x.eventModeId)).Distinct().ToArray <string>());

            IEqualityComparer <worldCars> wcc = new worldCarsComparer();

            cars.Items.AddRange(wllist.Select(x => x.car).Distinct(wcc).OrderBy(x => (x.make + " " + x.carName)).Select(x => (x.make + " " + x.carName)).ToArray <string>());

            fromDate.Value = wllist.Min(x => x.createdDate.dateTime).Date;
            toDate.Value   = wllist.Max(x => x.createdDate.dateTime).Date;

            dataGridView1.DataSource = getFilteredList();
        }
Esempio n. 2
0
        public void UpdateList(worldLeaderboardEvents _wle, List <worldLeaderboards> _wllist)
        {
            wle    = _wle;
            wllist = _wllist;
            IEqualityComparer <worldDriverProfile> wdpc = new worldDriverProfileComparer();
            IEqualityComparer <worldCars>          wcc  = new worldCarsComparer();

            var plist = new List <string>();

            foreach (string str in personas.CheckedItems)
            {
                plist.Add(str);
            }
            personas.Tag = plist;
            var elist = new List <string>();

            foreach (string str in events.CheckedItems)
            {
                elist.Add(str);
            }
            events.Tag = elist;
            var emlist = new List <string>();

            foreach (string str in eventmodes.CheckedItems)
            {
                emlist.Add(str);
            }
            eventmodes.Tag = emlist;
            var clist = new List <string>();

            foreach (string str in cars.CheckedItems)
            {
                clist.Add(str);
            }
            cars.Tag = clist;

            personas.Items.Clear();
            events.Items.Clear();
            eventmodes.Items.Clear();
            cars.Items.Clear();

            personas.Items.AddRange(wllist.Select(x => x.persona.DriverProfile).Distinct(wdpc).OrderBy(x => x.name).Select(x => x.name).ToArray <string>());
            events.Items.AddRange(wle.Events.OrderBy(x => x.eventName).Select(x => x.eventName).ToArray <string>());
            eventmodes.Items.AddRange(wle.Events.Select(x => getEventModeName(x.eventModeId)).Distinct().ToArray <string>());
            cars.Items.AddRange(wllist.Select(x => x.car).Distinct(wcc).OrderBy(x => (x.make + " " + x.carName)).Select(x => (x.make + " " + x.carName)).ToArray <string>());

            var arr = new[] { personas, events, eventmodes, cars };

            foreach (CheckedListBox o in arr)
            {
                for (int i = 0; i < o.Items.Count; i++)
                {
                    o.SetItemChecked(i, (o.Tag as List <string>).Contains(o.Items[i]));
                }
            }


            //fromDate.Value = wllist.Min(x => x.createdDate.dateTime).Date;
            //toDate.Value = wllist.Max(x => x.createdDate.dateTime).Date;

            dataGridView1.DataSource = getFilteredList();
        }