Example #1
0
        private string GetSlyName(DataRow dr)
        {
            DataTable slydata = this.m_SlySheet.GetData();
            int       slyid   = Convert.ToInt32(dr[Strings.DATASHEET_STATECLASS_STATE_LABEL_Y_ID_COLUMN_NAME], CultureInfo.InvariantCulture);
            string    slyname = Convert.ToString(DataTableUtilities.GetTableValue(slydata, this.m_SlySheet.ValueMember, slyid, Strings.DATASHEET_NAME_COLUMN_NAME), CultureInfo.InvariantCulture);

            return(slyname);
        }
Example #2
0
        public void ThrowDataException(int stateClassId, bool isDestination)
        {
            string    psl                 = null;
            string    ssl                 = null;
            string    tsl                 = null;
            string    StateClassName      = "NULL";
            DataSheet StateClassDataSheet = this.m_Project.GetDataSheet(Strings.DATASHEET_STATECLASS_NAME);
            string    Location            = "From";

            if (isDestination)
            {
                Location = "To";
            }

            TerminologyUtilities.GetStratumLabelTerminology(this.m_Project.GetDataSheet(Strings.DATASHEET_TERMINOLOGY_NAME), ref psl, ref ssl, ref tsl);
            StateClassName = Convert.ToString(DataTableUtilities.GetTableValue(StateClassDataSheet.GetData(), StateClassDataSheet.ValueMember, stateClassId, Strings.DATASHEET_NAME_COLUMN_NAME), CultureInfo.InvariantCulture);
            string msg = string.Format(CultureInfo.InvariantCulture, "The state class '{0}' could not be located in '{1} {2}'.", StateClassName, Location, psl);

            throw new DataException(msg);
        }
Example #3
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);
        }