public double GetActualDeathValue(int jurisdictionId, int iteration, int timestep) { ActualDeath Item = this.GetActualDeath(jurisdictionId, iteration, timestep); if (Item != null) { return(Item.CurrentValue.Value); } else { return(1.0); } }
private void FillActualDeathCollection(DateTime startDate) { Debug.Assert(this.m_ActualDeaths.Count == 0); DataSheet ds = this.ResultScenario.GetDataSheet(Shared.DATASHEET_ACTUAL_DEATH_NAME); foreach (DataRow dr in ds.GetData().Rows) { int?timestep = null; if (!TimestepFromDateTime(dr, startDate, out timestep)) { continue; } DistributionFrequency?df = null; if (dr[Shared.DISTRIBUTION_FREQUENCY_COLUMN_NAME] != DBNull.Value) { df = (DistributionFrequency)(long)dr[Shared.DISTRIBUTION_FREQUENCY_COLUMN_NAME]; } ActualDeath Item = new ActualDeath( Shared.GetNullableInt(dr, Shared.ITERATION_COLUMN_NAME), timestep, Shared.GetNullableInt(dr, Shared.JURISDICTION_COLUMN_NAME), Shared.GetNullableDouble(dr, Shared.VALUE_COLUMN_NAME), Shared.GetNullableInt(dr, Shared.DISTRIBUTION_TYPE_COLUMN_NAME), df, Shared.GetNullableDouble(dr, Shared.DISTRIBUTIONSD_COLUMN_NAME), Shared.GetNullableDouble(dr, Shared.DISTRIBUTIONMIN_COLUMN_NAME), Shared.GetNullableDouble(dr, Shared.DISTRIBUTIONMAX_COLUMN_NAME)); try { this.m_DistributionProvider.Validate( Item.DistributionTypeId, Item.DistributionValue, Item.DistributionSD, Item.DistributionMin, Item.DistributionMax); this.m_ActualDeaths.Add(Item); } catch (Exception ex) { throw new ArgumentException(ds.DisplayName + " -> " + ex.Message); } } }
private void TryAddItem(ActualDeath item) { if (this.m_Map.GetItemExact(item.JurisdictionId, item.Iteration, item.Timestep) != null) { string template = "A duplicate death was detected: More information:" + Environment.NewLine + "Jurisdiction={0}, Iteration={1}, Timestep={2}"; Shared.ThrowEpidemicException(template, this.GetJurisdictionName(item.JurisdictionId), MapBase.FormatValue(item.Iteration), MapBase.FormatValue(item.Timestep)); } this.m_Map.AddItem(item.JurisdictionId, item.Iteration, item.Timestep, item); this.SetHasItems(); }