コード例 #1
0
        private void editCriteriaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int nRow = 0;

            if (dgvPerfomance.SelectedRows.Count > 0 || dgvPerfomance.SelectedCells.Count > 0)
            {
                if (dgvPerfomance.SelectedRows.Count > 0)
                {
                    nRow = dgvPerfomance.SelectedRows[0].Index;
                }
                else if (dgvPerfomance.SelectedCells.Count > 0)
                {
                    nRow = dgvPerfomance.SelectedCells[0].RowIndex;
                }
            }
            else
            {
                return;
            }
            DataGridViewRow row      = dgvPerfomance.Rows[nRow];
            String          strValue = "";

            if (row.Cells[3].Value != null)
            {
                strValue = row.Cells[3].Value.ToString();
            }

            FormAdvancedSearch advancedSearch = new FormAdvancedSearch(m_strNetwork, m_hashAttributeYear, strValue, true);

            if (advancedSearch.ShowDialog() == DialogResult.OK)
            {
                row.Cells[3].Value = advancedSearch.GetWhereClause();
            }
        }
コード例 #2
0
ファイル: FormSectionView.cs プロジェクト: jakedw7/iAM
        private void buttonAdvancedSearch_Click(object sender, EventArgs e)
        {
            FormAdvancedSearch formSearch = new FormAdvancedSearch(m_strNetwork, m_hashAttributeYear, textBoxAdvanceSearch.Text, false);

            if (formSearch.ShowDialog() == DialogResult.OK)
            {
                textBoxAdvanceSearch.Text = formSearch.GetWhereClause();
                UpdateSectionGrid();
            }
        }
コード例 #3
0
        private void dgvPerfomance_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 2)
            {
                if (Global.SecurityOperations.CanModifySimulationPerformance(m_strNetworkID, m_strSimulationID))
                {
                    if (dgvPerfomance.Rows[e.RowIndex].Cells[0].Value == null)
                    {
                        Global.WriteOutput("Error: Select a performance attribute before editing the performance equation or criteria.");
                        return;
                    }

                    String strAttribute = dgvPerfomance.Rows[e.RowIndex].Cells[0].Value.ToString();
                    if (strAttribute.Trim().Length == 0)
                    {
                        Global.WriteOutput("Error: Select a performance attribute before editing the performance equation or criteria.");
                        return;
                    }

                    String strCriteria = "";
                    if (e.ColumnIndex == 2)
                    {
                        Performance performance = (Performance)dgvPerfomance.Rows[e.RowIndex].Tag;
                        if (performance == null)
                        {
                            performance = new Performance();
                        }
                        FormEditEquation formEditEquation = new FormEditEquation(performance);


                        if (formEditEquation.ShowDialog() == DialogResult.OK)
                        {
                            dgvPerfomance.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = performance.Equation;
                            dgvPerfomance.Update();
                        }
                    }
                    else if (e.ColumnIndex == 3)
                    {
                        if (dgvPerfomance.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
                        {
                            strCriteria = dgvPerfomance.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                        }
                        FormAdvancedSearch formAdvancedSearch = new FormAdvancedSearch(m_strNetwork, m_hashAttributeYear, strCriteria, true);
                        if (formAdvancedSearch.ShowDialog() == DialogResult.OK)
                        {
                            dgvPerfomance[e.ColumnIndex, e.RowIndex].Value = formAdvancedSearch.GetWhereClause();
                        }
                        dgvPerfomance.Update();
                    }
                }
            }
        }
コード例 #4
0
ファイル: FormGISView.cs プロジェクト: jakedw7/iAM
        private void NetworkAdvancedSearch()
        {
            if (MainMapImage.Map.Layers.Count > 0)
            {
                ApplyOldColorsToGeoms(true);
                String             strQuery = tbAdvancedSearch.Text;
                FormAdvancedSearch form     = new FormAdvancedSearch(m_strNetworkID, m_strSimulationID, tbAdvancedSearch.Text);
                form.Text = "Attribute/Network Map";
                if (form.ShowDialog() == DialogResult.OK)
                {
                    tbAdvancedSearch.Text = form.GetWhereClause();
                    m_htAdvancedSearchOldColors.Clear();
                    String strSelect;
                    strSelect = "SELECT SECTION_" + m_strNetworkID + ".SECTIONID";

                    String strFrom = DBOp.BuildFromStatement(m_strNetworkID, m_strSimulationID, true);
                    strSelect += strFrom;

                    String strWhere = tbAdvancedSearch.Text;
                    strSelect += " WHERE " + strWhere;

                    String   strSectionID;
                    Geometry geo;
                    try
                    {
                        DataReader dr = new DataReader(strSelect);
                        while (dr.Read())
                        {
                            strSectionID = dr["SECTIONID"].ToString();
                            geo          = (Geometry)MainMapImage.Map.Layers[0].GeoIDs[strSectionID];
                            if (geo != null)
                            {
                                m_htAdvancedSearchOldColors.Add(geo, geo.Color);
                                geo.Color  = Color.Gold;
                                geo.Width_ = 3;
                            }
                        }
                        dr.Close();
                    }
                    catch (Exception exc)
                    {
                        Global.WriteOutput("Error: Advanced attribute search failed. " + exc.Message);
                        return;
                    }
                    MainMapImage.Refresh();
                }
            }
        }
