Пример #1
0
        public ImportResults DoImport(DataSet ds)
        {
            buildDictionary(ds);

            ImportResults impRes = new ImportResults();

            // Update the points for all participants in the race
            foreach (var rp in _race.GetParticipants())
            {
                string key = string.Format("{0}_{1}", rp.Code, rp.SvId);

                try
                {
                    DataRow row    = _id2row[key];
                    double  points = _partImportUtils.GetPoints(row);
                    rp.Points = points;
                    impRes.AddSuccess();
                }
                catch (KeyNotFoundException)
                {
                    rp.Points = 99999.99;
                    impRes.AddError(string.Format("{0} (SvId: {1}) ist nicht der der Punktedatei. Punkte wurden auf {2:0.00} gesetzt", rp.Fullname, rp.SvId, rp.Points));
                }
                catch (Exception)
                {
                    impRes.AddError();
                }
            }

            return(impRes);
        }
Пример #2
0
        public ImportResults DoImport(DataSet ds)
        {
            ImportResults impRes = new ImportResults();

            var rows = ds.Tables[0].Rows;

            foreach (DataRow row in rows)
            {
                try
                {
                    RaceParticipant rp = ImportRow(row);
                    impRes.AddSuccess();
                }
                catch (Exception)
                {
                    impRes.AddError();
                }
            }

            return(impRes);
        }