Example #1
0
        public void AddMeasuresToConfiguration(List <SimulationMeasure> selectedMeasures)
        {
            //if (this.measuresTreeView.SelectedNodes
            UltraGridRow parentGridRow = null;
            UltraGridRow childGridRow  = null;


            if (this.ugSimulationgropus.ActiveRow != null)
            {
                parentGridRow = (UltraGridRow)ugSimulationgropus.ActiveRow;
            }

            if (parentGridRow != null && parentGridRow.Band.Key == Constants.BAND_ZONE)
            {
                childGridRow  = parentGridRow;
                parentGridRow = parentGridRow.ParentRow;
            }

            if (parentGridRow == null && this.ugSimulationgropus.Rows.Count == 1)
            {
                this.ugSimulationgropus.ActiveRow = ugSimulationgropus.Rows[0];
                parentGridRow = (UltraGridRow)ugSimulationgropus.Rows[0];
            }

            if (parentGridRow != null && (parentGridRow.Band.Index == 0 || parentGridRow.Band.Index == 1) &&
                parentGridRow.Band.Key != Constants.BAND_ZONE)
            {
                if (selectedMeasures?.Count > 0)
                {
                    foreach (SimulationMeasure measure in selectedMeasures)
                    {
                        UltraDataRow            dr       = parentGridRow.ListObject as UltraDataRow;
                        UltraDataRowsCollection rowsList = dr.GetChildRows(Constants.BAND_ZONE);
                        bool isMeasureExists             = false;
                        foreach (UltraDataRow row in rowsList)
                        {
                            if (measure.Name == Convert.ToString(row[Constants.COLUMN_CONFIGURATION]))
                            {
                                isMeasureExists = true;
                                break;
                            }
                        }
                        if (!isMeasureExists)
                        {
                            if (rowsList.Count == 1 && Convert.ToString(rowsList[0][Constants.COLUMN_CONFIGURATION]) == Constants.TextNoMeasuresSelected)
                            {
                                rowsList.Clear();
                            }


                            UltraDataRow measureRow = rowsList.Add(new object[] { measure.Name });
                        }
                        else
                        {
                            MessageBox.Show("Measure already exists");
                        }
                    }
                }
            }
        }
Example #2
0
        private void btnAddMeasure_Click(object sender, EventArgs e)
        {
            //if (this.measuresTreeView.SelectedNodes
            UltraGridRow parentGridRow = null;
            UltraGridRow childGridRow  = null;



            if (this.ugSimulationgropus.ActiveRow != null)
            {
                parentGridRow = (UltraGridRow)ugSimulationgropus.ActiveRow;
            }

            if (parentGridRow != null && parentGridRow.Band.Key == "ZONE")
            {
                childGridRow  = parentGridRow;
                parentGridRow = parentGridRow.ParentRow;
            }

            if (parentGridRow == null && this.ugSimulationgropus.Rows.Count == 1)
            {
                this.ugSimulationgropus.ActiveRow = ugSimulationgropus.Rows[0];
                parentGridRow = (UltraGridRow)ugSimulationgropus.Rows[0];
            }

            if (parentGridRow != null && (parentGridRow.Band.Index == 0 || parentGridRow.Band.Index == 1) &&
                parentGridRow.Band.Key != "ZONE")
            {
                if (measuresTreeView.SelectedNodes?.Count > 0)
                {
                    List <SimulationMeasure> selectedMeasures = new List <SimulationMeasure>();
                    foreach (UltraTreeNode measureNode in measuresTreeView.SelectedNodes)
                    {
                        SimulationMeasure measure = measureNode.ListObject as SimulationMeasure;
                        if (measureNode.Level == 2)
                        {
                            UltraDataRow            dr       = parentGridRow.ListObject as UltraDataRow;
                            UltraDataRowsCollection rowsList = dr.GetChildRows("ZONE");
                            bool isMeasureExists             = false;
                            foreach (UltraDataRow row in rowsList)
                            {
                                if (measure.Name == Convert.ToString(row["Configuration"]))
                                {
                                    isMeasureExists = true;
                                    break;
                                }
                            }
                            if (!isMeasureExists)
                            {
                                UltraDataRow measureRow = rowsList.Add(new object[] { measure.Name });
                            }
                            else
                            {
                                MessageBox.Show("Measure already exists");
                            }
                        }
                    }
                }
            }
        }