コード例 #1
0
        private List <BO.Inscription> BuildInscriptionList(DbDataReader reader)
        {
            List <BO.Inscription> list = new List <BO.Inscription>();

            while (reader.Read())
            {
                var inscriptionId = reader.GetInt32(reader.GetOrdinal("Id"));

                BO.Inscription i;
                if (list.All(x => x.Id != inscriptionId))
                {
                    i = new BO.Inscription
                    {
                        Id                 = inscriptionId,
                        IdParticipant      = reader.GetInt32(reader.GetOrdinal("IdParticipant")),
                        IdCourse           = reader.GetInt32(reader.GetOrdinal("IdCourse")),
                        IdSuiviInscription = reader.GetInt32(reader.GetOrdinal("IdSuiviInscription")),
                        NumClassement      = reader.GetInt32(reader.GetOrdinal("NumClassement")),
                        Temps              = DateTimeToTimeSpan(reader.GetDateTime(reader.GetOrdinal("Temps"))),
                    };
                    list.Add(i);
                }
                else
                {
                    i = list.Single(x => x.Id == inscriptionId);
                }
            }

            return(list);
        }
コード例 #2
0
        public static InscriptionModel ToModel(this BO.Inscription bo)
        {
            if (bo == null)
            {
                return(null);
            }

            return(new InscriptionModel
            {
                Id = bo.Id,
                IdCourse = bo.IdCourse,
                IdParticipant = bo.IdParticipant,
                IdSuiviInscription = bo.IdSuiviInscription,
                NumClassement = bo.NumClassement,
                Temps = bo.Temps,
                Competitor = bo.Competitor.ToModel()
            });
        }