/// <summary> /// Make an API call to the Jira server, save the targeted information /// in a local cache, and make its results available to the application /// within a <c>List<FieldsModel></c> object. /// </summary> private void updateCache() { //Fetch the list of available fields Object fields = Jira.RPC(API_FIELD_LIST); IEnumerable<Object> fieldList = fields as IEnumerable<Object>; //Search for the desired field name in the list int found = 0; string name; foreach (Dictionary<String, Object> field in fieldList) { name = field["name"] as string; //Log the desired field if (name == EPIC_FIELD_NAME || name == SPRINT_FIELD_NAME) { //Collect the data FieldsModel fm = new FieldsModel(); fm.ID = field["id"] as string; fm.Name = name; //Log the transaction List.Add(fm); ++found; } //Don't over iterate! if (found == 2) break; } //Write these values to the database file SW.WriteLine(List[0].ID); SW.WriteLine(List[0].Name); SW.WriteLine(List[1].ID); SW.WriteLine(List[1].Name); //Close the StreamWriter SW.Close(); }
/// <summary> /// Fetch field data from the local cache file and make its results /// available to the application within a <c>List<FieldsModel></c> object. /// </summary> private void extractFields() { //First field FieldsModel fm1 = new FieldsModel(); fm1.ID = SR.ReadLine() as string; fm1.Name = SR.ReadLine() as string; //Second field FieldsModel fm2 = new FieldsModel(); fm2.ID = SR.ReadLine() as string; fm2.Name = SR.ReadLine() as string; //Make these values publicly available List.Add(fm1); List.Add(fm2); //Close the StreamReader SR.Close(); }