Exemple #1
0
        private void AddOrder(FlowOrder order)
        {
            FlowOrderCollection l = this.m_Map.GetItemExact(order.Iteration, order.Timestep);

            if (l == null)
            {
                l = new FlowOrderCollection();
                this.m_Map.AddItem(order.Iteration, order.Timestep, l);
            }

            l.Add(order);
            this.m_HasItems = true;
        }
Exemple #2
0
        private void FillFlowOrders()
        {
            Debug.Assert(this.m_FlowOrders.Count == 0);
            DataSheet ds = this.ResultScenario.GetDataSheet(Constants.DATASHEET_FLOW_ORDER);

            foreach (DataRow dr in ds.GetData().Rows)
            {
                int?   Iteration  = null;
                int?   Timestep   = null;
                int    FlowTypeId = 0;
                double?Order      = null;

                if (dr[Constants.ITERATION_COLUMN_NAME] != DBNull.Value)
                {
                    Iteration = Convert.ToInt32(dr[Constants.ITERATION_COLUMN_NAME], CultureInfo.InvariantCulture);
                }

                if (dr[Constants.TIMESTEP_COLUMN_NAME] != DBNull.Value)
                {
                    Timestep = Convert.ToInt32(dr[Constants.TIMESTEP_COLUMN_NAME], CultureInfo.InvariantCulture);
                }

                FlowTypeId = Convert.ToInt32(dr[Constants.FLOW_TYPE_ID_COLUMN_NAME], CultureInfo.InvariantCulture);

                if (dr[Constants.DATASHEET_FLOW_ORDER_ORDER_COLUMN_NAME] != DBNull.Value)
                {
                    Order = Convert.ToDouble(dr[Constants.DATASHEET_FLOW_ORDER_ORDER_COLUMN_NAME], CultureInfo.InvariantCulture);
                }

                try
                {
                    FlowOrder Item = new FlowOrder(Iteration, Timestep, FlowTypeId, Order);
                    this.m_FlowOrders.Add(Item);
                }
                catch (Exception ex)
                {
                    throw new ArgumentException(ds.DisplayName + " -> " + ex.Message);
                }
            }
        }