public void addMonthlyRecord(int scode, VariableMonthly vm) { var s = stations.Find(x => x.code == scode); if (s.variablesMonthly.Exists(x => x.variableName == vm.variableName)) { var wtf = 0; } else { s.variablesMonthly.Add(vm); } }
public async Task monthlySummary() { List <string> collNames = MongoTools.collectionNames(db); string firstletter = ""; string vname = ""; int stationcode = 0; string source = ""; int freq = 0; int count = 0; foreach (string collection in collNames) { //all station record collections start with an s_ string[] parts = collection.Split('_'); firstletter = parts[0]; if (firstletter == "s") { stationcode = Convert.ToInt32(parts[1]); vname = parts[4]; if (vname == "PA") { continue; } source = parts[2]; freq = Convert.ToInt32(parts[5]); if (source.Contains("IDEAM")) { source = "IDEAM"; } else { source = "NOAA"; } VariableMeta meta = AnnualSummary.getVariableMetaFromDB(vname, source, db); VariableMonthly vm = new VariableMonthly(vname, freq); addStation(stationcode); addMonthlyRecord(stationcode, vm); await sortByDate(stationcode, collection, meta); count++; } } insertManyMonthlySummary(); }
public void addVariableMonthly(VariableMonthly vm) { variablesMonthly.Add(vm); }