Beispiel #1
0
        public static void ProcessClubData(OdbcDataReader reader)
        {
            int ClubCountFile = 0, ClubCountDB = 0;

            logger.Info("Started Processing Club Details");
            List <ClubEntity> sList = new List <ClubEntity>();

            while (reader.Read())
            {
                sList.Add(
                    new ClubEntity()
                {
                    ClubCode = reader["Team_abbr"].ToString(),
                    ClubName = reader["Team_name"].ToString()
                });
            }
            List <ClubEntity> dList = new List <ClubEntity>();

            ClubCountFile = sList.Count;
            dList         = ClubRepo.GetClubs();

            List <ClubEntity> newClub = sList.Except(dList).ToList();

            ClubCountDB = newClub.Count;
            if (newClub.Count != 0)
            {
                foreach (ClubEntity x in newClub)
                {
                    ClubRepo.AddClub(x);
                }
            }
            logger.Info($"Total Clubs in File :{ ClubCountFile }");
            logger.Info($"New Clubs added to Database :{ ClubCountDB }");
            logger.Info("Processing Club Details Completed");
        }
Beispiel #2
0
        public static void ProcessClubData(OdbcDataReader reader)
        {
            logger.Info("Started Processing Club Details");
            while (reader.Read())
            {
                ClubEntity club = new ClubEntity();
                club.ClubCode = reader["Team_abbr"].ToString();
                club.ClubName = reader["Team_name"].ToString();

                try
                {
                    ClubRepo.AddClub(club);
                }
                catch (Exception e)
                {
                    if (e.Message.Contains("Violation of PRIMARY KEY constraint"))
                    {
                        logger.Info("Duplicate:" + club.ClubCode);
                    }
                }

                finally { }
            }
            logger.Info("Processing Club Details Completed");
        }