コード例 #5
0
ファイル: FormGISView.cs プロジェクト: jakedw7/iAM
        private void AttributeAdvancedSearch()
        {
            String             strQuery = tbAdvancedSearch.Text;
            FormAdvancedSearch form     = new FormAdvancedSearch(m_strNetworkID, m_strSimulationID, tbAdvancedSearch.Text);

            form.Text = "Attribute/Network Map";
            if (form.ShowDialog() == DialogResult.OK)
            {
                tbAdvancedSearch.Text = form.GetWhereClause();
                if (!String.IsNullOrEmpty(m_strYear) && !String.IsNullOrEmpty(m_strAttribute))
                {
                    FormGISLayerManager formGISLayerManager;
                    if (FormManager.IsFormGISLayerManagerOpen(out formGISLayerManager))
                    {
                        DisplayAttribute(m_strAttribute, m_strYear, formGISLayerManager.GetLayerColors(m_strAttribute, m_strYear, m_strNetworkID), 1);
                    }
                }
            }
        }
コード例 #6
0
ファイル: FormAttributeView.cs プロジェクト: jakedw7/iAM
        private void buttonAdvancedSearch_Click(object sender, EventArgs e)
        {
            String strSimulationID = "";
            String strSimulation   = toolStripComboBoxSimulation.Text;

            if (strSimulation == "")
            {
                strSimulationID = "";
            }
            else
            {
                strSimulationID = m_hashSimulationID[strSimulation].ToString();
            }

            FormAdvancedSearch formSearch = new FormAdvancedSearch(m_strNetworkID, strSimulationID, textBoxAdvanceSearch.Text);

            if (formSearch.ShowDialog() == DialogResult.OK)
            {
                textBoxAdvanceSearch.Text = formSearch.GetWhereClause();
                UpdateAttributeView(new List <String>(), true);
            }
        }
