private void cmbEvent_SelectedValueChanged(object sender, EventArgs e) { EventEntry evt = (EventEntry)cmbEvent.SelectedItem; if (evt != null) { if (evt.tier.Equals("0") || evt.tier.Equals("1")) { chkRot.Checked = true; } else { // TODO Maybe not do this... chkRot.Checked = false; } } filterItemList(); }
public void loadEvents() { events.Clear(); // Get the first worksheet of the first spreadsheet. // TODO: Choose a worksheet more intelligently based on your // app's needs. WorksheetFeed wsFeed = spreadsheet.Worksheets; // Get the Event list worksheet WorksheetEntry worksheet = (WorksheetEntry)wsFeed.Entries.ToList().Find(new Predicate<AtomEntry>(findEventsWorkSheet)); // Define the URL to request the list feed of the worksheet. AtomLink listFeedLink = worksheet.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null); // Fetch the list feed of the worksheet. ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString()); listQuery.OrderByColumn = EVENT_SHORT_COL; ListFeed listFeed = GDriveManager.getService().Query(listQuery); List<BulkLoader> rows = new List<BulkLoader>(); // Iterate through each row, printing its cell values. foreach (ListEntry row in listFeed.Entries) { // Print the first column's cell value //logger.Debug(row.Title.Text); EventEntry evt = new EventEntry(); // Iterate over the remaining columns, and print each cell value foreach (ListEntry.Custom element in row.Elements) { //logger.Debug(element.Value); switch (element.LocalName.ToLower()) { case EVENT_EVENT_COL: evt.eventName = element.Value; break; case EVENT_SHORT_COL: evt.shortName = element.Value; break; case EVENT_TIER_COL: evt.tier = element.Value; break; } } events.Add(evt); rows.Add(evt); } DBManager.getManager().bulkInsert(rows, "events"); logger.Info("Events loaded successfully. " + events.Count + " entries."); }