示例#1
0
        private void RefreshNonCalculatedValues()
        {
            DataRow drProp = this.DataFeed.GetDataSheet(Strings.DATASHEET_SPPIC_NAME).GetDataRow();

            if (drProp == null)
            {
                return;
            }

            this.CheckBoxCellSizeOverride.Checked   = DataTableUtilities.GetDataBool(drProp[Strings.DATASHEET_SPPIC_CELL_AREA_OVERRIDE_COLUMN_NAME]);
            this.CheckBoxCellSizeOverride.Enabled   = true;
            this.CheckBoxCellSizeOverride.AutoCheck = true;

            int    NumRows      = DataTableUtilities.GetDataInt(drProp[Strings.DATASHEET_SPPIC_NUM_ROWS_COLUMN_NAME]);
            int    NumCols      = DataTableUtilities.GetDataInt(drProp[Strings.DATASHEET_SPPIC_NUM_COLUMNS_COLUMN_NAME]);
            float  CellArea     = DataTableUtilities.GetDataSingle(drProp[Strings.DATASHEET_SPPIC_CELL_SIZE_COLUMN_NAME]);
            double cellAreaCalc = DataTableUtilities.GetDataDbl(drProp[Strings.DATASHEET_SPPIC_CELL_AREA_COLUMN_NAME]);

            this.TextBoxNumRows.Text      = NumRows.ToString(CultureInfo.InvariantCulture);
            this.TextBoxNumColumns.Text   = NumCols.ToString(CultureInfo.InvariantCulture);
            this.TextBoxCellArea.Text     = CellArea.ToString("N4", CultureInfo.InvariantCulture);
            this.TextBoxCellAreaCalc.Text = cellAreaCalc.ToString("N4", CultureInfo.InvariantCulture);
        }
示例#2
0
        public void Initialize(Project project, string selectedStratum)
        {
            this.DataGridViewStrata.BackgroundColor          = System.Drawing.Color.White;
            this.DataGridViewStrata.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
            this.DataGridViewStrata.PaintGridBorders         = false;
            this.PanelGrid.ShowBorder = true;

            DataSheet ds             = project.GetDataSheet(Strings.DATASHEET_STRATA_NAME);
            DataView  dv             = new DataView(ds.GetData(), null, ds.DisplayMember, DataViewRowState.CurrentRows);
            bool      AtLeastOneDesc = false;

            this.DataGridViewStrata.Rows.Add(Strings.DIAGRAM_ALL_STRATA_DISPLAY_NAME, null);

            foreach (DataRowView v in dv)
            {
                string n = Convert.ToString(v[ds.DisplayMember], CultureInfo.InvariantCulture);
                string d = DataTableUtilities.GetDataStr(v[Strings.DATASHEET_DESCRIPTION_COLUMN_NAME]);

                if (!string.IsNullOrEmpty(d))
                {
                    AtLeastOneDesc = true;
                }

                this.DataGridViewStrata.Rows.Add(n, d);
            }

            this.ButtonOK.Enabled           = (this.DataGridViewStrata.Rows.Count > 0);
            this.DataGridViewStrata.Enabled = (this.DataGridViewStrata.Rows.Count > 0);
            this.m_SelectedStratum          = selectedStratum;

            if (!AtLeastOneDesc)
            {
                this.ColumnDescription.Visible = false;
            }

            this.RefreshTitleBar(project);
        }
