public void loadAttendance() { using (var webClient = new System.Net.WebClient()) { List <BulkLoader> attend = new List <BulkLoader>(); string json = webClient.DownloadString(Constants.RAID_ATTENDANCE_URL); JsonTextReader reader = new JsonTextReader(new StringReader(json)); while (reader.Read()) { if (JsonToken.StartObject.Equals(reader.TokenType)) { RosterAttendence r = new RosterAttendence(); reader.Read(); reader.Read(); r.thirty = reader.Value.ToString(); reader.Read(); reader.Read(); r.sixty = reader.Value.ToString(); reader.Read(); reader.Read(); r.ninety = reader.Value.ToString(); reader.Read(); reader.Read(); reader.Read(); reader.Read(); r.name = reader.Value.ToString(); attend.Add(r); } } DBManager.getManager().emptyTable("attendance"); DBManager.getManager().bulkInsert(attend, "attendance"); } }
public void loadAttendance() { using (var webClient = new System.Net.WebClient()) { List<BulkLoader> attend = new List<BulkLoader>(); string json = webClient.DownloadString(Constants.RAID_ATTENDANCE_URL); JsonTextReader reader = new JsonTextReader(new StringReader(json)); while (reader.Read()) { if (JsonToken.StartObject.Equals(reader.TokenType)) { RosterAttendence r = new RosterAttendence(); reader.Read(); reader.Read(); r.thirty = reader.Value.ToString(); reader.Read(); reader.Read(); r.sixty = reader.Value.ToString(); reader.Read(); reader.Read(); r.ninety = reader.Value.ToString(); reader.Read(); reader.Read(); reader.Read(); reader.Read(); r.name = reader.Value.ToString(); attend.Add(r); } } DBManager.getManager().emptyTable("attendance"); DBManager.getManager().bulkInsert(attend, "attendance"); } }