Esempio n. 1
0
 private void LoadRiders()
 {
     FileReader Reader = new FileReader();
     IList<String> Headers = new List<string>();
     IDictionary<int, IList<string>> Rows = new Dictionary<int, IList<string>>();
     if (Reader.Read(@"C:\temp\riders.modified.csv", Headers, Rows))
     {
         foreach (KeyValuePair<int, IList<String>> KV in Rows)
         {
             String CatName = mCategories.First(x => x.Value == KV.Value[2]).Key;
             String ClubName = mClubs.First(x => x.Value == KV.Value[3]).Key;
             String Number = KV.Value[4];
             String T = KV.Value[1] + ClubName + CatName;
             if (mRiders.Contains(T) == false)
                 AddRider(KV.Value[1], ClubName, CatName, Number);
         }
     }
 }
Esempio n. 2
0
        internal IDictionary<String, String> GetCategories()
        {
            if (mDataBaseConnection != null)
            {
                DataTable DataTable = GetRaceDataTable(mDataBaseConnection, "*", "category");
                IDictionary<String, String> Categories = new Dictionary<String, String>();

                foreach (DataRow Row in DataTable.Rows)
                    Categories.Add(Row["cat"].ToString(), Row["idcategory"].ToString());

                FileWriter FileWriter = new Race.FileWriter();
                FileWriter.Write(@"c:\temp\categories.csv", DataTable, true);

                FileReader Reader = new FileReader();
                IList<String> Headers = new List<string>();
                IDictionary<int, IList<string>> Rows = new Dictionary<int, IList<string>>();
                if (Reader.Read(@"C:\temp\categories.updated.csv", Headers, Rows))
                {
                    foreach (KeyValuePair<int, IList<String>> KV in Rows)
                    {
                        if (Categories.Keys.Contains(KV.Value[1]) == false)
                        {
                            AddCategory(KV.Value[1]);
                        }
                    }
                }
                return Categories;
            }
            return null;
        }