示例#3
0
        private static void AddChartGroupedAttributes(
            Dictionary <string, SyncroSimLayoutItem> groupsDict,
            DataSheet groupsDataSheet,
            DataView attrsView,
            DataSheet attrsDataSheet,
            string outputDataSheetName,
            string outputColumnName, bool skipTimestepZero)
        {
            //The density groups have already been created and added to the groups.  Howver, we want the
            //attributes themselves to appear before this group so we must insert them in reverse order.

            for (int i = attrsView.Count - 1; i >= 0; i--)
            {
                DataRowView drv = attrsView[i];

                if (drv.Row[Strings.DATASHEET_ATTRIBUTE_GROUP_ID_COLUMN_NAME] != DBNull.Value)
                {
                    int    GroupId   = Convert.ToInt32(drv.Row[Strings.DATASHEET_ATTRIBUTE_GROUP_ID_COLUMN_NAME], CultureInfo.InvariantCulture);
                    string GroupName = groupsDataSheet.ValidationTable.GetDisplayName(GroupId);
                    int    AttrId    = Convert.ToInt32(drv.Row[attrsDataSheet.ValueMember], CultureInfo.InvariantCulture);
                    SyncroSimLayoutItem MainGroup    = groupsDict[GroupName];
                    SyncroSimLayoutItem DensityGroup = groupsDict[DENSITY_GROUP_NAME + GroupName];
                    string Units = DataTableUtilities.GetDataStr(drv.Row, Strings.DATASHEET_STATE_ATTRIBUTE_TYPE_UNITS_COLUMN_NAME);

                    //Normal Attribute
                    //----------------

                    string AttrNameNormal    = string.Format(CultureInfo.InvariantCulture, "stsim_AttrNormal-{0}", AttrId);
                    string DisplayNameNormal = Convert.ToString(drv.Row[attrsDataSheet.ValidationTable.DisplayMember], CultureInfo.InvariantCulture);

                    if (Units != null)
                    {
                        DisplayNameNormal = string.Format(CultureInfo.InvariantCulture, "{0} ({1})", DisplayNameNormal, Units);
                    }

                    SyncroSimLayoutItem ItemNormal = new SyncroSimLayoutItem(AttrNameNormal, DisplayNameNormal, false);

                    ItemNormal.Properties.Add(new MetaDataProperty("dataSheet", outputDataSheetName));
                    ItemNormal.Properties.Add(new MetaDataProperty("column", outputColumnName));
                    ItemNormal.Properties.Add(new MetaDataProperty("prefixFolderName", "False"));
                    ItemNormal.Properties.Add(new MetaDataProperty("customTitle", GroupName + ": " + DisplayNameNormal));
                    ItemNormal.Properties.Add(new MetaDataProperty("defaultValue", "0.0"));

                    if (skipTimestepZero)
                    {
                        ItemNormal.Properties.Add(new MetaDataProperty("skipTimestepZero", "True"));
                    }

                    MainGroup.Items.Insert(0, ItemNormal);

                    //Density Attribute
                    //-----------------

                    string AttrNameDensity    = string.Format(CultureInfo.InvariantCulture, "stsim_AttrDensity-{0}", AttrId);
                    string DisplayNameDensity = Convert.ToString(drv.Row[attrsDataSheet.ValidationTable.DisplayMember], CultureInfo.InvariantCulture);

                    if (Units != null)
                    {
                        DisplayNameDensity = string.Format(CultureInfo.InvariantCulture, "{0} ({1})", DisplayNameDensity, Units);
                    }

                    SyncroSimLayoutItem ItemDensity = new SyncroSimLayoutItem(AttrNameDensity, DisplayNameDensity, false);

                    ItemDensity.Properties.Add(new MetaDataProperty("dataSheet", outputDataSheetName));
                    ItemDensity.Properties.Add(new MetaDataProperty("column", outputColumnName));
                    ItemDensity.Properties.Add(new MetaDataProperty("prefixFolderName", "False"));
                    ItemDensity.Properties.Add(new MetaDataProperty("customTitle", GroupName + " (Density): " + DisplayNameNormal));
                    ItemDensity.Properties.Add(new MetaDataProperty("defaultValue", "0.0"));

                    if (skipTimestepZero)
                    {
                        ItemDensity.Properties.Add(new MetaDataProperty("skipTimestepZero", "True"));
                    }

                    DensityGroup.Items.Insert(0, ItemDensity);
                }
            }
        }
