public override void Run(HouseholdKey key, object o) { var hh = (ResultFileEntry)o; if (!_isTableCreated) { SaveableEntry se = GetStandardSaveableEntry(key); se.AddRow(RowBuilder.Start("Name", Constants.GeneralHouseholdKey) .Add("Json", JsonConvert.SerializeObject(hh, Formatting.Indented)).ToDictionary()); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); _isTableCreated = true; } else { var row = RowBuilder.Start("Name", Constants.GeneralHouseholdKey) .Add("Json", JsonConvert.SerializeObject(hh, Formatting.Indented)).ToDictionary(); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveDictionaryToDatabaseNewConnection(row, TableName, Constants.GeneralHouseholdKey); } }
public override void Run(HouseholdKey key, object o) { var hh = (HouseholdKeyEntry)o; //check for duplicates if (!_savedKeys.Add(hh.HHKey)) { return; //throw new LPGException("Householdkey already existed"); } if (!_isTableCreated) { SaveableEntry se = GetStandardSaveableEntry(key); se.AddRow(RowBuilder.Start("Name", hh.HHKey) .Add("Json", JsonConvert.SerializeObject(hh, Formatting.Indented)).ToDictionary()); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); _isTableCreated = true; return; } var dict = RowBuilder.Start("Name", hh.HHKey) .Add("Json", JsonConvert.SerializeObject(hh, Formatting.Indented)).ToDictionary(); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveDictionaryToDatabaseNewConnection(dict, TableName, Constants.GeneralHouseholdKey); }