Exemplo n.º 1
0
        private void InternalAddStateClass()
        {
            ChooseStateClassForm dlg = new ChooseStateClassForm();

            if (!dlg.Initialize(this, this.m_DataFeed, false))
            {
                return;
            }

            if (dlg.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            string Location = this.GetNextStateClassLocation();

            if (Location == null)
            {
                FormsUtilities.ErrorMessageBox(MessageStrings.ERROR_DIAGRAM_NO_MORE_LOCATIONS);
                return;
            }

            int StateClassId = this.GetStateClassId(dlg.ChosenStateLabelX.Value, dlg.ChosenStateLabelY.Value);

            if (StateClassId == -1)
            {
                StateClassId = this.InternalCreateNewStateClass(dlg.ChosenStateLabelX, dlg.ChosenStateLabelY);
            }

            this.m_DTDataSheet.BeginAddRows();
            DataRow dr = this.m_DTDataSheet.GetData().NewRow();

            dr[Strings.DATASHEET_DT_STRATUMIDSOURCE_COLUMN_NAME]    = DataTableUtilities.GetNullableDatabaseValue(this.m_StratumId);
            dr[Strings.DATASHEET_DT_STATECLASSIDSOURCE_COLUMN_NAME] = StateClassId;
            dr[Strings.DATASHEET_DT_STRATUMIDDEST_COLUMN_NAME]      = DBNull.Value;
            dr[Strings.DATASHEET_DT_STATECLASSIDDEST_COLUMN_NAME]   = DBNull.Value;
            dr[Strings.DATASHEET_AGE_MIN_COLUMN_NAME]     = DBNull.Value;
            dr[Strings.DATASHEET_AGE_MAX_COLUMN_NAME]     = DBNull.Value;
            dr[Strings.DATASHEET_DT_LOCATION_COLUMN_NAME] = Location;

            this.m_DTDataSheet.GetData().Rows.Add(dr);
            this.m_DTDataSheet.EndAddRows();

            this.RefreshDiagram();
            this.SelectStateClass(StateClassId);
        }
Exemplo n.º 2
0
        private void InternalEditStateClass()
        {
            Debug.Assert(this.SelectedShapes.Count() == 1);

            ChooseStateClassForm dlg = new ChooseStateClassForm();

            dlg.Initialize(this, this.m_DataFeed, true);

            if (dlg.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            StateClassShape EditShape       = (StateClassShape)this.SelectedShapes.First();
            int             OldStateClassId = this.GetStateClassId(EditShape.StateLabelXId, EditShape.StateLabelYId);
            int             NewStateClassId = this.GetStateClassId(dlg.ChosenStateLabelX.Value, dlg.ChosenStateLabelY.Value);

            if (OldStateClassId == NewStateClassId)
            {
                return;
            }

            if (NewStateClassId == -1)
            {
                NewStateClassId = this.InternalCreateNewStateClass(dlg.ChosenStateLabelX, dlg.ChosenStateLabelY);
            }

            this.m_DTDataSheet.BeginModifyRows();
            this.m_PTDataSheet.BeginModifyRows();

            InternalChangeStateClassId(this.m_DTDataSheet, Strings.DATASHEET_DT_STRATUMIDSOURCE_COLUMN_NAME, Strings.DATASHEET_DT_STATECLASSIDSOURCE_COLUMN_NAME, Strings.DATASHEET_DT_STRATUMIDDEST_COLUMN_NAME, Strings.DATASHEET_DT_STATECLASSIDDEST_COLUMN_NAME, OldStateClassId, NewStateClassId, this.m_StratumId);

            InternalChangeStateClassId(this.m_PTDataSheet, Strings.DATASHEET_PT_STRATUMIDSOURCE_COLUMN_NAME, Strings.DATASHEET_PT_STATECLASSIDSOURCE_COLUMN_NAME, Strings.DATASHEET_PT_STRATUMIDDEST_COLUMN_NAME, Strings.DATASHEET_PT_STATECLASSIDDEST_COLUMN_NAME, OldStateClassId, NewStateClassId, this.m_StratumId);

            this.m_DTDataSheet.EndModifyRows();
            this.m_PTDataSheet.EndModifyRows();

            this.RefreshDiagram();
            this.SelectStateClass(NewStateClassId);
        }