示例#4
0
        private static void AddChartNonGroupedAttributes(
            SyncroSimLayoutItemCollection items,
            DataView attrsView,
            DataSheet attrsDataSheet,
            string outputDataSheetName,
            string outputColumnName,
            bool skipTimestepZero,
            SyncroSimLayoutItem densityGroup)
        {
            foreach (DataRowView drv in attrsView)
            {
                if (drv.Row[Strings.DATASHEET_ATTRIBUTE_GROUP_ID_COLUMN_NAME] == DBNull.Value)
                {
                    int    AttrId = Convert.ToInt32(drv.Row[attrsDataSheet.ValueMember], CultureInfo.InvariantCulture);
                    string Units  = DataTableUtilities.GetDataStr(drv.Row, Strings.DATASHEET_STATE_ATTRIBUTE_TYPE_UNITS_COLUMN_NAME);

                    //Normal Attribute
                    //----------------

                    string AttrNameNormal    = string.Format(CultureInfo.InvariantCulture, "stsim_AttrNormal-{0}", AttrId);
                    string DisplayNameNormal = Convert.ToString(drv.Row[attrsDataSheet.ValidationTable.DisplayMember], CultureInfo.InvariantCulture);

                    if (Units != null)
                    {
                        DisplayNameNormal = string.Format(CultureInfo.InvariantCulture, "{0} ({1})", DisplayNameNormal, Units);
                    }

                    SyncroSimLayoutItem ItemNormal = new SyncroSimLayoutItem(AttrNameNormal, DisplayNameNormal, false);

                    ItemNormal.Properties.Add(new MetaDataProperty("dataSheet", outputDataSheetName));
                    ItemNormal.Properties.Add(new MetaDataProperty("column", outputColumnName));
                    ItemNormal.Properties.Add(new MetaDataProperty("prefixFolderName", "False"));
                    ItemNormal.Properties.Add(new MetaDataProperty("customTitle", DisplayNameNormal));
                    ItemNormal.Properties.Add(new MetaDataProperty("defaultValue", "0.0"));

                    if (skipTimestepZero)
                    {
                        ItemNormal.Properties.Add(new MetaDataProperty("skipTimestepZero", "True"));
                    }

                    items.Add(ItemNormal);

                    //Density Attribute
                    //-----------------

                    string AttrNameDensity    = string.Format(CultureInfo.InvariantCulture, "stsim_AttrDensity-{0}", AttrId);
                    string DisplayNameDensity = Convert.ToString(drv.Row[attrsDataSheet.ValidationTable.DisplayMember], CultureInfo.InvariantCulture);

                    if (Units != null)
                    {
                        DisplayNameDensity = string.Format(CultureInfo.InvariantCulture, "{0} ({1})", DisplayNameDensity, Units);
                    }

                    SyncroSimLayoutItem ItemDensity = new SyncroSimLayoutItem(AttrNameDensity, DisplayNameDensity, false);

                    ItemDensity.Properties.Add(new MetaDataProperty("dataSheet", outputDataSheetName));
                    ItemDensity.Properties.Add(new MetaDataProperty("column", outputColumnName));
                    ItemDensity.Properties.Add(new MetaDataProperty("prefixFolderName", "False"));
                    ItemDensity.Properties.Add(new MetaDataProperty("customTitle", "(Density): " + DisplayNameNormal));
                    ItemDensity.Properties.Add(new MetaDataProperty("defaultValue", "0.0"));

                    if (skipTimestepZero)
                    {
                        ItemDensity.Properties.Add(new MetaDataProperty("skipTimestepZero", "True"));
                    }

                    densityGroup.Items.Add(ItemDensity);
                }
            }
        }
