Esempio n. 1
0
 private void SaveRiders()
 {
     DataTable DataTable = GetRaceDataTable(mDataBaseConnection, "*", "rider");
     FileWriter FileWriter = new Race.FileWriter();
     FileWriter.Write(@"c:\temp\riders.csv", DataTable, true);
 }
Esempio n. 2
0
        internal IEnumerable<RaceInfo> GetRaces()
        {
            if (mDataBaseConnection != null)
            {
                DataTable DataTable = GetRaceDataTable(mDataBaseConnection, "*", "races");
                IList<RaceInfo> Races = new List<RaceInfo>();
                mRaceIds.Clear();
                foreach (DataRow Row in DataTable.Rows)
                {
                    Races.Add(new RaceInfo() { Laps = Row["laps"].ToString(), Type = Row["type"].ToString(), Name = Row["race"].ToString() });
                    mRaceIds.Add(Row["race"].ToString(), UInt32.Parse(Row["idrace"].ToString()));
                }

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

                        /*
                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\race.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 null;
        }
Esempio n. 3
0
        internal IDictionary<String, String> GetClubs()
        {
            if (mDataBaseConnection != null)
            {
                DataTable DataTable = GetRaceDataTable(mDataBaseConnection, "*", "club");

                IDictionary<String, String> Clubs = new Dictionary<String, String>();
                foreach (DataRow Row in DataTable.Rows)
                    Clubs.Add(Row["name"].ToString(), Row["idclub"].ToString());

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

                DataTable.Columns[0].ColumnName = "Name";
                return Clubs;
            }
            return null;
        }
Esempio n. 4
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;
        }
Esempio n. 5
0
        internal IDictionary<String, int> GetRaceTypes()
        {
            if (mDataBaseConnection != null)
            {
                DataTable DataTable = GetRaceDataTable(mDataBaseConnection, "*", "racetype");

                IDictionary<String, int> RaceTypes = new Dictionary<String, int>();
                foreach (DataRow Row in DataTable.Rows)
                    RaceTypes.Add(Row["type"].ToString(), Int32.Parse(Row["idracetype"].ToString()));

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

                DataTable.Columns[0].ColumnName = "Type";
                DataTable.Columns[1].ColumnName = "Id";
                return RaceTypes;
            }
            return null;
        }