Exemple #1
0
        public virtual List <RezultatUkupnoExtended> getRezultatiExtended(IList <Ocena> ocene, bool prikaziDEOcene,
                                                                          bool zaPreskokVisebojRacunajBoljuOcenu)
        {
            if (prikaziDEOcene)
            {
                IDictionary <int, RezultatUkupnoExtended> rezultatiMap = new Dictionary <int, RezultatUkupnoExtended>();
                foreach (RezultatUkupno r in Rezultati)
                {
                    RezultatUkupnoExtended rezEx = new RezultatUkupnoExtended(r);
                    rezultatiMap.Add(rezEx.Gimnasticar.Id, rezEx);
                }

                foreach (Ocena o in ocene)
                {
                    if (rezultatiMap.ContainsKey(o.Gimnasticar.Id))
                    {
                        float?d;
                        float?e;
                        if (o.Sprava != Sprava.Preskok || !zaPreskokVisebojRacunajBoljuOcenu || o.Ocena2 == null ||
                            Math.Max(o.Total.Value, o.Ocena2.Total.Value) == o.Total.Value)
                        {
                            d = o.D;
                            e = o.E;
                        }
                        else
                        {
                            d = o.Ocena2.D;
                            e = o.Ocena2.E;
                        }
                        RezultatUkupnoExtended r = rezultatiMap[o.Gimnasticar.Id];
                        r.setDOcena(o.Sprava, d);
                        r.setEOcena(o.Sprava, e);
                    }
                }

                List <RezultatUkupnoExtended> result = new List <RezultatUkupnoExtended>(rezultatiMap.Values);

                PropertyDescriptor propDesc = TypeDescriptor.GetProperties(typeof(RezultatUkupnoExtended))["RedBroj"];
                result.Sort(new SortComparer <RezultatUkupnoExtended>(propDesc, ListSortDirection.Ascending));

                return(result);
            }
            else
            {
                List <RezultatUkupnoExtended> result = new List <RezultatUkupnoExtended>();
                foreach (RezultatUkupno r in getRezultati())
                {
                    result.Add(new RezultatUkupnoExtended(r));
                }
                return(result);
            }
        }
Exemple #2
0
        public virtual List<RezultatUkupnoExtended> getRezultatiExtended(IList<Ocena> ocene, bool prikaziDEOcene)
        {
            if (prikaziDEOcene)
            {
                IDictionary<int, RezultatUkupnoExtended> rezultatiMap = new Dictionary<int, RezultatUkupnoExtended>();
                foreach (RezultatUkupno rez in Rezultati)
                {
                    RezultatUkupnoExtended rezEx = new RezultatUkupnoExtended(rez);
                    rezultatiMap.Add(rezEx.Gimnasticar.Id, rezEx);
                }

                foreach (Ocena o in ocene)
                {
                    if (rezultatiMap.ContainsKey(o.Gimnasticar.Id))
                    {
                        rezultatiMap[o.Gimnasticar.Id].setDOcena(o.Sprava, o.D);
                        rezultatiMap[o.Gimnasticar.Id].setEOcena(o.Sprava, o.E);
                    }
                }

                List<RezultatUkupnoExtended> result = new List<RezultatUkupnoExtended>(rezultatiMap.Values);

                PropertyDescriptor propDesc =
                    TypeDescriptor.GetProperties(typeof(RezultatUkupnoExtended))["RedBroj"];
                result.Sort(new SortComparer<RezultatUkupnoExtended>(propDesc,
                    ListSortDirection.Ascending));

                return result;
            }
            else
            {
                List<RezultatUkupnoExtended> result = new List<RezultatUkupnoExtended>();
                foreach (RezultatUkupno r in getRezultati())
                    result.Add(new RezultatUkupnoExtended(r));
                return result;
            }
        }