Example #1
0
		private void TryAddMultiplier(FlowMultiplier item)
		{
			try
			{
                List<FlowMultiplier> l = base.GetItemExact(
                    item.FlowGroupId, 
                    item.StratumId, item.SecondaryStratumId, item.TertiaryStratumId, 
                    item.StateClassId, item.Iteration, item.Timestep);

                if (l == null)
                {
                    l = new List<FlowMultiplier>();

                    base.AddItem(
                        item.FlowGroupId, 
                        item.StratumId, item.SecondaryStratumId, item.TertiaryStratumId, 
                        item.StateClassId, item.Iteration, item.Timestep, l);
                }

                l.Add(item);
                base.SetHasItems();
			}
			catch (StockFlowMapDuplicateItemException)
			{
				string template = 
                    "A duplicate flow multiplier was detected: More information:" + 
                    Environment.NewLine + 
                    "Flow Group={0}, {1}={2}, {3}={4}, {5}={6}, State Class={7}, Iteration={8}, Timestep={9}.";

                ExceptionUtils.ThrowArgumentException(template, 
                    this.GetFlowGroupName(item.FlowGroupId), 
                    this.PrimaryStratumLabel, this.GetStratumName(item.StratumId), 
                    this.SecondaryStratumLabel, this.GetSecondaryStratumName(item.SecondaryStratumId), 
                    this.TertiaryStratumLabel, this.GetTertiaryStratumName(item.TertiaryStratumId), 
                    this.GetStateClassName(item.StateClassId), 
                    StockFlowMapBase.FormatValue(item.Iteration), 
                    StockFlowMapBase.FormatValue(item.Timestep));         
			}
		}
Example #2
0
 private void TryAddItem(FlowLateralMultiplier item)
 {
     try
     {
         this.AddItem(item.FlowGroupId, item.Iteration, item.Timestep, item);
     }
     catch (StockFlowMapDuplicateItemException)
     {
         string template = "A duplicate flow lateral multiplier was detected: More information:" + Environment.NewLine + "Flow Group={0}, Iteration={1}, Timestep={2}";
         ExceptionUtils.ThrowArgumentException(template, this.GetFlowGroupName(item.FlowGroupId), StockFlowMapBase.FormatValue(item.Iteration), StockFlowMapBase.FormatValue(item.Timestep));
     }
 }
Example #3
0
 private void TryAddLimit(StockLimit item)
 {
     try
     {
         base.AddItem(item.StockTypeId, item.StratumId, item.SecondaryStratumId, item.TertiaryStratumId, item.StateClassId, item.Iteration, item.Timestep, item);
     }
     catch (StockFlowMapDuplicateItemException)
     {
         string template = "A duplicate stock limit was detected: More information:" + Environment.NewLine + "Stock Type={0}, {1}={2}, {3}={4}, {5}={6}, State Class={7}, Iteration={8}, Timestep={9}.";
         ExceptionUtils.ThrowArgumentException(template, this.GetStockTypeName(item.StockTypeId), this.PrimaryStratumLabel, this.GetStratumName(item.StratumId), this.SecondaryStratumLabel, this.GetSecondaryStratumName(item.SecondaryStratumId), this.TertiaryStratumLabel, this.GetTertiaryStratumName(item.TertiaryStratumId), this.GetStateClassName(item.StateClassId), StockFlowMapBase.FormatValue(item.Iteration), StockFlowMapBase.FormatValue(item.Timestep));
     }
 }