示例#5
0
        protected override void OnRowsModified(object sender, DataSheetRowEventArgs e)
        {
            List <DataRow> ModifyRows = new List <DataRow>();
            string         IdColName  = this.PrimaryKeyColumn.Name;
            Dictionary <string, DataRow> GroupRows     = this.CreateTGRowDictionary();
            Dictionary <string, bool>    ExistingNames = new Dictionary <string, bool>();

            foreach (string k in GroupRows.Keys)
            {
                ExistingNames.Add(k, true);
            }

            foreach (DataRow dr in this.m_TTData.Rows)
            {
                if (dr.RowState == DataRowState.Deleted)
                {
                    continue;
                }

                int id = Convert.ToInt32(dr[IdColName], CultureInfo.InvariantCulture);

                if (!this.m_PrevNames.ContainsKey(id))
                {
                    continue;
                }

                string OldName          = this.m_PrevNames[id];
                string OldAutoGroupName = GetAutoGeneratedGroupName(OldName);

                if (!GroupRows.ContainsKey(OldAutoGroupName))
                {
                    continue;
                }

                string NewName = Convert.ToString(dr[Strings.DATASHEET_NAME_COLUMN_NAME], CultureInfo.InvariantCulture);

                Debug.Assert(DataTableUtilities.GetDataBool(GroupRows[OldAutoGroupName], Strings.IS_AUTO_COLUMN_NAME));

                if (OldName != NewName)
                {
                    ModifyRows.Add(dr);
                }
            }

            if (ModifyRows.Count > 0)
            {
                this.m_TGDataSheet.BeginModifyRows();

                foreach (DataRow dr in ModifyRows)
                {
                    string OldName = this.m_PrevNames[Convert.ToInt32(dr[IdColName], CultureInfo.InvariantCulture)];
                    string NewName = Convert.ToString(dr[Strings.DATASHEET_NAME_COLUMN_NAME], CultureInfo.InvariantCulture);

                    Debug.Assert(OldName != NewName);
                    Debug.Assert(!GroupRows.ContainsKey(GetAutoGeneratedGroupName(NewName)));

                    string OldAutoGroupName = GetAutoGeneratedGroupName(OldName);
                    string NewAutoGroupName = GetAutoGeneratedGroupName(NewName);

                    GroupRows[OldAutoGroupName][Strings.DATASHEET_NAME_COLUMN_NAME] = NewAutoGroupName;
                }

                this.m_TGDataSheet.EndModifyRows();
            }

            base.OnRowsModified(sender, e);
        }
        private void RefreshCalculatedValues()
        {
            DataRow drProp = this.DataFeed.GetDataSheet(Strings.DATASHEET_SPPIC_NAME).GetDataRow();

            if (drProp == null)
            {
                return;
            }

            //Num Cells
            int NumCells = DataTableUtilities.GetDataInt(drProp[Strings.DATASHEET_SPPIC_NUM_CELLS_COLUMN_NAME]);

            this.TextBoxNumCells.Text = NumCells.ToString(CultureInfo.InvariantCulture);

            //Get the units and refresh the units labels - the default Raster Cell Units is Metres^2
            string          srcSizeUnits = DataTableUtilities.GetDataStr(drProp[Strings.DATASHEET_SPPIC_CELL_SIZE_UNITS_COLUMN_NAME]);
            string          srcAreaUnits = srcSizeUnits + "^2";
            string          amountlabel  = null;
            TerminologyUnit destUnitsVal = 0;

            TerminologyUtilities.GetAmountLabelTerminology(
                this.Project.GetDataSheet(Strings.DATASHEET_TERMINOLOGY_NAME), ref amountlabel, ref destUnitsVal);

            string destAreaLbl = TerminologyUtilities.TerminologyUnitToString(destUnitsVal);

            srcAreaUnits = srcAreaUnits.ToLower(CultureInfo.InvariantCulture);
            amountlabel  = amountlabel.ToLower(CultureInfo.InvariantCulture);
            destAreaLbl  = destAreaLbl.ToLower(CultureInfo.InvariantCulture);

            this.LabelRasterCellArea.Text = string.Format(CultureInfo.InvariantCulture, "Cell size ({0}):", srcAreaUnits);
            this.LabelCalcCellArea.Text   = string.Format(CultureInfo.InvariantCulture, "Cell size ({0}):", destAreaLbl);
            this.LabelCalcTtlAmount.Text  = string.Format(CultureInfo.InvariantCulture, "Total {0} ({1}):", amountlabel, destAreaLbl);

            // Calculate Cell Area in raster's native units
            float  cellSize = DataTableUtilities.GetDataSingle(drProp[Strings.DATASHEET_SPPIC_CELL_SIZE_COLUMN_NAME]);
            double cellArea = Math.Pow(cellSize, 2);

            this.TextBoxCellArea.Text = cellArea.ToString("N4", CultureInfo.InvariantCulture);

            // Calc Cell Area in terminology units
            double cellAreaTU   = 0;
            bool   SizeOverride = DataTableUtilities.GetDataBool(drProp[Strings.DATASHEET_SPPIC_CELL_AREA_OVERRIDE_COLUMN_NAME]);

            if (!SizeOverride)
            {
                cellAreaTU = InitialConditionsSpatialDataSheet.CalcCellArea(cellArea, srcSizeUnits, destUnitsVal);
                this.TextBoxCellAreaCalc.Text = cellAreaTU.ToString("N4", CultureInfo.InvariantCulture);
                drProp[Strings.DATASHEET_SPPIC_CELL_AREA_COLUMN_NAME] = cellAreaTU;
                TextBoxCellAreaCalc.ReadOnly = true;
            }
            else
            {
                cellAreaTU = DataTableUtilities.GetDataDbl(drProp[Strings.DATASHEET_SPPIC_CELL_AREA_COLUMN_NAME]);
                TextBoxCellAreaCalc.ReadOnly = false;
            }

            // Now calculate total area in the specified terminology units
            var ttlArea = cellAreaTU * NumCells;

            this.TextBoxTotalArea.Text = ttlArea.ToString("N4", CultureInfo.InvariantCulture);
        }
