示例#1
0
        public void GivePoints(LinkedList <Driver> eindstand) //takes the list of finished drivers and makes DriverPoints objects,
        {                                                     //allocates points and adds them to the List<T>
            //List<IDataTemplate> list = new List<IDataTemplate>();
            int x = eindstand.Count;

            for (int i = 0; i < x; i++)
            {
                DriverPoints ptsdriver = new DriverPoints();
                ptsdriver.Name = eindstand.First.Value.Name;
                eindstand.RemoveFirst(); //x--;
                if (i == 0)
                {
                    ptsdriver.Points = 3;
                }
                if (i == 1)
                {
                    ptsdriver.Points = 2;
                }
                if (i >= 2)
                {
                    ptsdriver.Points = 1;
                }
                DriverPoints.AddItemToList(ptsdriver);
            }
        }
示例#2
0
        //add points to the drivers based on dictionary with key as finish position
        public void AddPointsToDirvers(Dictionary <int, string> FinishPosition)
        {
            int points = 0;

            foreach (KeyValuePair <int, string> position in  FinishPosition)
            {
                switch (position.Key)
                {
                case 1:
                    points = 25;
                    break;

                case 2:
                    points = 20;
                    break;

                case 3:
                    points = 18;
                    break;

                case 4:
                    points = 15;
                    break;

                case 5:
                    points = 10;
                    break;

                case 6:
                    points = 5;
                    break;

                default:
                    points = 0;
                    break;
                }
                DriverPoints.AddItemToList(new DriverPoints(position.Value, points));
            }
        }