コード例 #7
0
ファイル: FormCompoundTreatment.cs プロジェクト: jakedw7/iAM
 private void dataGridViewCompoundTreatmentElements_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     // Extent column or Quantity column
     if (e.ColumnIndex != -1)
     {
         // Select only one element at a time for editing
         if (dataGridViewCompoundTreatmentElements.SelectedCells.Count == 1)
         {
             // If the selected cell contains data
             if (e.RowIndex != -1)
             {
                 CompoundTreatmentElement selectedCompoundElement = (CompoundTreatmentElement)dataGridViewCompoundTreatmentElements["colCompoundTreatmentElement", e.RowIndex].Value;
                 if (selectedCompoundElement != null)
                 {
                     if (dataGridViewCompoundTreatmentElements.Columns["colExtent"].Index == e.ColumnIndex)
                     {
                         // Extent column selected
                         FormEditEquation formEditCompoundElementEquation = new FormEditEquation(selectedCompoundElement.ExtentEquation.m_expression, _effectedTreatmentAttribute);
                         if (formEditCompoundElementEquation.ShowDialog() == DialogResult.OK)
                         {
                             selectedCompoundElement.ExtentEquation.m_expression = formEditCompoundElementEquation.Equation;
                             dataGridViewCompoundTreatmentElements[e.ColumnIndex, e.RowIndex].Value = formEditCompoundElementEquation.Equation;
                         }
                     }
                     if (dataGridViewCompoundTreatmentElements.Columns["colQuantity"].Index == e.ColumnIndex)
                     {
                         // Quantity column selected
                         FormEditEquation formEditCompoundElementEquation = new FormEditEquation(selectedCompoundElement.Quantity.m_expression, _effectedTreatmentAttribute);
                         if (formEditCompoundElementEquation.ShowDialog() == DialogResult.OK)
                         {
                             selectedCompoundElement.Quantity.m_expression = formEditCompoundElementEquation.Equation;
                             dataGridViewCompoundTreatmentElements[e.ColumnIndex, e.RowIndex].Value = formEditCompoundElementEquation.Equation;
                         }
                     }
                     if (dataGridViewCompoundTreatmentElements.Columns["colCriteria"].Index == e.ColumnIndex)
                     {
                         // Criteria column selected
                         FormAdvancedSearch formEditCriteria = new FormAdvancedSearch(selectedCompoundElement.CriteriaEquation.Criteria);
                         if (formEditCriteria.ShowDialog() == DialogResult.OK)
                         {
                             selectedCompoundElement.CriteriaEquation.Criteria = formEditCriteria.GetWhereClause();
                             dataGridViewCompoundTreatmentElements[e.ColumnIndex, e.RowIndex].Value = formEditCriteria.GetWhereClause();
                         }
                     }
                     if (dataGridViewCompoundTreatmentElements.Columns["colCost"].Index == e.ColumnIndex)
                     {
                         // Cost column selected
                         FormEditEquation formEditCompoundElementExtent = new FormEditEquation(selectedCompoundElement.CostEquation.m_expression, _effectedTreatmentAttribute);
                         if (formEditCompoundElementExtent.ShowDialog() == DialogResult.OK)
                         {
                             selectedCompoundElement.CostEquation.m_expression = formEditCompoundElementExtent.Equation;
                             dataGridViewCompoundTreatmentElements[e.ColumnIndex, e.RowIndex].Value = formEditCompoundElementExtent.Equation;
                         }
                     }
                 }
             }
             else
             {
                 if (dataGridViewCompoundTreatmentElements.Columns["colExtent"].Index == e.ColumnIndex)
                 {
                     // Extent column selected
                     FormEditEquation formEditCompoundElementEquation = new FormEditEquation("", _effectedTreatmentAttribute);
                     if (formEditCompoundElementEquation.ShowDialog() == DialogResult.OK)
                     {
                         dataGridViewCompoundTreatmentElements[e.ColumnIndex, e.RowIndex].Value = formEditCompoundElementEquation.Equation;
                     }
                 }
                 if (dataGridViewCompoundTreatmentElements.Columns["colQuantity"].Index == e.ColumnIndex)
                 {
                     // Quantity column selected
                     FormEditEquation formEditCompoundElementEquation = new FormEditEquation("", _effectedTreatmentAttribute);
                     if (formEditCompoundElementEquation.ShowDialog() == DialogResult.OK)
                     {
                         dataGridViewCompoundTreatmentElements[e.ColumnIndex, e.RowIndex].Value = formEditCompoundElementEquation.Equation;
                     }
                 }
                 if (dataGridViewCompoundTreatmentElements.Columns["colCriteria"].Index == e.ColumnIndex)
                 {
                     // Criteria column selected
                     FormAdvancedSearch formEditCriteria = new FormAdvancedSearch("");
                     if (formEditCriteria.ShowDialog() == DialogResult.OK)
                     {
                         dataGridViewCompoundTreatmentElements[e.ColumnIndex, e.RowIndex].Value = formEditCriteria.GetWhereClause();
                     }
                 }
                 if (dataGridViewCompoundTreatmentElements.Columns["colCost"].Index == e.ColumnIndex)
                 {
                     // Cost column selected
                     FormEditEquation formEditCompoundElementExtent = new FormEditEquation("", _effectedTreatmentAttribute);
                     if (formEditCompoundElementExtent.ShowDialog() == DialogResult.OK)
                     {
                         dataGridViewCompoundTreatmentElements[e.ColumnIndex, e.RowIndex].Value = formEditCompoundElementExtent.Equation;
                     }
                 }
             }
         }
     }
 }
コード例 #8
0
ファイル: FormInvestment.cs プロジェクト: Tubbz-alt/iAM
 private void DataGridViewBudgetCriteria_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.ColumnIndex == 1 && e.RowIndex != -1)
     {
         if (Global.SecurityOperations.CanModifySimulationTreatment(m_strNetworkID, m_strSimID))
         {
             var strCriteria = "";
             if (dataGridViewBudgetCriteria.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
             {
                 strCriteria = dataGridViewBudgetCriteria.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
             }
             var formAdvancedSearch = new FormAdvancedSearch(m_strNetwork, m_hashAttributeYear, strCriteria, true);
             if (formAdvancedSearch.ShowDialog() == DialogResult.OK)
             {
                 dataGridViewBudgetCriteria[e.ColumnIndex, e.RowIndex].Value = formAdvancedSearch.GetWhereClause();
             }
             dataGridViewBudgetCriteria.Update();
         }
     }
 }
コード例 #9
0
ファイル: FormInvestment.cs プロジェクト: Tubbz-alt/iAM
        private void DataGridViewSplitTreatmentCriteria_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;                //Must be valid row index
            }
            if (e.ColumnIndex == 0)
            {
                return;
            }

            var strCriteria = "";

            if (dataGridViewSplitTreatmentCriteria.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
            {
                strCriteria = dataGridViewSplitTreatmentCriteria.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
            }
            else
            {
                dataGridViewSplitTreatmentCriteria.Rows.Add();
            }
            var formAdvancedSearch = new FormAdvancedSearch(m_strNetwork, m_hashAttributeYear, strCriteria, true);

            if (formAdvancedSearch.ShowDialog() == DialogResult.OK)
            {
                dataGridViewSplitTreatmentCriteria[e.ColumnIndex, e.RowIndex].Value = formAdvancedSearch.GetWhereClause();
            }
            dataGridViewSplitTreatmentCriteria.Update();
        }