示例#7
0
        private List <StateClassShape> InternalGetStateClassShapes()
        {
            List <StateClassShape> lst = new List <StateClassShape>();

            DataRow[] rows = this.GetDTRows();

            foreach (DataRow dr in rows)
            {
                int    ShapeRow    = -1;
                int    ShapeColumn = -1;
                string Location    = Convert.ToString(dr[Strings.DATASHEET_DT_LOCATION_COLUMN_NAME], CultureInfo.InvariantCulture);

                LocationToRowCol(Location, ref ShapeRow, ref ShapeColumn);

                int?StratumIdSource         = null;
                int StateClassIdSource      = Convert.ToInt32(dr[Strings.DATASHEET_DT_STATECLASSIDSOURCE_COLUMN_NAME], CultureInfo.InvariantCulture);
                int?StratumIdDestination    = null;
                int?StateClassIdDestination = null;
                int?MinimumAge = null;
                int?MaximumAge = null;

                int    StateLabelXId   = Convert.ToInt32(DataTableUtilities.GetTableValue(this.m_SCDataSheet.GetData(), this.m_SCDataSheet.ValueMember, StateClassIdSource, Strings.DATASHEET_STATECLASS_STATE_LABEL_X_ID_COLUMN_NAME), CultureInfo.InvariantCulture);
                string StateLabelXName = Convert.ToString(DataTableUtilities.GetTableValue(this.m_SLXDataSheet.GetData(), this.m_SLXDataSheet.ValueMember, StateLabelXId, Strings.DATASHEET_NAME_COLUMN_NAME), CultureInfo.InvariantCulture);
                int    StateLabelYId   = Convert.ToInt32(DataTableUtilities.GetTableValue(this.m_SCDataSheet.GetData(), this.m_SCDataSheet.ValueMember, StateClassIdSource, Strings.DATASHEET_STATECLASS_STATE_LABEL_Y_ID_COLUMN_NAME), CultureInfo.InvariantCulture);
                string StateLabelYName = Convert.ToString(DataTableUtilities.GetTableValue(this.m_SLYDataSheet.GetData(), this.m_SLYDataSheet.ValueMember, StateLabelYId, Strings.DATASHEET_NAME_COLUMN_NAME), CultureInfo.InvariantCulture);

                if (dr[Strings.DATASHEET_DT_STRATUMIDSOURCE_COLUMN_NAME] != DBNull.Value)
                {
                    StratumIdSource = Convert.ToInt32(dr[Strings.DATASHEET_DT_STRATUMIDSOURCE_COLUMN_NAME], CultureInfo.InvariantCulture);
                }

                if (dr[Strings.DATASHEET_DT_STRATUMIDDEST_COLUMN_NAME] != DBNull.Value)
                {
                    StratumIdDestination = Convert.ToInt32(dr[Strings.DATASHEET_DT_STRATUMIDDEST_COLUMN_NAME], CultureInfo.InvariantCulture);
                }

                if (dr[Strings.DATASHEET_DT_STATECLASSIDDEST_COLUMN_NAME] != DBNull.Value)
                {
                    StateClassIdDestination = Convert.ToInt32(dr[Strings.DATASHEET_DT_STATECLASSIDDEST_COLUMN_NAME], CultureInfo.InvariantCulture);
                }

                if (dr[Strings.DATASHEET_AGE_MIN_COLUMN_NAME] != DBNull.Value)
                {
                    MinimumAge = Convert.ToInt32(dr[Strings.DATASHEET_AGE_MIN_COLUMN_NAME], CultureInfo.InvariantCulture);
                }

                if (dr[Strings.DATASHEET_AGE_MAX_COLUMN_NAME] != DBNull.Value)
                {
                    MaximumAge = Convert.ToInt32(dr[Strings.DATASHEET_AGE_MAX_COLUMN_NAME], CultureInfo.InvariantCulture);
                }

                string slxdesc = StateLabelXName;
                string slydesc = StateLabelYName;

                object o1 = DataTableUtilities.GetTableValue(this.m_SLXDataSheet.GetData(), this.m_SLXDataSheet.ValueMember, StateLabelXId, Strings.DATASHEET_DESCRIPTION_COLUMN_NAME);
                object o2 = DataTableUtilities.GetTableValue(this.m_SLYDataSheet.GetData(), this.m_SLYDataSheet.ValueMember, StateLabelYId, Strings.DATASHEET_DESCRIPTION_COLUMN_NAME);

                if (o1 != DBNull.Value)
                {
                    slxdesc = Convert.ToString(o1, CultureInfo.InvariantCulture);
                }

                if (o2 != DBNull.Value)
                {
                    slydesc = Convert.ToString(o2, CultureInfo.InvariantCulture);
                }

                StateClassShape Shape = new StateClassShape(this.m_DataFeed.Project, StratumIdSource, StateClassIdSource, StratumIdDestination, StateClassIdDestination, MinimumAge, MaximumAge, StateLabelXId, StateLabelXName, slxdesc, StateLabelYId, slydesc);

                Shape.Row    = ShapeRow;
                Shape.Column = ShapeColumn;

                DiagramShapeItem SlyItem = new DiagramShapeItem(StateLabelYName);
                SlyItem.Alignment = DiagramAlignment.Center;
                Shape.AddDiagramItem(SlyItem);

                int MinAge = 0;

                if (MinimumAge.HasValue)
                {
                    MinAge = MinimumAge.Value;
                }

                string AgeText = null;

                if (MaximumAge.HasValue)
                {
                    AgeText = string.Format(CultureInfo.InvariantCulture, "{0} - {1}", MinAge, MaximumAge.Value);
                }
                else
                {
                    AgeText = string.Format(CultureInfo.InvariantCulture, "{0}+", MinAge);
                }

                DiagramShapeItem item = new DiagramShapeItem(AgeText);

                item.Alignment = DiagramAlignment.Center;
                Shape.AddDiagramItem(item);

                bool IsWild = (this.m_StratumId.HasValue && !Shape.StratumIdSource.HasValue);

                if (IsWild)
                {
                    Shape.IsStatic       = true;
                    Shape.TitleTextColor = Constants.TRANSITION_DIAGRAM_READONLY_TEXT_COLOR;
                    Shape.BorderColor    = Constants.TRANSITION_DIAGRAM_SHAPE_READONLY_BORDER_COLOR;

                    foreach (DiagramShapeItem i in Shape.DiagramShapeItems)
                    {
                        i.ForegroundColor = Constants.TRANSITION_DIAGRAM_READONLY_TEXT_COLOR;
                    }
                }

                lst.Add(Shape);
            }

            return(lst);
        }
