Exemple #1
0
        private void btnQueryBuilder_Click(object sender, EventArgs e)
        {
            FormQueryBuilder dlg = new FormQueryBuilder(_tc);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                txtFilter.Text = dlg.whereClause;
            }
        }
Exemple #2
0
        private void customRoadReport(FormQueryBuilder tableFilters)
        {
            bool   selectResults = false;
            string surfaceType   = tableFilters.getSurface();
            string query         = tableFilters.getQuery();

            if (tableFilters.checkBoxSelectResults.Checked && query != "SELECT * FROM road")
            {
                selectResults = true;
            }
            query += " GROUP BY TAMSID ORDER BY TAMSID ASC, survey_date DESC;";
            DataTable results = Database.GetDataByQuery(Project.conn, query);

            if (results.Rows.Count == 0)
            {
                MessageBox.Show("No roads matching the given description were found.");
                return;
            }
            DataTable    outputTable    = roadReports.addColumns(surfaceType);
            FormOutput   report         = new FormOutput(Project, moduleRoads);
            FeatureLayer selectionLayer = (FeatureLayer)moduleRoads.Layer;

            selectionLayer.ClearSelection();
            foreach (DataRow row in results.Rows)
            {
                if (selectResults)
                {
                    String tamsidcolumn = Project.settings.GetValue("road_f_TAMSID");
                    selectionLayer.SelectByAttribute(tamsidcolumn + " = " + row["TAMSID"], ModifySelectionMode.Append);
                }

                DataRow nr   = outputTable.NewRow();
                string  note = row["notes"].ToString().Split(new[] { '\r', '\n' }).FirstOrDefault(); //retrive most recent note

                int oldNoteLength = note.Length;
                int maxLength     = 17;
                if (!string.IsNullOrEmpty(note))
                {
                    note = note.Substring(0, Math.Min(oldNoteLength, maxLength));
                    if (note.Length == maxLength)
                    {
                        note += "...";
                    }
                }
                roadReports.addRows(nr, row, surfaceType);
                outputTable.Rows.Add(nr);
            }
            report.dataGridViewReport.DataSource = outputTable;
            report.Text = "Treatment Report";
            report.Show();
            if (selectResults)
            {
                moduleRoads.selectionChanged();
            }
        }
Exemple #3
0
        private void btnQueryBuilder_Click(object sender, EventArgs e)
        {
            if (_rule == null || _layer == null)
            {
                return;
            }

            FormQueryBuilder dlg = new FormQueryBuilder(_layer);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                txtQuery.Text = dlg.whereClause;
            }
        }
Exemple #4
0
        public void newCustomReport()
        {
            int selectTab = 0;

            if (window.tabControlControls.SelectedIndex == 0)
            {
                selectTab = 0;
            }
            if (window.tabControlControls.SelectedIndex == 1)
            {
                selectTab = 1;
            }
            if (window.tabControlControls.SelectedIndex == 2)
            {
                selectTab = 3;
            }
            FormQueryBuilder tableFilters = new FormQueryBuilder(Project, selectTab, moduleRoads);

            if (tableFilters.ShowDialog() == DialogResult.OK)
            {
                if (tableFilters.tabControlCustom.SelectedTab.Text == "Road")
                {
                    customRoadReport(tableFilters);
                }
                if (tableFilters.tabControlCustom.SelectedTab.Text == "Sign")
                {
                    customSignReport(tableFilters);
                }
                if (tableFilters.tabControlCustom.SelectedTab.Text == "Support")
                {
                    customSupportReport(tableFilters);
                }
                if (tableFilters.tabControlCustom.SelectedTab.Text == "Other")
                {
                    customOtherReport(tableFilters);
                }
            }
            tableFilters.Close();
        }
Exemple #5
0
        private void customOtherReport(FormQueryBuilder tableFilters)
        {
            bool   selectResults = false;
            string query         = tableFilters.getQuery();

            if (tableFilters.checkBoxSelectResults.Checked && query != "SELECT * FROM miscellaneous")
            {
                selectResults = true;
            }

            string    type    = tableFilters.getType();
            DataTable results = Database.GetDataByQuery(Project.conn, query);

            if (type == "Roads with Sidewalks")
            {
                query += " GROUP BY road_ID ORDER BY road_ID ASC;";
                DataTable r = Database.GetDataByQuery(Project.conn, query);
                if (r.Rows.Count == 0)
                {
                    MessageBox.Show("No landmarks matching the given description were found.");
                    return;
                }
                otherReports.RoadsWithSidewalks(null, null, query);
            }
            else
            {
                query  += " GROUP BY TAMSID ORDER BY TAMSID ASC;";
                results = Database.GetDataByQuery(Project.conn, query);
                if (results.Rows.Count == 0)
                {
                    MessageBox.Show("No landmarks matching the given description were found.");
                    return;
                }

                if (type == "Sidewalk")
                {
                    otherReports.SidewalkReport(null, null, query);
                }
                else if (type == "ADA Ramp")
                {
                    otherReports.RampReport(null, null, query);
                }
                else if (type == "Severe Road Distress")
                {
                    otherReports.RoadReport(null, null, query);
                }
                else if (type == "Drainage")
                {
                    otherReports.DrainageReport(null, null, query);
                }
                else if (type == "Accident")
                {
                    otherReports.AccidentReport(null, null, query);
                }
                else if (type == "Other")
                {
                    otherReports.OtherReport(null, null, query);
                }
                else
                {
                    otherReports.MiscReport(null, null, query);
                }
            }

            if (selectResults)
            {
                FeatureLayer selectionLayer     = (FeatureLayer)moduleOther.Layer;
                FeatureLayer roadSelectionLayer = (FeatureLayer)moduleRoads.Layer;
                selectionLayer.ClearSelection();
                roadSelectionLayer.ClearSelection();
                foreach (DataRow row in results.Rows)
                {
                    if (selectResults)
                    {
                        String tamsidcolumn;
                        if (type == "Roads with Sidewalks")
                        {
                            tamsidcolumn = Project.settings.GetValue("road_f_TAMSID");
                            roadSelectionLayer.SelectByAttribute(tamsidcolumn + " = " + row["road_ID"], ModifySelectionMode.Append);
                            moduleRoads.selectionChanged();
                            continue;
                        }
                        tamsidcolumn = Project.settings.GetValue("miscellaneous_f_TAMSID");
                        selectionLayer.SelectByAttribute(tamsidcolumn + " = " + row["TAMSID"], ModifySelectionMode.Append);
                    }
                }
                moduleOther.selectionChanged();
            }
            return;
        }