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; }
public GenericModule(TamsProject theProject, TabPage controlPage, ToolStripMenuItem[] boundButtons, string mn = "miscellaneous") : base(theProject, controlPage, boundButtons, itemSelectionSql) { ModuleName = mn; reports = new OtherReports(theProject, this); boundButtons[1].Click += new EventHandler(delegate(object sender, EventArgs e) { reports.SidewalkReport(sender, e); }); boundButtons[2].Click += new EventHandler(delegate(object sender, EventArgs e) { reports.RoadReport(sender, e); }); boundButtons[3].Click += new EventHandler(delegate(object sender, EventArgs e) { reports.RampReport(sender, e); }); boundButtons[4].Click += new EventHandler(delegate(object sender, EventArgs e) { reports.DrainageReport(sender, e); });; boundButtons[5].Click += new EventHandler(delegate(object sender, EventArgs e) { reports.AccidentReport(sender, e); }); boundButtons[6].Click += new EventHandler(delegate(object sender, EventArgs e) { reports.OtherReport(sender, e); }); boundButtons[7].Click += new EventHandler(delegate(object sender, EventArgs e) { reports.RoadsWithSidewalks(sender, e); }); setControlPanel(); ModuleSettings.Add(new ProjectSetting(name: ModuleName + "_file", module: ModuleName)); ModuleSettings.Add(new ProjectSetting(name: ModuleName + "_relative", module: ModuleName)); FieldSettingToDbColumn = new Dictionary <string, string>() { { ModuleName + "_f_TAMSID", "TAMSID" } }; icons = new Dictionary <string, string>() { { "Severe Road Distress", "road" }, { "Other", "other" }, { "ADA Ramp", "ramp" }, { "Sidewalk", "sidewalk" }, { "Drainage", "drainage" }, { "Accident", "accident" } }; Project.map.ResetBuffer(); Project.map.Update(); }