示例#8
0
        private static Transition CreatePT(DataRow dr)
        {
            int?   Iteration          = null;
            int?   Timestep           = null;
            int?   StratumIdSource    = null;
            int    StateClassIdSource = Convert.ToInt32(dr[Strings.DATASHEET_PT_STATECLASSIDSOURCE_COLUMN_NAME], CultureInfo.InvariantCulture);
            int?   StratumIdDest      = null;
            int?   StateClassIdDest   = null;
            int?   SecondaryStratumId = null;
            int?   TertiaryStratumId  = null;
            double Propn    = 1.0;
            int    AgeMin   = 0;
            int    AgeMax   = int.MaxValue;
            int    AgeRel   = 0;
            bool   AgeReset = true;
            int    TstMin   = 0;
            int    TstMax   = int.MaxValue;
            int    TstRel   = 0;

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

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

            if (dr[Strings.DATASHEET_PT_STRATUMIDSOURCE_COLUMN_NAME] != DBNull.Value)
            {
                StratumIdSource = Convert.ToInt32(dr[Strings.DATASHEET_PT_STRATUMIDSOURCE_COLUMN_NAME], CultureInfo.InvariantCulture);
            }

            if (dr[Strings.DATASHEET_PT_STRATUMIDDEST_COLUMN_NAME] != DBNull.Value)
            {
                StratumIdDest = Convert.ToInt32(dr[Strings.DATASHEET_PT_STRATUMIDDEST_COLUMN_NAME], CultureInfo.InvariantCulture);
            }

            if (dr[Strings.DATASHEET_PT_STATECLASSIDDEST_COLUMN_NAME] != DBNull.Value)
            {
                StateClassIdDest = Convert.ToInt32(dr[Strings.DATASHEET_PT_STATECLASSIDDEST_COLUMN_NAME], CultureInfo.InvariantCulture);
            }

            if (dr[Strings.DATASHEET_SECONDARY_STRATUM_ID_COLUMN_NAME] != DBNull.Value)
            {
                SecondaryStratumId = Convert.ToInt32(dr[Strings.DATASHEET_SECONDARY_STRATUM_ID_COLUMN_NAME], CultureInfo.InvariantCulture);
            }

            if (dr[Strings.DATASHEET_TERTIARY_STRATUM_ID_COLUMN_NAME] != DBNull.Value)
            {
                TertiaryStratumId = Convert.ToInt32(dr[Strings.DATASHEET_TERTIARY_STRATUM_ID_COLUMN_NAME], CultureInfo.InvariantCulture);
            }

            Transition pt = new Transition(
                Iteration, Timestep, StratumIdSource, StateClassIdSource, StratumIdDest, StateClassIdDest,
                SecondaryStratumId, TertiaryStratumId,
                Convert.ToInt32(dr[Strings.DATASHEET_TRANSITION_TYPE_ID_COLUMN_NAME], CultureInfo.InvariantCulture),
                Convert.ToDouble(dr[Strings.DATASHEET_PT_PROBABILITY_COLUMN_NAME], CultureInfo.InvariantCulture),
                Propn, AgeMin, AgeMax, AgeRel, AgeReset, TstMin, TstMax, TstRel);

            pt.PropnWasNull       = true;
            pt.AgeMinWasNull      = true;
            pt.AgeMaxWasNull      = true;
            pt.AgeRelativeWasNull = true;
            pt.AgeResetWasNull    = true;
            pt.TstMinimumWasNull  = true;
            pt.TstMaximumWasNull  = true;
            pt.TstRelativeWasNull = true;

            if (dr[Strings.DATASHEET_PT_PROPORTION_COLUMN_NAME] != DBNull.Value)
            {
                pt.Proportion   = Convert.ToDouble(dr[Strings.DATASHEET_PT_PROPORTION_COLUMN_NAME], CultureInfo.InvariantCulture);
                pt.PropnWasNull = false;
            }

            if (dr[Strings.DATASHEET_AGE_MIN_COLUMN_NAME] != DBNull.Value)
            {
                pt.AgeMinimum    = Convert.ToInt32(dr[Strings.DATASHEET_AGE_MIN_COLUMN_NAME], CultureInfo.InvariantCulture);
                pt.AgeMinWasNull = false;
            }

            if (dr[Strings.DATASHEET_AGE_MAX_COLUMN_NAME] != DBNull.Value)
            {
                pt.AgeMaximum    = Convert.ToInt32(dr[Strings.DATASHEET_AGE_MAX_COLUMN_NAME], CultureInfo.InvariantCulture);
                pt.AgeMaxWasNull = false;
            }

            if (dr[Strings.DATASHEET_PT_AGE_RELATIVE_COLUMN_NAME] != DBNull.Value)
            {
                pt.AgeRelative        = Convert.ToInt32(dr[Strings.DATASHEET_PT_AGE_RELATIVE_COLUMN_NAME], CultureInfo.InvariantCulture);
                pt.AgeRelativeWasNull = false;
            }

            if (dr[Strings.DATASHEET_PT_AGE_RESET_COLUMN_NAME] != DBNull.Value)
            {
                pt.AgeReset        = DataTableUtilities.GetDataBool(dr[Strings.DATASHEET_PT_AGE_RESET_COLUMN_NAME]);
                pt.AgeResetWasNull = false;
            }

            if (dr[Strings.DATASHEET_PT_TST_MIN_COLUMN_NAME] != DBNull.Value)
            {
                pt.TstMinimum        = Convert.ToInt32(dr[Strings.DATASHEET_PT_TST_MIN_COLUMN_NAME], CultureInfo.InvariantCulture);
                pt.TstMinimumWasNull = false;
            }

            if (dr[Strings.DATASHEET_PT_TST_MAX_COLUMN_NAME] != DBNull.Value)
            {
                pt.TstMaximum        = Convert.ToInt32(dr[Strings.DATASHEET_PT_TST_MAX_COLUMN_NAME], CultureInfo.InvariantCulture);
                pt.TstMaximumWasNull = false;
            }

            if (dr[Strings.DATASHEET_PT_TST_RELATIVE_COLUMN_NAME] != DBNull.Value)
            {
                pt.TstRelative        = Convert.ToInt32(dr[Strings.DATASHEET_PT_TST_RELATIVE_COLUMN_NAME], CultureInfo.InvariantCulture);
                pt.TstRelativeWasNull = false;
            }

            return(pt);
        }